Пример #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            _objInstallerManager = new InstallManager();
            _objInstallerManager.LoadOptions();

            // ** Check if the uninstaller was run manually (without the /u switch) in which case we will switch to uinstall mode.
            ProgramInfo pi = new ProgramInfo(_objInstallerManager.Options);

            if (InstallManager.ApplicationIsInstalled(pi))
            {
                SparkGlobals.ProgramMode = SparkProgramMode.Uninstall;
                Proteus.Globals.Logger.LogWarn("Uninstall run without " + SparkFlags.Uninstall + " switch - detected installed app so switching to uninstall mode.");
            }
            else
            {
                if (_objInstallerManager.GetOption(InstallOption.UninstallFolderRoot_Uninstaller_Only) != null)
                {
                    // ** if the appliation is not installed, but we are running the uninstaller, then tell the user and quit.
                    DisplayView(InstallerViewType.ShowError);
                    return;
                }
            }

            System.Windows.Threading.DispatcherTimer myDispatcherTimer = new System.Windows.Threading.DispatcherTimer();
            myDispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 100); // 100 Milliseconds
            myDispatcherTimer.Tick    += new EventHandler(UpdateTick);
            myDispatcherTimer.Start();

            if (SparkGlobals.ProgramMode == SparkProgramMode.Install)
            {
                DisplayView(InstallerViewType.Options);
            }
            else if (SparkGlobals.ProgramMode == SparkProgramMode.Uninstall)
            {
                DisplayView(InstallerViewType.UninstallOptions);
            }
        }