public MainForm() { Program.log.Info("Initializing"); // Adds all file types to one list Types.All.AddRange(Types.Video); Types.All.AddRange(Types.Audio); Types.All.AddRange(Types.Books); Types.All.AddRange(Types.Subtitle); Types.All.AddRange(Types.Torrent); Types.All.AddRange(Types.Software); Types.All.AddRange(Types.Other); // Set selected files type to All SelectedFilesType = Types.All; // Initialize InitializeComponent(); // Set this instance Form = this; // Show Splash Screen Controls.Add(FrmSplashScreen); FrmSplashScreen.Dock = DockStyle.Fill; FrmSplashScreen.BringToFront(); FrmSplashScreen.Show(); // Set this version on Change Log label in the About tab labelChangeLog.Text = String.Format(labelChangeLog.Text, Application.ProductVersion); // Set static combo dropdown width to max items size comboBoxSearchHome.DropDownWidth = ControlExtensions.GetMaxDropDownWidth(comboBoxSearchHome); comboBoxSortFiles.DropDownWidth = ControlExtensions.GetMaxDropDownWidth(comboBoxSortFiles); Program.log.Info("Initialized"); }
} = new ShortcutsWindow(); // Keyboard Shortcuts Window (one instance) public MainForm() { Program.log.Info("Initializing"); // Add all the supported file types to one list (There must be a cleaner way, but oh well) Types.All.AddRange(Types.Video); Types.All.AddRange(Types.Audio); Types.All.AddRange(Types.Books); Types.All.AddRange(Types.Subtitle); Types.All.AddRange(Types.Torrent); Types.All.AddRange(Types.Software); Types.All.AddRange(Types.Other); SelectedFilesType = Types.All; // Set selected files type to All InitializeComponent(); // Initialize Form = this; // Set this instance labelChangeLog.Text = String.Format(labelChangeLog.Text, Application.ProductVersion); // Set this version on Change Log label in the About tab // Show Splash Screen Controls.Add(FrmSplashScreen); FrmSplashScreen.Dock = DockStyle.Fill; FrmSplashScreen.Location = new Point(0, 0); FrmSplashScreen.ClientSize = ClientSize; FrmSplashScreen.BringToFront(); FrmSplashScreen.Show(); comboBoxSearchHome.DropDownWidth = ControlExtensions.DropDownWidth(comboBoxSearchHome); // Set home search button combobox to fit its contents comboBoxSortFiles.DropDownWidth = ControlExtensions.DropDownWidth(comboBoxSortFiles); // Set files sort combobox to fit its contents Program.log.Info("Initialized"); }
public MainForm() { Program.log.Info("Initializing"); // Adds all file types to one list Types.All.AddRange(Types.Image); Types.All.AddRange(Types.Video); Types.All.AddRange(Types.Audio); Types.All.AddRange(Types.Book); Types.All.AddRange(Types.Subtitle); Types.All.AddRange(Types.Torrent); Types.All.AddRange(Types.Software); Types.All.AddRange(Types.Other); // Initialize InitializeComponent(); // Set this instance Form = this; // Show Splash Screen Controls.Add(FrmSplashScreen); FrmSplashScreen.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom; FrmSplashScreen.Location = new Point(0, 0); FrmSplashScreen.Size = Form.ClientSize; FrmSplashScreen.BringToFront(); FrmSplashScreen.Show(); comboBoxType.SelectedIndex = 0; comboBoxSort.SelectedIndex = 0; comboBoxHost.SelectedIndex = 0; // Set this version on Change Log in Menu Strip menuHelpChangeLog.Text = String.Format(menuHelpChangeLog.Text, Application.ProductVersion); Program.log.Info("Initialized"); }
private static void StartApplication() { CatchAllUnhandledExceptions(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); FrmSplashScreen frmSplashScreen = FrmSplashScreen.getInstance(); frmSplashScreen.Show(); Application.Run(FrmMain.Default); }
private static void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs e) { if (!FrmSplashScreen.getInstance().IsDisposed) { FrmSplashScreen.getInstance().Close(); } var window = new UnhandledExceptionWindow(e.ExceptionObject as Exception, e.IsTerminating); window.ShowDialog(FrmMain.Default); }
private static void ApplicationOnThreadException(object sender, ThreadExceptionEventArgs e) { if (!FrmSplashScreen.getInstance().IsDisposed) { FrmSplashScreen.getInstance().Close(); } var window = new UnhandledExceptionWindow(e.Exception, false); window.ShowDialog(FrmMain.Default); }
internal static void Show(Entities.JobProgress progress = null) { if (frmSplash == null) { frmSplash = new FrmSplashScreen(); } frmSplash.Progress = progress; frmSplash.Show(); System.Windows.Forms.Application.DoEvents(); }
/// <summary> /// 显示窗口 /// </summary> private static void ShowForm() { if (loadingForm != null) { loadingForm.CloseOrder(); loadingForm = null; } loadingForm = new FrmSplashScreen(); loadingForm.StartPosition = FormStartPosition.CenterScreen; loadingForm.TopMost = true; loadingForm.ShowDialog(); }
public static Optional <SecureString> PasswordDialog(string passwordName = null, bool verify = true) { var splash = FrmSplashScreen.getInstance(); if (!splash.IsDisposed && splash.Visible) { splash.Close(); } var passwordForm = new PasswordForm(passwordName, verify); return(passwordForm.GetKey()); }
private static void CheckFipsPolicy(MessageCollector messageCollector) { if (Settings.Default.OverrideFIPSCheck) { messageCollector.AddMessage(MessageClass.InformationMsg, "OverrideFIPSCheck is set. Will skip check...", true); return; } messageCollector.AddMessage(MessageClass.InformationMsg, "Checking FIPS Policy...", true); if (!FipsPolicyEnabledForServer2003() && !FipsPolicyEnabledForServer2008AndNewer()) { return; } var errorText = string.Format(Language.strErrorFipsPolicyIncompatible, GeneralAppInfo.ProductName); messageCollector.AddMessage(MessageClass.ErrorMsg, errorText, true); //About to pop up a message, let's not block it... FrmSplashScreen.getInstance().Close(); var ShouldIStayOrShouldIGo = CTaskDialog.MessageBox(Application.ProductName, Language.strCompatibilityProblemDetected, errorText, "", "", Language.strCheckboxDoNotShowThisMessageAgain, ETaskDialogButtons.OkCancel, ESysIcons.Warning, ESysIcons.Warning); if (CTaskDialog.VerificationChecked && ShouldIStayOrShouldIGo == DialogResult.OK) { messageCollector.AddMessage(MessageClass.ErrorMsg, "User requests that FIPS check be overridden", true); Settings.Default.OverrideFIPSCheck = true; Settings.Default.Save(); return; } if (ShouldIStayOrShouldIGo == DialogResult.Cancel) { Environment.Exit(1); } }
public LoginForm(FrmSplashScreen frmSplashScreen) : this() { _frmSplashScreen = frmSplashScreen; }
/// <summary> /// /// </summary> /// <param name="withDialog"> /// Should we show the file selection dialog to allow the user to select /// a connection file /// </param> public static void LoadConnections(bool withDialog = false) { var connectionFileName = ""; try { // disable sql update checking while we are loading updates ConnectionsService.RemoteConnectionsSyncronizer?.Disable(); if (withDialog) { var loadDialog = DialogFactory.BuildLoadConnectionsDialog(); if (loadDialog.ShowDialog() != DialogResult.OK) { return; } connectionFileName = loadDialog.FileName; Settings.Default.UseSQLServer = false; Settings.Default.Save(); } else if (!Settings.Default.UseSQLServer) { connectionFileName = ConnectionsService.GetStartupConnectionFileName(); } ConnectionsService.LoadConnections(Settings.Default.UseSQLServer, false, connectionFileName); if (Settings.Default.UseSQLServer) { ConnectionsService.LastSqlUpdate = DateTime.Now; } // re-enable sql update checking after updates are loaded ConnectionsService.RemoteConnectionsSyncronizer?.Enable(); } catch (Exception ex) { FrmSplashScreen.getInstance().Close(); if (Settings.Default.UseSQLServer) { MessageCollector.AddExceptionMessage(Language.strLoadFromSqlFailed, ex); var commandButtons = string.Join("|", Language.strCommandTryAgain, Language.strCommandOpenConnectionFile, string.Format(Language.strCommandExitProgram, Application.ProductName)); CTaskDialog.ShowCommandBox(Application.ProductName, Language.strLoadFromSqlFailed, Language.strLoadFromSqlFailedContent, MiscTools.GetExceptionMessageRecursive(ex), "", "", commandButtons, false, ESysIcons.Error, ESysIcons.Error); switch (CTaskDialog.CommandButtonResult) { case 0: LoadConnections(withDialog); return; case 1: Settings.Default.UseSQLServer = false; LoadConnections(true); return; default: Application.Exit(); return; } } if (ex is FileNotFoundException && !withDialog) { MessageCollector.AddExceptionMessage( string.Format(Language.strConnectionsFileCouldNotBeLoadedNew, connectionFileName), ex, MessageClass.InformationMsg); string[] commandButtons = { Language.ConfigurationCreateNew, Language.ConfigurationCustomPath, Language.ConfigurationImportFile, Language.strMenuExit }; var answered = false; while (!answered) { try { CTaskDialog.ShowTaskDialogBox( GeneralAppInfo.ProductName, Language.ConnectionFileNotFound, "", "", "", "", "", string.Join(" | ", commandButtons), ETaskDialogButtons.None, ESysIcons.Question, ESysIcons.Question); switch (CTaskDialog.CommandButtonResult) { case 0: ConnectionsService.NewConnectionsFile(connectionFileName); answered = true; break; case 1: LoadConnections(true); answered = true; break; case 2: ConnectionsService.NewConnectionsFile(connectionFileName); Import.ImportFromFile(ConnectionsService.ConnectionTreeModel.RootNodes[0]); answered = true; break; case 3: Application.Exit(); answered = true; break; } } catch (Exception exc) { MessageCollector.AddExceptionMessage( string .Format(Language.strConnectionsFileCouldNotBeLoadedNew, connectionFileName), exc, MessageClass.InformationMsg); } } return; } MessageCollector.AddExceptionStackTrace( string.Format(Language.strConnectionsFileCouldNotBeLoaded, connectionFileName), ex); if (connectionFileName != ConnectionsService.GetStartupConnectionFileName()) { LoadConnections(withDialog); } else { MessageBox.Show(FrmMain.Default, string.Format(Language.strErrorStartupConnectionFileLoad, Environment.NewLine, Application.ProductName, ConnectionsService.GetStartupConnectionFileName(), MiscTools.GetExceptionMessageRecursive(ex)), @"Could not load startup file.", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } } }
/// <summary> /// 关闭窗口,委托中使用 /// </summary> private static void CloseFormInternal() { loadingForm.CloseOrder(); loadingForm = null; }