Guest User

Untitled

a guest
Apr 20th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. private Page name1;
  2. private Page name2;
  3.  
  4. private Page _currentPage;
  5. public Page CurrentPage
  6. {
  7. get
  8. {
  9. return _currentPage;
  10. }
  11.  
  12. set
  13. {
  14. _currentPage = value;
  15. RaisePropertyChanged(nameof(CurrentPage));
  16. }
  17. }
  18.  
  19. private double _frameOpacity;
  20. public double FrameOpacity
  21. {
  22. get
  23. {
  24. return _frameOpacity;
  25. }
  26. set
  27. {
  28. _frameopacity = value;
  29. RaisePropertyChanged(nameof(FrameOpacity))
  30. }
  31. }
  32. public MainViewModel()
  33. {
  34. name1 = new name1();
  35. name2 = new name2();
  36.  
  37. FrameOpacity = 1;
  38. CurrentPage = name1;
  39. }
  40.  
  41. public ICommand Name1Btn_Click
  42. {
  43.  
  44. get
  45. {
  46. return new RelayCommand(() => SlowOpacity(name1));
  47. }
  48. }
  49.  
  50. public ICommand Name2Btn_Click
  51. {
  52. get
  53. {
  54. return new RelayCommand(() => SlowOpacity(name2));
  55. }
  56. }
  57.  
  58.  
  59. private async void SlowOpacity(Page page)
  60. {
  61. await Task.Factory.Startnew(() =>
  62. {
  63. CurrentPage = page; //Универсальный метод для всех наших страниц
  64.  
  65. for(double i = 0.0; i < 1.1; i += 0.1)
  66. {
  67. FrameOpacity = i;
  68. Thread.Sleep(15);
  69. }
  70. }
  71. }
Add Comment
Please, Sign In to add comment