Guest User

Untitled

a guest
Jan 17th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. public static class IntAggregator
  2. {
  3. public static void Transmit(int data)
  4. {
  5. if (OnDataTransmitted != null)
  6. {
  7. OnDataTransmitted(data);
  8. }
  9. }
  10.  
  11. public static Action<int> OnDataTransmitted;
  12. }
  13.  
  14. public class ModifyUsersViewModel : INotifyPropertyChanged
  15. {
  16. private void Send_Data()
  17. {
  18. IntAggregator.Transmit(2);
  19. }
  20. }
  21.  
  22. public class MainWindowViewModel : INotifyPropertyChanged
  23. {
  24. private int _Tab_SelectedIndex = 0;
  25. public int Tab_SelectedIndex
  26. {
  27. get
  28. {
  29. return _Tab_SelectedIndex;
  30. }
  31. set
  32. {
  33. _Tab_SelectedIndex = value;
  34. OnPropertyChanged(new PropertyChangedEventArgs("Tab_SelectedIndex"));
  35. }
  36. }
  37.  
  38. public MainWindowViewModel()
  39. {
  40. IntAggregator.OnDataTransmitted += OnDataReceived;
  41. }
  42.  
  43. private void OnDataReceived(int data)
  44. {
  45. Tab_SelectedIndex = 2;
  46. }
  47. }
Add Comment
Please, Sign In to add comment