protected void Initialize() { // Updates if (GuiOptions.Instanse.UpdateCheckAtStartup) { WindowsHelper.Update(); } // Invoking manager Core.Core.Instanse.Manager.Invoke(); }
private void WindowClosing(object sender, CancelEventArgs e) { if (this.Exit) { if (WinHelper.MessageBox("Do you really want close program?", "Exit...", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No) { e.Cancel = true; return; } if (!this.Visible) { this.Visible = true; } // Log if (RunTime.Instance.LogWindow != null) { RunTime.Instance.LogWindow.Close(); WPFApplication.DoEvents(); } this.updateTimer.Stop(); // Events GuiOptions.Instanse.ManagerPinChanged -= this.ManagerPinChanged; GuiOptions.Instanse.ManagerLocationChanged -= this.ManagerLocationChanged; this.trayIcon.DoubleClick -= this.IconDoubleClick; this.mainMenu.DeInitializeEvents(); this.trayIcon.DeInitializeEvents(); // Notify Icon this.trayIcon.Visible = false; this.trayIcon.Dispose(); // Exit WindowsHelper.Exit(); } else { e.Cancel = true; this.Visible = false; } }
private void ApplicationStartup(object sender, StartupEventArgs e) { System.Windows.Forms.Application.EnableVisualStyles(); System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); if (!Helper.Initialize(e.Args)) { Environment.Exit(0); return; } // Events Application.Current.DispatcherUnhandledException += AppDispatcherUnhandledException; AppDomain.CurrentDomain.UnhandledException += AppDomainUnhandledException; System.Windows.Forms.Application.ThreadException += ApplicationThreadException; try { Application.Current.Run(new StartUp()); } catch (Exception) { } }
private void StartUpLoaded(object sender, RoutedEventArgs e) { this.InitializeImages(); this.InitializeOptions(); // UI Language switch (Core.Core.Instanse.Options.Language) { case LanguageType.English: { RunTime.Instance.Localization = new ResourceManager("Umax.Resources.Localization.UI.Classic.English", typeof(Umax.Resources.Localization.UI.Classic.English).Assembly); break; } case LanguageType.Russian: { RunTime.Instance.Localization = new ResourceManager("Umax.Resources.Localization.UI.Classic.Russian", typeof(Umax.Resources.Localization.UI.Classic.Russian).Assembly); break; } } this.InitializeUI(); // Checking .Net FX if (!WindowsHelper.FXCheck()) { if (WinHelper.MessageBox("Microsoft .Net Framework 3.5 isn't installed. Please install it!\r\nDo you like to ignore and continue?", "Error!", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == System.Windows.Forms.DialogResult.No) { WPFApplication.Current.Shutdown(); } } // Update check if (WindowsHelper.UpdateFilesAvailable()) { WindowsHelper.StartMonitor("-update -quiet"); Close(); } // Initializing Core this.InitializeCore(); // Monitor if (GuiOptions.Instanse.Monitor) { WindowsHelper.StartMonitor("-quiet"); } // Checking accepting EULA if (!WindowsHelper.EulaCheck()) { using (EULA eulaWindow = new EULA()) { eulaWindow.ShowDialog(); if (!eulaWindow.Accepted) { this.Close(); } } } this.ShowMainWindow(); }