Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private Page name1;
- private Page name2;
- private Page _currentPage;
- public Page CurrentPage
- {
- get
- {
- return _currentPage;
- }
- set
- {
- _currentPage = value;
- RaisePropertyChanged(nameof(CurrentPage));
- }
- }
- private double _frameOpacity;
- public double FrameOpacity
- {
- get
- {
- return _frameOpacity;
- }
- set
- {
- _frameopacity = value;
- RaisePropertyChanged(nameof(FrameOpacity))
- }
- }
- public MainViewModel()
- {
- name1 = new name1();
- name2 = new name2();
- FrameOpacity = 1;
- CurrentPage = name1;
- }
- public ICommand Name1Btn_Click
- {
- get
- {
- return new RelayCommand(() => SlowOpacity(name1));
- }
- }
- public ICommand Name2Btn_Click
- {
- get
- {
- return new RelayCommand(() => SlowOpacity(name2));
- }
- }
- private async void SlowOpacity(Page page)
- {
- await Task.Factory.Startnew(() =>
- {
- CurrentPage = page; //Универсальный метод для всех наших страниц
- for(double i = 0.0; i < 1.1; i += 0.1)
- {
- FrameOpacity = i;
- Thread.Sleep(15);
- }
- }
- }
Add Comment
Please, Sign In to add comment