Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <summary>
- /// Initializes a new instance of the <see cref="ApplicationController"/> class.
- /// </summary>
- public ApplicationController()
- {
- CreateDefaultTabs();
- Timer timer = new Timer(20000); //20 secs for testing purpose.
- timer.AutoReset = true;
- timer.Enabled = true;
- timer.Elapsed += new ElapsedEventHandler(OnTimeBeforeRefreshElapsed);
- timer.Start();
- }
- private void OnTimeBeforeRefreshElapsed(object sender, ElapsedEventArgs e)
- {
- Dispatcher.CurrentDispatcher.Invoke(new Action(() => { RefreshData(); }));
- Dispatcher.CurrentDispatcher.Invoke(new Action(() => { UpdateLayout(); }));
- }
- private void RefreshData()
- {
- foreach (object tab in _tabItems)
- {
- if (tab is TitleDetailsView)
- {
- TitleDetailsViewModel vm = ((TitleDetailsView)tab).DataContext as TitleDetailsViewModel;
- vm.Refresh();
- }
- }
- }
- private void UpdateLayout()
- {
- foreach (object tab in _tabItems)
- {
- if (tab is TitleDetailsView)
- {
- TitleDetailsViewModel vm = ((TitleDetailsView)tab).DataContext as TitleDetailsViewModel;
- vm.HandleGetTitleBySymbolResponse();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement