Advertisement
Guest User

Untitled

a guest
Jul 6th, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. /// <summary>
  2. /// Initializes a new instance of the <see cref="ApplicationController"/> class.
  3. /// </summary>
  4. public ApplicationController()
  5. {
  6. CreateDefaultTabs();
  7.  
  8. Timer timer = new Timer(20000); //20 secs for testing purpose.
  9. timer.AutoReset = true;
  10. timer.Enabled = true;
  11. timer.Elapsed += new ElapsedEventHandler(OnTimeBeforeRefreshElapsed);
  12. timer.Start();
  13. }
  14.  
  15. private void OnTimeBeforeRefreshElapsed(object sender, ElapsedEventArgs e)
  16. {
  17. Dispatcher.CurrentDispatcher.Invoke(new Action(() => { RefreshData(); }));
  18. Dispatcher.CurrentDispatcher.Invoke(new Action(() => { UpdateLayout(); }));
  19. }
  20.  
  21. private void RefreshData()
  22. {
  23. foreach (object tab in _tabItems)
  24. {
  25. if (tab is TitleDetailsView)
  26. {
  27. TitleDetailsViewModel vm = ((TitleDetailsView)tab).DataContext as TitleDetailsViewModel;
  28. vm.Refresh();
  29. }
  30. }
  31. }
  32.  
  33. private void UpdateLayout()
  34. {
  35. foreach (object tab in _tabItems)
  36. {
  37. if (tab is TitleDetailsView)
  38. {
  39. TitleDetailsViewModel vm = ((TitleDetailsView)tab).DataContext as TitleDetailsViewModel;
  40. vm.HandleGetTitleBySymbolResponse();
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement