Ejemplo n.º 1
0
        public FinishPage(ScriptRunner runner, IScriptContinuation continuation)
        {
            if (runner == null)
                throw new ArgumentNullException("runner");
            if (continuation == null)
                throw new ArgumentNullException("continuation");

            _runner = runner;

            InitializeComponent();

            switch (_runner.Mode)
            {
                case ScriptRunnerMode.Install:
                    _headerLabel.Text = String.Format(UILabels.InstallComplete, runner.Environment.Config.SetupTitle);
                    _wizardLabel.Text = String.Format(UILabels.InstallCompleteSubText, runner.Environment.Config.SetupTitle);
                    break;

                case ScriptRunnerMode.Update:
                    _headerLabel.Text = String.Format(UILabels.UpdateComplete, runner.Environment.Config.SetupTitle);
                    _wizardLabel.Text = String.Format(UILabels.UpdateCompleteSubText, runner.Environment.Config.SetupTitle);
                    break;

                case ScriptRunnerMode.Uninstall:
                    _headerLabel.Text = String.Format(UILabels.UninstallComplete, runner.Environment.Config.SetupTitle);
                    _wizardLabel.Text = String.Format(UILabels.UninstallCompleteSubText, runner.Environment.Config.SetupTitle);
                    break;
            }

            continuation.Resume();
        }
Ejemplo n.º 2
0
        public ProgressPage(ScriptRunner runner, IScriptContinuation continuation)
        {
            if (runner == null)
            {
                throw new ArgumentNullException("runner");
            }

            InitializeComponent();

            switch (runner.Mode)
            {
            case ScriptRunnerMode.Install:
                _header.Text    = UILabels.Installing;
                _header.SubText = String.Format(UILabels.InstallingSubText, runner.Environment.Config.SetupTitle);
                break;

            case ScriptRunnerMode.Update:
                _header.Text    = UILabels.Updating;
                _header.SubText = String.Format(UILabels.UpdatingSubText, runner.Environment.Config.SetupTitle);
                break;

            case ScriptRunnerMode.Uninstall:
                _header.Text    = UILabels.Uninstalling;
                _header.SubText = String.Format(UILabels.UninstallingSubText, runner.Environment.Config.SetupTitle);
                break;
            }

            _progressListBox.Visible = false;

            continuation.Resume();
        }
Ejemplo n.º 3
0
        public FinishPage(ScriptRunner runner, IScriptContinuation continuation)
        {
            if (runner == null)
            {
                throw new ArgumentNullException("runner");
            }
            if (continuation == null)
            {
                throw new ArgumentNullException("continuation");
            }

            _runner = runner;

            InitializeComponent();

            switch (_runner.Mode)
            {
            case ScriptRunnerMode.Install:
                _headerLabel.Text = String.Format(UILabels.InstallComplete, runner.Environment.Config.SetupTitle);
                _wizardLabel.Text = String.Format(UILabels.InstallCompleteSubText, runner.Environment.Config.SetupTitle);
                break;

            case ScriptRunnerMode.Update:
                _headerLabel.Text = String.Format(UILabels.UpdateComplete, runner.Environment.Config.SetupTitle);
                _wizardLabel.Text = String.Format(UILabels.UpdateCompleteSubText, runner.Environment.Config.SetupTitle);
                break;

            case ScriptRunnerMode.Uninstall:
                _headerLabel.Text = String.Format(UILabels.UninstallComplete, runner.Environment.Config.SetupTitle);
                _wizardLabel.Text = String.Format(UILabels.UninstallCompleteSubText, runner.Environment.Config.SetupTitle);
                break;
            }

            continuation.Resume();
        }
Ejemplo n.º 4
0
        public ProgressPage(ScriptRunner runner, IScriptContinuation continuation)
        {
            if (runner == null)
                throw new ArgumentNullException("runner");

            InitializeComponent();

            switch (runner.Mode)
            {
                case ScriptRunnerMode.Install:
                    _header.Text = UILabels.Installing;
                    _header.SubText = String.Format(UILabels.InstallingSubText, runner.Environment.Config.SetupTitle);
                    break;

                case ScriptRunnerMode.Update:
                    _header.Text = UILabels.Updating;
                    _header.SubText = String.Format(UILabels.UpdatingSubText, runner.Environment.Config.SetupTitle);
                    break;

                case ScriptRunnerMode.Uninstall:
                    _header.Text = UILabels.Uninstalling;
                    _header.SubText = String.Format(UILabels.UninstallingSubText, runner.Environment.Config.SetupTitle);
                    break;
            }

            _progressListBox.Visible = false;

            continuation.Resume();
        }
Ejemplo n.º 5
0
        public InstallLicensePage(ScriptRunner runner, PageInstallLicense action, IScriptContinuation continuation)
        {
            if (runner == null)
            {
                throw new ArgumentNullException("runner");
            }
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }
            if (continuation == null)
            {
                throw new ArgumentNullException("continuation");
            }

            _runner       = runner;
            _continuation = continuation;

            InitializeComponent();

            _license.Text   = TextUtil.FixNewlines(runner.ParseTemplate(action.Value));
            _header.SubText = String.Format(_header.SubText, runner.Environment.Config.SetupTitle);
            _agree.Text     = String.Format(_agree.Text, runner.Environment.Config.SetupTitle);

            _license.Select(0, 0);
        }
Ejemplo n.º 6
0
        public void WaitForClose(IScriptContinuation continuation)
        {
            if (continuation == null)
            {
                throw new ArgumentNullException("continuation");
            }

            _continuation = continuation;
        }
Ejemplo n.º 7
0
        public void WaitForClose(IScriptContinuation continuation)
        {
            var form = (MainForm)FindForm();

            form.CloseButtonEnabled = true;
            form.ProgressChanged   -= form_ProgressChanged;

            continuation.Resume();
        }
Ejemplo n.º 8
0
        public void WaitForClose(IScriptContinuation continuation)
        {
            var form = (MainForm)FindForm();

            form.CloseButtonEnabled = true;
            form.ProgressChanged -= form_ProgressChanged;

            continuation.Resume();
        }
        public InstallDestinationFolderPage(ScriptRunner runner, PageInstallDestinationFolder action, IScriptContinuation continuation)
        {
            if (runner == null)
            {
                throw new ArgumentNullException("runner");
            }
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }
            if (continuation == null)
            {
                throw new ArgumentNullException("continuation");
            }

            _runner       = runner;
            _continuation = continuation;

            InitializeComponent();

            _header.SubText    = String.Format(_header.SubText, runner.Environment.Config.SetupTitle);
            _introduction.Text = String.Format(
                _introduction.Text,
                runner.Environment.Config.SetupTitle,
                action.IsLast ? UILabels.InstallContinue : UILabels.NextContinue
                );

            string targetPath = _runner.Variables.GetRequired <string>(
                Constants.ScriptVariables.TargetPath
                );

            if (!Path.IsPathRooted(targetPath))
            {
                throw new ScriptException(UILabels.TargetPathNotRooted);
            }
            if (!Directory.Exists(Path.GetPathRoot(targetPath)))
            {
                throw new ScriptException(UILabels.InvalidTargetPathRoot);
            }

            long downloadFolderSize = CalculateDownloadFolderSize(
                runner.Environment.Config.PackageFolder
                );

            _spaceRequired.Text = String.Format(_spaceRequired.Text, Util.FormatSize(downloadFolderSize));

            _originalSpaceAvailable = _spaceAvailable.Text;

            _targetPath.Text = targetPath;

            _destination.Enabled = action.Enabled;

            PageUtil.UpdateAcceptButton(_acceptButton, action.IsLast);
        }
Ejemplo n.º 10
0
        public InstallStartMenuPage(ScriptRunner runner, PageInstallStartMenu action, IScriptContinuation continuation)
        {
            if (runner == null)
            {
                throw new ArgumentNullException("runner");
            }
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }
            if (continuation == null)
            {
                throw new ArgumentNullException("continuation");
            }

            _runner       = runner;
            _continuation = continuation;

            InitializeComponent();

            _header.SubText = String.Format(_header.SubText, runner.Environment.Config.SetupTitle);

            _container.Enabled       = action.Enabled;
            _createStartMenu.Visible = action.CreateStartMenuVisible;
            _createOnDesktop.Visible = action.CreateOnDesktopVisible;

            _originalStartMenuFolder = runner.Variables.GetRequired <string>(
                Constants.ScriptVariables.StartMenuPath
                );
            _createStartMenu.Checked = runner.Variables.GetOptional(
                Constants.ScriptVariables.CreateShortcuts, true
                );
            _createOnDesktop.Checked = runner.Variables.GetOptional(
                Constants.ScriptVariables.CreateDesktopShortcuts, true
                );

            _startMenuFolder.Text = _originalStartMenuFolder;

            var startMenuFolders = new List <string>();

            AddStartMenuFolders(startMenuFolders, NativeMethods.SpecialFolderCSIDL.CSIDL_PROGRAMS);
            AddStartMenuFolders(startMenuFolders, NativeMethods.SpecialFolderCSIDL.CSIDL_COMMON_PROGRAMS);

            startMenuFolders.Sort((a, b) => String.Compare(a, b, StringComparison.OrdinalIgnoreCase));

            foreach (string directory in startMenuFolders)
            {
                _startMenuFolders.Items.Add(directory);
            }

            PageUtil.UpdateAcceptButton(_acceptButton, action.IsLast);
        }
Ejemplo n.º 11
0
        public InstallStartMenuPage(ScriptRunner runner, PageInstallStartMenu action, IScriptContinuation continuation)
        {
            if (runner == null)
                throw new ArgumentNullException("runner");
            if (action == null)
                throw new ArgumentNullException("action");
            if (continuation == null)
                throw new ArgumentNullException("continuation");

            _runner = runner;
            _continuation = continuation;

            InitializeComponent();

            _header.SubText = String.Format(_header.SubText, runner.Environment.Config.SetupTitle);

            _container.Enabled = action.Enabled;
            _createStartMenu.Visible = action.CreateStartMenuVisible;
            _createOnDesktop.Visible = action.CreateOnDesktopVisible;

            _originalStartMenuFolder = runner.Variables.GetRequired<string>(
                Constants.ScriptVariables.StartMenuPath
            );
            _createStartMenu.Checked = runner.Variables.GetOptional(
                Constants.ScriptVariables.CreateShortcuts, true
            );
            _createOnDesktop.Checked = runner.Variables.GetOptional(
                Constants.ScriptVariables.CreateDesktopShortcuts, true
            );

            _startMenuFolder.Text = _originalStartMenuFolder;

            var startMenuFolders = new List<string>();

            AddStartMenuFolders(startMenuFolders, NativeMethods.SpecialFolderCSIDL.CSIDL_PROGRAMS);
            AddStartMenuFolders(startMenuFolders, NativeMethods.SpecialFolderCSIDL.CSIDL_COMMON_PROGRAMS);

            startMenuFolders.Sort((a, b) => String.Compare(a, b, StringComparison.OrdinalIgnoreCase));

            foreach (string directory in startMenuFolders)
            {
                _startMenuFolders.Items.Add(directory);
            }

            PageUtil.UpdateAcceptButton(_acceptButton, action.IsLast);
        }
        public InstallDestinationFolderPage(ScriptRunner runner, PageInstallDestinationFolder action, IScriptContinuation continuation)
        {
            if (runner == null)
                throw new ArgumentNullException("runner");
            if (action == null)
                throw new ArgumentNullException("action");
            if (continuation == null)
                throw new ArgumentNullException("continuation");

            _runner = runner;
            _continuation = continuation;

            InitializeComponent();

            _header.SubText = String.Format(_header.SubText, runner.Environment.Config.SetupTitle);
            _introduction.Text = String.Format(
                _introduction.Text,
                runner.Environment.Config.SetupTitle,
                action.IsLast ? UILabels.InstallContinue : UILabels.NextContinue
            );

            string targetPath = _runner.Variables.GetRequired<string>(
                Constants.ScriptVariables.TargetPath
            );

            if (!Path.IsPathRooted(targetPath))
                throw new ScriptException(UILabels.TargetPathNotRooted);
            if (!Directory.Exists(Path.GetPathRoot(targetPath)))
                throw new ScriptException(UILabels.InvalidTargetPathRoot);

            long downloadFolderSize = CalculateDownloadFolderSize(
                runner.Environment.Config.PackageFolder
            );

            _spaceRequired.Text = String.Format(_spaceRequired.Text, Util.FormatSize(downloadFolderSize));

            _originalSpaceAvailable = _spaceAvailable.Text;

            _targetPath.Text = targetPath;

            _destination.Enabled = action.Enabled;

            PageUtil.UpdateAcceptButton(_acceptButton, action.IsLast);
        }
Ejemplo n.º 13
0
        public WelcomePage(ScriptRunner runner, IScriptAction action, IScriptContinuation continuation)
        {
            if (runner == null)
            {
                throw new ArgumentNullException("runner");
            }
            if (continuation == null)
            {
                throw new ArgumentNullException("continuation");
            }

            _continuation = continuation;

            InitializeComponent();

            switch (runner.Mode)
            {
            case ScriptRunnerMode.Install:
                _headerLabel.Text = String.Format(UILabels.InstallWelcome, runner.Environment.Config.SetupTitle);
                _wizardLabel.Text = String.Format(UILabels.InstallWelcomeSubText, runner.Environment.Config.SetupTitle);
                break;

            case ScriptRunnerMode.Update:
                _headerLabel.Text = String.Format(UILabels.UpdateWelcome, runner.Environment.Config.SetupTitle);
                _wizardLabel.Text = String.Format(UILabels.UpdateWelcomeSubText, runner.Environment.Config.SetupTitle);
                break;

            case ScriptRunnerMode.Uninstall:
                _headerLabel.Text = String.Format(UILabels.UninstallWelcome, runner.Environment.Config.SetupTitle);
                _wizardLabel.Text = String.Format(UILabels.UninstallWelcomeSubText, runner.Environment.Config.SetupTitle);
                break;
            }

            bool isLast = false;

            if (action is PageInstallWelcome)
            {
                isLast = ((PageInstallWelcome)action).IsLast;
            }

            PageUtil.UpdateAcceptButton(_acceptButton, isLast);
        }
Ejemplo n.º 14
0
        public InstallLicensePage(ScriptRunner runner, PageInstallLicense action, IScriptContinuation continuation)
        {
            if (runner == null)
                throw new ArgumentNullException("runner");
            if (action == null)
                throw new ArgumentNullException("action");
            if (continuation == null)
                throw new ArgumentNullException("continuation");

            _runner = runner;
            _continuation = continuation;

            InitializeComponent();

            _license.Text = TextUtil.FixNewlines(runner.ParseTemplate(action.Value));
            _header.SubText = String.Format(_header.SubText, runner.Environment.Config.SetupTitle);
            _agree.Text = String.Format(_agree.Text, runner.Environment.Config.SetupTitle);

            _license.Select(0, 0);
        }
Ejemplo n.º 15
0
        private void WaitForPageClose(IScriptContinuation continuation)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new Action(() => WaitForPageClose(continuation)));
                return;
            }

            IWaitablePage waitablePage = null;

            if (Controls.Count > 0)
            {
                waitablePage = Controls[0] as IWaitablePage;
            }

            if (waitablePage == null)
            {
                throw new NuGetUpdateException(UILabels.PageNotWaitable);
            }

            waitablePage.WaitForClose(continuation);
        }
Ejemplo n.º 16
0
        public WelcomePage(ScriptRunner runner, IScriptAction action, IScriptContinuation continuation)
        {
            if (runner == null)
                throw new ArgumentNullException("runner");
            if (continuation == null)
                throw new ArgumentNullException("continuation");

            _continuation = continuation;

            InitializeComponent();

            switch (runner.Mode)
            {
                case ScriptRunnerMode.Install:
                    _headerLabel.Text = String.Format(UILabels.InstallWelcome, runner.Environment.Config.SetupTitle);
                    _wizardLabel.Text = String.Format(UILabels.InstallWelcomeSubText, runner.Environment.Config.SetupTitle);
                    break;

                case ScriptRunnerMode.Update:
                    _headerLabel.Text = String.Format(UILabels.UpdateWelcome, runner.Environment.Config.SetupTitle);
                    _wizardLabel.Text = String.Format(UILabels.UpdateWelcomeSubText, runner.Environment.Config.SetupTitle);
                    break;

                case ScriptRunnerMode.Uninstall:
                    _headerLabel.Text = String.Format(UILabels.UninstallWelcome, runner.Environment.Config.SetupTitle);
                    _wizardLabel.Text = String.Format(UILabels.UninstallWelcomeSubText, runner.Environment.Config.SetupTitle);
                    break;
            }

            bool isLast = false;

            if (action is PageInstallWelcome)
                isLast = ((PageInstallWelcome)action).IsLast;

            PageUtil.UpdateAcceptButton(_acceptButton, isLast);
        }
Ejemplo n.º 17
0
        public void WaitForClose(IScriptContinuation continuation)
        {
            if (continuation == null)
                throw new ArgumentNullException("continuation");

            _continuation = continuation;
        }