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