Exemplo n.º 1
0
        private static SystemSettingsSwitcherForWindows GetSystemSettingsSwitcher(CommandForWindowsSettings settings, CommandBase command)
        {
            // argument checks
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            if (command == null)
            {
                throw new ArgumentNullException(nameof(command));
            }

            return((SystemSettingsSwitcherForWindows)command.ComponentFactory.CreateSystemSettingsSwitcher(command, null));
        }
Exemplo n.º 2
0
        public SetupContextForWindows(CommandForWindowsSettings settings, SystemSettingsSwitcherForWindows switcher) : base(settings, switcher)
        {
            // argument checks
            Debug.Assert(settings != null);
            SystemSettingsSwitcherForWindowsSettings switcherSettings = settings.SystemSettingsSwitcher;

            Debug.Assert(switcherSettings != null);
            Debug.Assert(switcher != null);

            // ProxyOverride
            this.DefaultProxyOverride = SystemSettingsSwitcherForWindows.GetDefaultProxyOverride();
            if (settings.InitialSetupLevel == 0 || base.NeedActualProxy)
            {
                // User must set ProxyOverride
                this.NeedProxyOverride = true;

                if (string.IsNullOrEmpty(switcherSettings.ProxyOverride))
                {
                    // give default value
                    // DefaultProxyOverride may be set in config file
                    switcherSettings.ProxyOverride = this.DefaultProxyOverride;
                }
            }

            if (settings.InitialSetupLevel == 1)
            {
                // After MAPE supports auto detect and auto config script,
                // ProxyOverride should be reviewed because only overrides which
                // are not handled by auto config should be specified.
                SystemSettingsForWindows current = switcher.GetCurrentSystemSettings();
                if (
                    (current.AutoDetect || string.IsNullOrEmpty(current.AutoConfigURL) == false) &&
                    string.CompareOrdinal(switcherSettings.ProxyOverride, this.DefaultProxyOverride) != 0
                    )
                {
                    this.NeedProxyOverride        = true;
                    this.ShouldResetProxyOverride = true;
                }
            }

            return;
        }
Exemplo n.º 3
0
        internal SetupWindow(Command command, SetupContextForWindows setupContext)
        {
            // argument checks
            if (command == null)
            {
                throw new ArgumentNullException(nameof(command));
            }
            if (setupContext == null)
            {
                throw new ArgumentNullException(nameof(setupContext));
            }
            CommandForWindowsSettings settings = setupContext.Settings;

            // initialize members
            this.Command      = command;
            this.SetupContext = setupContext;

            // initialize components
            InitializeComponent();

            // Authentication Proxy tab
            SystemSettingsSwitcherForWindowsSettings systemSettingsSwitcherSettings = settings.SystemSettingsSwitcher;

            if (setupContext.NeedActualProxy)
            {
                StringBuilder buf = new StringBuilder(Windows.Properties.Resources.Setup_AuthenticationProxy_Description_NeedToChange);
                if (setupContext.IsDefaultActualProxyProvided)
                {
                    buf.AppendLine();
                    buf.AppendLine();
                    buf.Append(Windows.Properties.Resources.Setup_Description_DefaultValueProvided);
                }
                this.authenticationProxyDescriptionTextBlock.Text = buf.ToString();
                if (systemSettingsSwitcherSettings.ActualProxy == null)
                {
                    systemSettingsSwitcherSettings.ActualProxy = setupContext.CreateActualProxySettings();
                }
            }
            else
            {
                this.authenticationProxyDescriptionTextBlock.Text = Windows.Properties.Resources.Setup_Description_NoNeedToChange;
                if (setupContext.ProxyDetected == false && systemSettingsSwitcherSettings.ActualProxy == null)
                {
                    systemSettingsSwitcherSettings.ActualProxy = setupContext.CreateActualProxySettings();
                }
            }
            this.actualProxy.SystemSettingsSwitcherSettings = systemSettingsSwitcherSettings;

            // System Settings Switch tab
            this.systemSettingsSwitcher.SystemSettingsSwitcherSettings = settings.SystemSettingsSwitcher;
            if (setupContext.NeedProxyOverride)
            {
                this.systemSettingsSwitcherDescriptionTextBlock.Text = Windows.Properties.Resources.Setup_Description_Confirm;
            }
            else
            {
                this.systemSettingsSwitcherDescriptionTextBlock.Text = Windows.Properties.Resources.Setup_Description_NoNeedToChange;
            }

            // Test tab
            this.testDescriptionTextBlock.Text = Windows.Properties.Resources.Setup_Test_Description;
            this.targetUrlTextBox.Text         = SystemSettingsSwitcher.GetTestUrl();

            // Finish tab
            string description = string.Concat(Windows.Properties.Resources.Setup_Finishing_Description, Environment.NewLine, Environment.NewLine, Properties.Resources.SetupWindow_finishingDescriptionTextBox_Text_Addition);

            this.finishingDescriptionTextBlock.Text = description;

            UpdateUIState();

            return;
        }
Exemplo n.º 4
0
 public SetupContextForWindows(CommandForWindowsSettings settings, CommandBase command) : this(settings, GetSystemSettingsSwitcher(settings, command))
 {
 }