Exemple #1
0
        } // SetWizardResult

        static int LaunchWizard()
        {
            InitializationResult initResult;
            bool launchMainProgram = false;
            int  result            = 0;

            WizardEndResult = DialogResult.Abort;

            AppUiConfig = Installation.LoadRegistrySettings(out initResult);
            if (AppUiConfig == null)
            {
                Program.SetWizardResult(DialogResult.Abort, string.Format("{0}\r\n{1}", initResult.Caption, initResult.Message), initResult.InnerException);
                goto End;
            } // if
            BasicGoogleTelemetry.Init(Properties.Resources.AnalyticsGoogleTrackingId, AppUiConfig.AnalyticsClientId, true, true, true);

            using (var dlg = new WizardWelcomeDialog())
            {
                switch (dlg.ShowDialog())
                {
                case DialogResult.Cancel:
                    Program.SetWizardResult(DialogResult.Cancel);
                    goto End;
                } // switch
            }     // using

            using (var dlg = new ConfigForm())
            {
                dlg.ShowDialog();
            } // using dlg

End:
            using (var dlg = new WizardEndDialog())
            {
                dlg.EndResult      = WizardEndResult;
                dlg.ErrorMessage   = WizardEndText;
                dlg.ErrorException = WizardEndException;
                dlg.ShowDialog();

                launchMainProgram = dlg.checkRunMainProgram.Checked;
                result            = (WizardEndResult == DialogResult.OK) ? 0 : -1;
            } // using

            if (launchMainProgram)
            {
                var message = Installation.Launch(null, AppUiConfig.Folders.Install, Properties.Resources.SuccessExecuteProgram);
                if (message != null)
                {
                    MessageBox.Show(message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                } // if
            }     // if

            return(result);
        } // LaunchWizard
Exemple #2
0
        } // GetMainForm

        #endregion

        #region Initialization methods

        private InitializationResult LoadConfiguration()
        {
            InitializationResult result;

            try
            {
                result = AppUiConfiguration.Load(null, ConfigLoadDisplayProgress);
                if (result.IsError)
                {
                    return(result);
                }

                result = ValidateConfiguration(AppUiConfiguration.Current);
                if (result.IsError)
                {
                    return(result);
                }

                BasicGoogleTelemetry.Init(Properties.InvariantTexts.AnalyticsGoogleTrackingId,
                                          AppUiConfiguration.Current.AnalyticsClientId,
                                          AppUiConfiguration.Current.User.Telemetry.Enabled,
                                          AppUiConfiguration.Current.User.Telemetry.Usage,
                                          AppUiConfiguration.Current.User.Telemetry.Exceptions);

                BasicGoogleTelemetry.SendScreenHit("SplashScreen");

                return(InitializationResult.Ok);
            }
            catch (Exception ex)
            {
                return(new InitializationResult()
                {
                    Caption = Properties.Texts.MyAppLoadConfigExceptionCaption,
                    Message = Properties.Texts.MyAppLoadConfigException,
                    InnerException = ex
                });
            } // try-catch
        }     // LoadConfiguration