public override void DashboardTimerElapsed(object sender, ElapsedEventArgs e) { Debug.Print("Refresh timer is working. Interval: " + this.DashboardTimer.Interval / 1000 + "s."); if (IsTimerEnabled) { TabFormControl.BeginInvoke(new Action(() => { if (TabFormControl.SelectedPage != null) { foreach (Control c in TabFormControl.SelectedPage.ContentContainer.Controls) { if (c is DevExpress.DashboardWin.DashboardViewer) { _viewer = (c as DevExpress.DashboardWin.DashboardViewer); } } _viewer.ReloadData(true); Debug.Print(" Dashboard refreshed: " + _viewer.DashboardSource); } else { TimerStop(); } })); } }
public RefreshTimer(TabFormControl tabForm) { TabFormControl = tabForm; AppSettingsSectionName = "GeneralAppSettings"; IsTimerEnabledKey = "AutoRefresh"; TimerIntervalKey = "RefreshTime"; }
public RotateTimer(TabFormControl tabFormControl) { TabFormControl = tabFormControl; AppSettingsSectionName = "GeneralAppSettings"; IsTimerEnabledKey = "AutoRotate"; TimerIntervalKey = "RotateTime"; }
public override void DashboardTimerElapsed(object sender, ElapsedEventArgs e) { Debug.Print("Rotate timer is working. Interval: " + this.DashboardTimer.Interval / 1000 + "s"); if (IsTimerEnabled) { var index = 0; var pageIndex = TabFormControl.Pages.IndexOf(TabFormControl.SelectedPage); var maxIndex = TabFormControl.Pages.Count - 1; if (maxIndex > 0) { if (pageIndex == maxIndex) { index = 0; } else { index += 1; } } else { index = 0; } TabFormControl.BeginInvoke(new Action(() => { if (TabFormControl.Pages.Count > 0) { TabFormControl.SelectedPage = TabFormControl.Pages[index]; } else { TimerStop(); } })); } }
public MainForm() { InitializeComponent(); var iconPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources/main.ico"); IconOptions.Icon = new Icon(iconPath); TabFormControl.PageCreated += (s, e) => { InitPage(e.Page); }; TabFormControl.SelectedPageChanged += (s, e) => { OnSelectPage(e.Page); }; InitPage(TabFormControl.Pages[0]); OnSelectPage(TabFormControl.Pages[0]); var state = AppSavedState.Load(); if (state.OpenPages?.Any() == true) { var defaultPage = TabFormControl.Pages[0]; foreach (var item in state.OpenPages) { TabFormControl.AddNewPage(); var page = TabFormControl.Pages.Last(); page.Text = item.Title; var browser = GetBrowserControl(page); browser.XWV.WaitInitialization().ContinueWith(async(t) => { await browser.XWV.WaitWhileNavigating(); await browser.XWV.LoadUrl(item.Url); }); } TabFormControl.ClosePage(defaultPage); } }