public MainWindow() { ControlsHelper.InitInvokeContext(); // Make sure setting changes updates UI on the same thread as UI. var scheduler = ControlsHelper.MainTaskScheduler; SettingsManager.SetSynchronizingObject(scheduler); // Disable some functionality in Visual Studio Interface design mode. if (!ControlsHelper.IsDesignMode(this)) { PreviewKeyDown += MainWindow_PreviewKeyDown; Closing += MainWindow_Closing; } InitHelper.InitTimer(this, InitializeComponent); if (ControlsHelper.IsDesignMode(this)) { return; } StartHelper.Initialize(); InitiInterfaceUpdate(); // Check if app version changed. var o = SettingsManager.Options; var appVersion = new JocysCom.ClassLibrary.Configuration.AssemblyInfo().Version.ToString(); AppVersionChanged = o.AppVersion != appVersion; o.AppVersion = appVersion; }
public MainControl() { InitHelper.InitTimer(this, InitializeComponent); if (ControlsHelper.IsDesignMode(this)) { return; } _bwm = new BaseWithHeaderManager(HelpHeadLabel, HelpBodyLabel, LeftIcon, this); // Hide status values. StatusTimerLabel.Content = ""; StatusDllLabel.Content = ""; // Set status labels. StatusIsAdminLabel.Content = JocysCom.ClassLibrary.Win32.WinAPI.IsVista ? string.Format("Elevated: {0}", JocysCom.ClassLibrary.Win32.WinAPI.IsElevated()) : ""; // Initialize Debug panel. DebugPanel = new Forms.DebugWindow(); ControlsHelper.BeginInvoke(() => { if (SettingsManager.Options.ShowDebugPanel) { DebugPanel.ShowPanel(); } }); InitGameToCustomizeComboBox(); var o = SettingsManager.Options; o.PropertyChanged += Options_PropertyChanged; LoadSettings(); }
private static void _Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { InitHelper ih = null; lock (TimersLock) ih = Timers.FirstOrDefault(x => Equals(x._Timer, sender)); if (ih == null) { return; } _InitEndCount++; ih.WriteLine("INIT END "); ih.Dispose(); }
private static void Control_IsVisibleChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e) { InitHelper ih = null; lock (TimersLock) ih = Timers.FirstOrDefault(x => Equals(x.Control, sender)); if (ih == null) { return; } ih._PropertyChangedCount++; ih.EndDate = DateTime.Now; ih._Timer.Stop(); ih._Timer.Start(); }
public static void InitTimer(FrameworkElement control, Action InitializeComponent) { var ih = new InitHelper(); ih.Control = control; ih.StartDate = DateTime.Now; ih.WriteLine("INIT START"); ih.EndDate = DateTime.Now; InitializeComponent.Invoke(); ih.EndDate = DateTime.Now; ih.WriteLine("INIT CON "); lock (TimersLock) Timers.Add(ih); ih.Control.IsVisibleChanged += Control_IsVisibleChanged; ih._Timer.Start(); }
public MainBodyControl() { InitHelper.InitTimer(this, InitializeComponent); if (ControlsHelper.IsDesignMode(this)) { return; } PadIcons = new ContentControl[] { Pad1TabIcon, Pad2TabIcon, Pad3TabIcon, Pad4TabIcon, }; PadColors = new Color[4]; PadControls = new PadControl[] { Pad1Panel, Pad2Panel, Pad3Panel, Pad4Panel, }; Global.UpdateControlFromStates += Global_UpdateControlFromStates; }