コード例 #1
0
    public MainApplicationContext()
    {
        Logs = new BindingList <string>();

        _formCount = 0;
        // splash screen
        var splash = new FormSplash();

        splash.Closed  += OnFormClosed;
        splash.Load    += OnFormOpening;
        splash.Closing += OnFormClosing;
        _formCount++;
        splash.Show();
        // For demo, make some logic that close splash when program loaded.
        Thread.Sleep(2000);

        var main = new FormMain();

        main.Closed  += OnFormClosed;
        main.Load    += OnFormOpening;
        main.Closing += OnFormClosing;
        _formCount++;

        splash.Close();
        main.Show();
    }
コード例 #2
0
 static void Main(string[] args)
 {
     // splash screen, which is terminated in FormMain
     FormSplash.ShowSplash();
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     // this is probably where your heavy lifting is:
     Application.Run(new FormMain());
 }
コード例 #3
0
    // called by the thread
    private static void DoShowSplash()
    {
        if (_splashForm == null)
        {
            _splashForm = new FormSplash();
        }

        // create a new message pump on this thread (started from ShowSplash)
        Application.Run(_splashForm);
    }
コード例 #4
0
    void ShowSplashScreen()
    {
        var t = new Thread(() =>
        {
            using (dlg = new FormSplash()) dlg.ShowDialog();
        }
                           );

        t.SetApartmentState(ApartmentState.STA);
        t.IsBackground = true;
        t.Start();
    }
コード例 #5
0
        public static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            formOrder       = new FormOrder();
            formSelect      = new FormSelect();
            formProductInfo = new FormProductInfo();
            formStart       = new FormStart();
            formAbout       = new FormAbout();
            formSplash      = new FormSplash();
            product         = new Product();
            Application.Run(formSplash);
        }
コード例 #6
0
        private void ShowSplash()
        {
            if (!SplashEnabled)
            {
                return;
            }
            var formSplash = new FormSplash();

            formSplash.laTitle.Text = _splashText;
            formSplash.Shown       += async(o, args) =>
            {
                await Task.Run(() => Thread.Sleep(_splashDelay * 1000));

                formSplash.Close();
            };
            formSplash.Show();
            GC.KeepAlive(formSplash);
        }
コード例 #7
0
 private void Ingresar(object sender, EventArgs args)
 {
     if (this.formBienvenida.tbxNombre.Text != "Ingrese su nombre" && this.formBienvenida.tbxNombre.Text != string.Empty)
     {
         Cache.NombreAnalista = this.formBienvenida.tbxNombre.Text;
         //formAviso = new FormAviso("Bienvenido, " + Cache.NombreAnalista + " al sistema de análisis de crédito SENA");
         //formAviso.ShowDialog();
         this.formBienvenida.Hide();
         formSplash = new FormSplash("Bienvenido: " + Cache.NombreAnalista);
         formSplash.lblMensaje.Left = (formSplash.Width - formSplash.lblMensaje.Width) / 2;
         formSplash.ShowDialog();
         formVentanaPrincipal = new FormVentanaPrincipal();
         formVentanaPrincipal.ShowDialog();
     }
     else
     {
         formError = new FormError("Ingrese su nombre si desea ingresar al simulador.");
         formError.ShowDialog();
     }
 }
コード例 #8
0
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (!EnvUtils.IsMonoRuntime())
            {
                try
                {
                    NBug.Settings.UIMode = NBug.Enums.UIMode.Full;

                    // Uncomment the following after testing to see that NBug is working as configured
                    NBug.Settings.ReleaseMode = true;
                    NBug.Settings.ExitApplicationImmediately = false;
                    NBug.Settings.WriteLogToDisk             = false;
                    NBug.Settings.MaxQueuedReports           = 10;
                    NBug.Settings.StopReportingAfter         = 90;
                    NBug.Settings.SleepBeforeSend            = 30;
                    NBug.Settings.StoragePath = NBug.Enums.StoragePath.WindowsTemp;

                    AppDomain.CurrentDomain.UnhandledException += NBug.Handler.UnhandledException;
                    Application.ThreadException += NBug.Handler.ThreadException;
                }
                catch (TypeInitializationException tie)
                {
                    // is this exception caused by the configuration?
                    if (tie.InnerException != null &&
                        tie.InnerException.GetType()
                        .IsSubclassOf(typeof(System.Configuration.ConfigurationException)))
                    {
                        HandleConfigurationException((System.Configuration.ConfigurationException)tie.InnerException);
                    }
                }
            }

            string[] args = Environment.GetCommandLineArgs();
            FormSplash.ShowSplash();
            //Store here SynchronizationContext.Current, because later sometimes it can be null
            //see http://stackoverflow.com/questions/11621372/synchronizationcontext-current-is-null-in-continuation-on-the-main-ui-thread
            GitUIExtensions.UISynchronizationContext     = SynchronizationContext.Current;
            AsyncLoader.DefaultContinuationTaskScheduler = TaskScheduler.FromCurrentSynchronizationContext();
            Application.DoEvents();

            AppSettings.LoadSettings();
            if (EnvUtils.RunningOnWindows())
            {
                WebBrowserEmulationMode.SetBrowserFeatureControl();

                //Quick HOME check:
                FormSplash.SetAction("Checking home path...");
                Application.DoEvents();

                FormFixHome.CheckHomePath();
            }
            //Register plugins
            FormSplash.SetAction("Loading plugins...");
            Application.DoEvents();

            if (string.IsNullOrEmpty(AppSettings.Translation))
            {
                using (var formChoose = new FormChooseTranslation())
                {
                    formChoose.ShowDialog();
                }
            }

            try
            {
                if (!(args.Length >= 2 && args[1].Equals("uninstall")) &&
                    (AppSettings.CheckSettings ||
                     string.IsNullOrEmpty(AppSettings.GitCommandValue) ||
                     !File.Exists(AppSettings.GitCommandValue)))
                {
                    FormSplash.SetAction("Checking settings...");
                    Application.DoEvents();

                    GitUICommands     uiCommands         = new GitUICommands(string.Empty);
                    var               commonLogic        = new CommonLogic(uiCommands.Module);
                    var               checkSettingsLogic = new CheckSettingsLogic(commonLogic);
                    ISettingsPageHost fakePageHost       = new SettingsPageHostMock(checkSettingsLogic);
                    using (var checklistSettingsPage = SettingsPageBase.Create <ChecklistSettingsPage>(fakePageHost))
                    {
                        if (!checklistSettingsPage.CheckSettings())
                        {
                            if (!checkSettingsLogic.AutoSolveAllSettings())
                            {
                                uiCommands.StartSettingsDialog();
                            }
                        }
                    }
                }
            }
            catch
            {
                // TODO: remove catch-all
            }

            FormSplash.HideSplash();

            if (EnvUtils.RunningOnWindows())
            {
                MouseWheelRedirector.Active = true;
            }

            GitUICommands uCommands = new GitUICommands(GetWorkingDir(args));

            if (args.Length <= 1)
            {
                uCommands.StartBrowseDialog();
            }
            else  // if we are here args.Length > 1
            {
                uCommands.RunCommand(args);
            }

            AppSettings.SaveSettings();
        }
コード例 #9
0
        /// <summary>
        /// アプリケーションのメイン エントリ ポイントです。
        /// </summary>
        /// <param name="parentModule">親モジュール</param>
        public static void Main(IntPtr parentModule)
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            System.Resources.ResourceManager rm =
                new System.Resources.ResourceManager("System", typeof(UriFormat).Assembly);
            string dummy = rm.GetString("Arg_EmptyOrNullString");

            ThreadPool.SetMaxThreads(250, 1000);

            MameIF.Initialize(parentModule);
            var threadStart = new ManualResetEvent(false);

            mainThread = new Thread(new ThreadStart(() =>
            {
                threadStart.Set();
                Settings.Default.Reload();

                if (string.IsNullOrWhiteSpace(Settings.Default.OutputDir))
                {
                    Settings.Default.OutputDir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                }

                f_CurrentSamplingRate = 48000;
                int.TryParse(Settings.Default.SampleRate, out f_CurrentSamplingRate);

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                using (var fs = new FormSplash())
                {
                    fs.Show();
                    if (!IsVSTiMode())
                    {
                        while (fs.Opacity != 1)
                        {
                            fs.Opacity += 0.1;
                            Thread.Sleep(50);
                            fs.Refresh();
                        }
                    }
                    else
                    {
                        formSplash  = fs;
                        fs.Opacity += 1;
                        fs.Refresh();
                    }

                    try
                    {
                        var fm    = new FormMain();
                        fm.Shown += (_, __) =>
                        {
                            if (!IsVSTiMode())
                            {
                                fm.BeginInvoke(new MethodInvoker(() => { fs.Close(); }));
                            }

                            if (!string.IsNullOrEmpty(Settings.Default.EnvironmentSettings))
                            {
                                try
                                {
                                    var dso = StringCompressionUtility.Decompress(Settings.Default.EnvironmentSettings);
                                    InstrumentManager.ClearAllInstruments();
                                    var settings = JsonConvert.DeserializeObject <EnvironmentSettings>(dso, JsonAutoSettings);
                                    InstrumentManager.RestoreSettings(settings);
                                }
                                catch (Exception ex)
                                {
                                    if (ex.GetType() == typeof(Exception))
                                    {
                                        throw;
                                    }
                                    else if (ex.GetType() == typeof(SystemException))
                                    {
                                        throw;
                                    }

                                    MessageBox.Show(ex.ToString());
                                }
                            }
                        };
                        Application.Run(fm);

                        var so = JsonConvert.SerializeObject(SaveEnvironmentSettings(), Formatting.Indented, JsonAutoSettings);
                        Settings.Default.EnvironmentSettings = StringCompressionUtility.Compress(so);
                        Settings.Default.Save();
                    }
                    catch (Exception ex)
                    {
                        if (ex.GetType() == typeof(Exception))
                        {
                            throw;
                        }
                        else if (ex.GetType() == typeof(SystemException))
                        {
                            throw;
                        }

                        MessageBox.Show(ex.ToString());
                    }

                    ShuttingDown?.Invoke(typeof(Program), EventArgs.Empty);
                }
            }))
            {
                Priority = ThreadPriority.BelowNormal
            };
            mainThread.SetApartmentState(ApartmentState.STA);
            mainThread.Start();
            threadStart.WaitOne();
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: vmeurisse/gitextensions
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (!EnvUtils.IsMonoRuntime())
            {
                NBug.Settings.UIMode = NBug.Enums.UIMode.Full;

                // Uncomment the following after testing to see that NBug is working as configured
                NBug.Settings.ReleaseMode = true;
                NBug.Settings.ExitApplicationImmediately = false;
                NBug.Settings.WriteLogToDisk             = true;
                NBug.Settings.MaxQueuedReports           = 10;
                NBug.Settings.StopReportingAfter         = 90;
                NBug.Settings.SleepBeforeSend            = 30;
                NBug.Settings.StoragePath = "WindowsTemp";

                AppDomain.CurrentDomain.UnhandledException += NBug.Handler.UnhandledException;
                Application.ThreadException += NBug.Handler.ThreadException;
            }

            string[] args = Environment.GetCommandLineArgs();
            FormSplash.ShowSplash();
            //Store here SynchronizationContext.Current, because later sometimes it can be null
            //see http://stackoverflow.com/questions/11621372/synchronizationcontext-current-is-null-in-continuation-on-the-main-ui-thread
            GitUIExtensions.UISynchronizationContext = SynchronizationContext.Current;
            Application.DoEvents();

            Settings.LoadSettings();
            if (EnvUtils.RunningOnWindows())
            {
                //Quick HOME check:
                FormSplash.SetAction("Checking home path...");
                Application.DoEvents();

                FormFixHome.CheckHomePath();
            }
            //Register plugins
            FormSplash.SetAction("Loading plugins...");
            Application.DoEvents();

            if (string.IsNullOrEmpty(Settings.Translation))
            {
                using (var formChoose = new FormChooseTranslation())
                {
                    formChoose.ShowDialog();
                }
            }

            try
            {
                if (Application.UserAppDataRegistry == null ||
                    Settings.GetBool("checksettings", true) ||
                    string.IsNullOrEmpty(Settings.GitCommand))
                {
                    FormSplash.SetAction("Checking settings...");
                    Application.DoEvents();

                    GitUICommands uiCommands         = new GitUICommands(string.Empty);
                    var           commonLogic        = new CommonLogic(uiCommands.Module);
                    var           checkSettingsLogic = new CheckSettingsLogic(commonLogic, uiCommands.Module);
                    using (var checklistSettingsPage = new ChecklistSettingsPage(commonLogic, checkSettingsLogic, uiCommands.Module, null))
                    {
                        if (!checklistSettingsPage.CheckSettings())
                        {
                            checkSettingsLogic.AutoSolveAllSettings();
                            uiCommands.StartSettingsDialog();
                        }
                    }
                }
            }
            catch
            {
                // TODO: remove catch-all
            }

            FormSplash.HideSplash();

            if (EnvUtils.RunningOnWindows())
            {
                MouseWheelRedirector.Active = true;
            }

            GitUICommands uCommands = new GitUICommands(GetWorkingDir(args));

            if (args.Length <= 1)
            {
                uCommands.StartBrowseDialog();
            }
            else  // if we are here args.Length > 1
            {
                uCommands.RunCommand(args);
            }

            Settings.SaveSettings();
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: paviad/gitextensions
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            string[] args = Environment.GetCommandLineArgs();
            FormSplash.ShowSplash();
            Application.DoEvents();

            Settings.LoadSettings();
            if (Settings.RunningOnWindows())
            {
                //Quick HOME check:
                FormSplash.SetAction("Checking home path...");
                Application.DoEvents();

                FormFixHome.CheckHomePath();
            }
            //Register plugins
            FormSplash.SetAction("Loading plugins...");
            Application.DoEvents();

            PluginLoader.LoadAsync();

            if (string.IsNullOrEmpty(Settings.Translation))
            {
                using (var formChoose = new FormChooseTranslation())
                {
                    formChoose.ShowDialog();
                }
            }

            try
            {
                if (Application.UserAppDataRegistry == null ||
                    Settings.GetValue <string>("checksettings", null) == null ||
                    !Settings.GetValue <string>("checksettings", null).ToString().Equals("false", StringComparison.OrdinalIgnoreCase) ||
                    string.IsNullOrEmpty(Settings.GitCommand))
                {
                    FormSplash.SetAction("Checking settings...");
                    Application.DoEvents();

                    using (var settings = new FormSettings())
                    {
                        if (!settings.CheckSettings())
                        {
                            FormSettings.AutoSolveAllSettings();
                            GitUICommands.Instance.StartSettingsDialog();
                        }
                    }
                }
            }
            catch
            {
                // TODO: remove catch-all
            }

            if (args.Length >= 3)
            {
                if (Directory.Exists(args[2]))
                {
                    Settings.WorkingDir = args[2];
                }

                if (string.IsNullOrEmpty(Settings.WorkingDir))
                {
                    if (args[2].Contains(Settings.PathSeparator.ToString()))
                    {
                        Settings.WorkingDir = args[2].Substring(0, args[2].LastIndexOf(Settings.PathSeparator));
                    }
                }

                //Do not add this working dir to the recent repositories. It is a nice feature, but it
                //also increases the startup time
                //if (Settings.Module.ValidWorkingDir())
                //    Repositories.RepositoryHistory.AddMostRecentRepository(Settings.WorkingDir);
            }

            if (args.Length <= 1 && string.IsNullOrEmpty(Settings.WorkingDir) && Settings.StartWithRecentWorkingDir)
            {
                if (GitModule.ValidWorkingDir(Settings.RecentWorkingDir))
                {
                    Settings.WorkingDir = Settings.RecentWorkingDir;
                }
            }

            if (string.IsNullOrEmpty(Settings.WorkingDir))
            {
                string findWorkingDir = GitModule.FindGitWorkingDir(Directory.GetCurrentDirectory());
                if (GitModule.ValidWorkingDir(findWorkingDir))
                {
                    Settings.WorkingDir = findWorkingDir;
                }
            }

            FormSplash.HideSplash();

            if (Settings.RunningOnWindows())
            {
                MouseWheelRedirector.Active = true;
            }

            if (args.Length <= 1)
            {
                GitUICommands.Instance.StartBrowseDialog();
            }
            else  // if we are here args.Length > 1
            {
                RunCommand(args);
            }

            Settings.SaveSettings();
        }
コード例 #12
0
 //-------------------------------------------------------------------------------
 private void buttonSplashForm_Click(object sender, EventArgs e)
 {
     FormSplash.Show(this, Resources.Logo);
 }
コード例 #13
0
ファイル: Program.cs プロジェクト: chafnan/gitextensions
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            string[] args = Environment.GetCommandLineArgs();
            FormSplash.Show("Load settings");
            Settings.LoadSettings();
            if (Settings.RunningOnWindows())
            {
                //Quick HOME check:
                FormSplash.SetAction("Check home path");
                FormFixHome.CheckHomePath();
            }
            //Register plugins
            FormSplash.SetAction("Load plugins");
            PluginLoader.LoadAsync();

            if (string.IsNullOrEmpty(Settings.Translation))
            {
                using (var formChoose = new FormChooseTranslation())
                {
                    formChoose.ShowDialog();
                }
            }

            try
            {
                if (Application.UserAppDataRegistry == null ||
                    Application.UserAppDataRegistry.GetValue("checksettings") == null ||
                    !Application.UserAppDataRegistry.GetValue("checksettings").ToString().Equals("false", StringComparison.OrdinalIgnoreCase) ||
                    string.IsNullOrEmpty(Settings.GitCommand))
                {
                    FormSplash.SetAction("Check settings");
                    using (var settings = new FormSettings())
                    {
                        if (!settings.CheckSettings())
                        {
                            FormSettings.AutoSolveAllSettings();
                            GitUICommands.Instance.StartSettingsDialog();
                        }
                    }
                }
            }
            catch
            {
                // TODO: remove catch-all
            }

            if (args.Length >= 3)
            {
                if (Directory.Exists(args[2]))
                {
                    Settings.WorkingDir = args[2];
                }

                if (string.IsNullOrEmpty(Settings.WorkingDir))
                {
                    if (args[2].Contains(Settings.PathSeparator.ToString()))
                    {
                        Settings.WorkingDir = args[2].Substring(0, args[2].LastIndexOf(Settings.PathSeparator));
                    }
                }

                if (Settings.ValidWorkingDir())
                {
                    Repositories.RepositoryHistory.AddMostRecentRepository(Settings.WorkingDir);
                }
            }

            if (string.IsNullOrEmpty(Settings.WorkingDir))
            {
                string findWorkingDir = GitCommandHelpers.FindGitWorkingDir(Directory.GetCurrentDirectory());
                if (Settings.ValidWorkingDir(findWorkingDir))
                {
                    Settings.WorkingDir = findWorkingDir;
                }
            }

            FormSplash.Hide();

            if (args.Length <= 1)
            {
                GitUICommands.Instance.StartBrowseDialog();
            }
            else  // if we are here args.Length > 1
            {
                RunCommand(args);
            }

            Settings.SaveSettings();
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: slackguru/gitextensions
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (Settings.RunningOnWindows())
            {
                NBug.Settings.UIMode = NBug.Enums.UIMode.Full;

                // Uncomment the following after testing to see that NBug is working as configured
                NBug.Settings.ReleaseMode = true;
                NBug.Settings.ExitApplicationImmediately = false;
                NBug.Settings.WriteLogToDisk             = true;
                NBug.Settings.MaxQueuedReports           = 10;

                AppDomain.CurrentDomain.UnhandledException += NBug.Handler.UnhandledException;
                Application.ThreadException += NBug.Handler.ThreadException;
            }

            string[] args = Environment.GetCommandLineArgs();
            FormSplash.ShowSplash();
            Application.DoEvents();

            Settings.LoadSettings();
            if (Settings.RunningOnWindows())
            {
                //Quick HOME check:
                FormSplash.SetAction("Checking home path...");
                Application.DoEvents();

                FormFixHome.CheckHomePath();
            }
            //Register plugins
            FormSplash.SetAction("Loading plugins...");
            Application.DoEvents();

            if (string.IsNullOrEmpty(Settings.Translation))
            {
                using (var formChoose = new FormChooseTranslation())
                {
                    formChoose.ShowDialog();
                }
            }

            try
            {
                if (Application.UserAppDataRegistry == null ||
                    Settings.GetValue <string>("checksettings", null) == null ||
                    !Settings.GetValue <string>("checksettings", null).Equals("false", StringComparison.OrdinalIgnoreCase) ||
                    string.IsNullOrEmpty(Settings.GitCommand))
                {
                    FormSplash.SetAction("Checking settings...");
                    Application.DoEvents();

                    GitUICommands uiCommands = new GitUICommands(string.Empty);
                    using (var settings = new FormSettings(uiCommands))
                    {
                        if (!settings.CheckSettings())
                        {
                            settings.AutoSolveAllSettings();
                            uiCommands.StartSettingsDialog();
                        }
                    }
                }
            }
            catch
            {
                // TODO: remove catch-all
            }


            FormSplash.HideSplash();

            if (Settings.RunningOnWindows())
            {
                MouseWheelRedirector.Active = true;
            }

            GitUICommands uCommands = new GitUICommands(GetWorkingDir(args));

            if (args.Length <= 1)
            {
                uCommands.StartBrowseDialog();
            }
            else  // if we are here args.Length > 1
            {
                uCommands.RunCommand(args);
            }

            Settings.SaveSettings();
        }
コード例 #15
0
ファイル: Form1.cs プロジェクト: nulltask/BmsOptimizer
		private void Form1_Load(object sender, System.EventArgs e)
		{
			// this.Font = SystemInformation.MenuFont;
			ini_load(sender,e);
			vbmp3_init();

			// 二重起動対策
			mutex = new System.Threading.Mutex(false,"BMSOptimizer");
			if (mutex.WaitOne(0,false) == false)
			{
				this.Close();
			}

			// スプラッシュ表示はONかな
				if (ShowSplash == "True")
				{

					// スプラッシュ表示!
					FormSplash splash = new FormSplash();
					splash.Show();

					// 二重起動チェック
					if (mutex.WaitOne(0,false) == false)
					{
						splash.Close();
					}

					splash.Opacity = 1;
					Thread.Sleep(750);

					// フェードアウト効果
					int i = 250; // フェードアウト時間
					for(int j = i;j != 0 ; j--)
					{
						splash.Show();
						splash.Opacity = (double)j / i;
					}
			
					// 閉じ
					splash.Close();
				}

			this.Text = titletext;
		}