Ejemplo n.º 1
0
 public override void PageInstallDestinationFolder(PageInstallDestinationFolder action)
 {
     using (var continuation = Runner.GetContinuation())
     {
         _form.ShowPage <InstallDestinationFolderPage>(Runner, action, continuation);
     }
 }
        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);
        }