static void Main() { try { //Properties.Settings.Default["FormSettings_OpenOnce"] = false; Properties.Settings.Default["SessionID"] = Program.GetTimestamp(DateTime.Now); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); SplashScreen mSplashSchreen = new SplashScreen(); mSplashSchreen.ShowSplashScreen(); Application.DoEvents(); Application.CurrentCulture = CultureInfo.InvariantCulture; // Things to do at startup: mSplashSchreen.SetStatus(Properties.Resources.Splash, ""); /*StartProcess("\"" + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar + Properties.Settings.Default.MatlabPath + Path.DirectorySeparatorChar + Properties.Settings.Default.MatlabOpen + "\"", + "\"" + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar + Properties.Settings.Default.MatlabPath + "\" " + + Properties.Settings.Default.MatlabInvisible);*/ //mSplashSchreen.SetStatus(Properties.Resources.Splash_GPU, ""); //mSplashSchreen.SetStatus(Properties.Resources.Splash_Recon, ""); //System.Threading.Thread.Sleep(1900); mSplashSchreen.SetStatus(Properties.Resources.Splash, ""); if (Program.CheckVCRedistributable(@"SOFTWARE\Classes\Installer\Products\67D6ECF5CD5FBA732B8B22BAC8DE1B4D") == false) { // Show a message: SplashScreen.CloseForm(); DialogResult zResult = MessageBox.Show("Microsoft Visual C++ 2008 (x64) not found. Continue anyway?", Properties.Settings.Default.ProgramName, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (zResult == DialogResult.No) { // Run VC++ 2010 Redistributable x64: /*Program.StartProcess("\"" + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar + * Properties.Settings.Default.DependenciesPath + Path.DirectorySeparatorChar + Properties.Settings.Default.VC2008Redistributable_x64 + "\"", "");*/ Application.Exit(); return; } } if (Program.CheckVCRedistributable(@"SOFTWARE\Classes\Installer\Products\1926E8D15D0BCE53481466615F760A7F") == false) { // Show a message: SplashScreen.CloseForm(); DialogResult zResult = MessageBox.Show("Microsoft Visual C++ 2010 (x64) not found. Continue anyway?", Properties.Settings.Default.ProgramName, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (zResult == DialogResult.No) { // Run VC++ 2010 Redistributable x64: /*Program.StartProcess("\"" + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar + * Properties.Settings.Default.DependenciesPath + Path.DirectorySeparatorChar + Properties.Settings.Default.VC2010Redistributable_x64 + "\"", "");*/ Application.Exit(); return; } } if ((Program.CheckVCRedistributable(@"SOFTWARE\Classes\Installer\Dependencies\{d992c12e-cab2-426f-bde3-fb8c53950b0d}") == false) & (Program.CheckVCRedistributable(@"SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64") == false)) { // Show a message: SplashScreen.CloseForm(); DialogResult zResult = MessageBox.Show("Microsoft Visual C++ 2015 (x64) not found. Continue anyway?", Properties.Settings.Default.ProgramName, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (zResult == DialogResult.No) { // Run VC++ 2010 Redistributable x64: /*Program.StartProcess("\"" + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar + * Properties.Settings.Default.DependenciesPath + Path.DirectorySeparatorChar + Properties.Settings.Default.VC2015Redistributable_x64 + "\"", "");*/ Application.Exit(); return; } } if (Properties.Settings.Default.SYRMEP_Version) { try { string text = SYRMEP_HPC.Execute("echo 'hello'"); } catch (Exception ex) { // Show a message: SplashScreen.CloseForm(); DialogResult zResult = MessageBox.Show("Error while connecting to SYRMEP HPC: " + ex.Message + "\n\nContinue anyway?", Properties.Settings.Default.ProgramName, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (zResult == DialogResult.No) { Application.Exit(); return; } // Get reference to the dialog type. /*var dialogTypeName = "System.Windows.Forms.PropertyGridInternal.GridErrorDlg"; * var dialogType = typeof(Form).Assembly.GetType(dialogTypeName); * * // Create dialog instance. * var dialog = (Form)Activator.CreateInstance(dialogType, new PropertyGrid()); * * // Populate relevant properties on the dialog instance. * dialog.Text = Properties.Settings.Default.ProgramName; * dialogType.GetProperty("Details").SetValue(dialog, ex.Message, null); * dialogType.GetProperty("Message").SetValue(dialog, "Error while connecting to SYRMEP HPC. Continue anyway?", null); * * // Display dialog. * var zResult = dialog.ShowDialog(); * if (zResult == DialogResult.Cancel) * { * Application.Exit(); * return; * }*/ } } // Open the main form: Application.Run(new MainForm()); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
static void Main() { try { //Properties.Settings.Default["FormSettings_OpenOnce"] = false; Properties.Settings.Default["SessionID"] = Program.GetTimestamp(DateTime.Now); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); SplashScreen mSplashSchreen = new SplashScreen(); mSplashSchreen.ShowSplashScreen(); Application.DoEvents(); Application.CurrentCulture = CultureInfo.InvariantCulture; // Things to do at startup: mSplashSchreen.SetStatus(Properties.Resources.Splash, ""); /*StartProcess("\"" + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar + Properties.Settings.Default.MatlabPath + Path.DirectorySeparatorChar + Properties.Settings.Default.MatlabOpen + "\"", + "\"" + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar + Properties.Settings.Default.MatlabPath + "\" " + + Properties.Settings.Default.MatlabInvisible);*/ //mSplashSchreen.SetStatus(Properties.Resources.Splash_GPU, ""); //mSplashSchreen.SetStatus(Properties.Resources.Splash_Recon, ""); //System.Threading.Thread.Sleep(1900); mSplashSchreen.SetStatus(Properties.Resources.Splash, ""); if (Program.CheckVCRedistributable(@"SOFTWARE\Classes\Installer\Products\67D6ECF5CD5FBA732B8B22BAC8DE1B4D") == false) { // Show a message: SplashScreen.CloseForm(); DialogResult zResult = MessageBox.Show("Microsoft Visual C++ 2008 (x64) not found. Continue anyway?", Properties.Settings.Default.ProgramName, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (zResult == DialogResult.No) { // Run VC++ 2010 Redistributable x64: /*Program.StartProcess("\"" + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar + * Properties.Settings.Default.DependenciesPath + Path.DirectorySeparatorChar + Properties.Settings.Default.VC2008Redistributable_x64 + "\"", "");*/ Application.Exit(); return; } } if (Program.CheckVCRedistributable(@"SOFTWARE\Classes\Installer\Products\1926E8D15D0BCE53481466615F760A7F") == false) { // Show a message: SplashScreen.CloseForm(); DialogResult zResult = MessageBox.Show("Microsoft Visual C++ 2010 (x64) not found. Continue anyway?", Properties.Settings.Default.ProgramName, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (zResult == DialogResult.No) { // Run VC++ 2010 Redistributable x64: /*Program.StartProcess("\"" + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar + * Properties.Settings.Default.DependenciesPath + Path.DirectorySeparatorChar + Properties.Settings.Default.VC2010Redistributable_x64 + "\"", "");*/ Application.Exit(); return; } } if (Program.CheckVCRedistributable(@"SOFTWARE\Classes\Installer\Dependencies\{d992c12e-cab2-426f-bde3-fb8c53950b0d}") == false) { // Show a message: SplashScreen.CloseForm(); DialogResult zResult = MessageBox.Show("Microsoft Visual C++ 2015 (x64) not found. Continue anyway?", Properties.Settings.Default.ProgramName, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (zResult == DialogResult.No) { // Run VC++ 2010 Redistributable x64: /*Program.StartProcess("\"" + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar + * Properties.Settings.Default.DependenciesPath + Path.DirectorySeparatorChar + Properties.Settings.Default.VC2015Redistributable_x64 + "\"", "");*/ Application.Exit(); return; } } // Open the main form: Application.Run(new MainForm()); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
// A private entry point for the thread. static private void ShowForm() { ms_frmSplash = new SplashScreen(); Application.Run(ms_frmSplash); }