AutoRunApplication() 공개 정적인 메소드

public static AutoRunApplication ( string action ) : bool
action string
리턴 bool
        public DeployTool()
        {
            //Create necessary directory tree
            if (!Directory.Exists(Application.StartupPath + "\\deploy"))
            {
                Directory.CreateDirectory(Application.StartupPath + "\\deploy");
            }

            //Set default folders
            InstallationProperties.Instance.Set("MPDir",
                                                Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) +
                                                "\\Team MediaPortal\\MediaPortal");
            InstallationProperties.Instance.Set("TVServerDir",
                                                Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) +
                                                "\\Team MediaPortal\\MediaPortal TV Server");

            string tmpPrg = Environment.GetEnvironmentVariable("ProgramW6432");

            if (!string.IsNullOrEmpty(tmpPrg))
            {
                InstallationProperties.Instance.Set("ProgramFiles", tmpPrg);
            }
            else
            {
                InstallationProperties.Instance.Set("ProgramFiles", Environment.GetEnvironmentVariable("ProgramFiles"));
            }

            // Paint first screen
            InitializeComponent();
            Icon = System.Drawing.Icon.ExtractAssociatedIcon(Application.ExecutablePath);
            Localizer.SwitchCulture("en-US");
            UpdateUI();

            // Delete Run registry key
            DialogType firstDlg;

            if (Utils.AutoRunApplication("delete"))
            {
                firstDlg = DialogType.Installation;
                InstallationProperties.Instance.Load();
                Localizer.SwitchCulture(InstallationProperties.Instance["language"]);
                _restart = true;
            }
            else
            {
                firstDlg = DialogType.Welcome;
                Localizer.SwitchCulture("en-US");
                _restart = false;
            }
            _currentDialog = DialogFlowHandler.Instance.GetDialogInstance(firstDlg);
            splitContainer2.Panel1.Controls.Add(_currentDialog);
            InstallationProperties.Instance.Set("InstallTypeHeader", "Choose installation type");
            backButton.Visible = false;
            UpdateUI();
            if (_restart)
            {
                nextButton.Text = Localizer.GetBestTranslation("Install_buttonInstall");
            }
            nextButton.Focus();
        }
예제 #2
0
        public static void NotifyReboot(string DisplayName)
        {
            // Write Run registry key
            Utils.AutoRunApplication("set");

            // Notify about the needed reboot
            MessageBox.Show(Localizer.GetBestTranslation("Reboot_Required"), DisplayName, MessageBoxButtons.OK,
                            MessageBoxIcon.Exclamation);

            //Close DeployTool
            Environment.Exit(-3);
        }