예제 #1
0
		public void LoadSetting(Setting setting)
		{
			var basic = setting.BasicSetting;
			_dropDownLang.SelectedKey = basic.Language;
			_checkBoxIsShowDisclaimer.Checked = basic.IsShowDisclaimer;
			_checkBoxIsOpenIPythonSupport.Checked = basic.IsOpenIPythonSupport;
		}
예제 #2
0
        public Setting SaveSetting()
        {
            var userAgent = new Setting.UserAgentStruct();
            userAgent.UserAgentList = new Dictionary<string, string>();
            //获取随机化开关
            userAgent.IsRandom = _checkBoxIsRandom.Checked==true;
            //获取选中项
            int index = _comboBoxUserAgentList.SelectedIndex;
            if (index == -1)
            {
                userAgent.Selected =new KeyValuePair<string,string>(_comboBoxUserAgentList.Items[0].Key,_comboBoxUserAgentList.Items[0].Text);
            }
            else
            {
	            var selected = _comboBoxUserAgentList.SelectedValue as ListItem;
	            var item = new KeyValuePair<string, string>(selected.Key, selected.Text);
                userAgent.Selected = item;
                //MessageBox.Show(item.Key);
            }
            //获取所有列表
            foreach (var item in _comboBoxUserAgentList.Items)
            {
                if (!userAgent.UserAgentList.ContainsKey(item.Key))
                {
                    userAgent.UserAgentList.Add(item.Key, item.Text);
                }
            }

			var setting = new Setting {UserAgentSetting = userAgent};
	        return setting;
        }
예제 #3
0
        public Setting SaveSetting()
        {
            var policy = new Setting.PolicyStruct
            {
	            IsParamRandom = _checkBoxIsParamRandom.Checked == true
            };

			var setting = new Setting {PolicySetting = policy};
	        return setting;
        }
예제 #4
0
		public Setting SaveSetting()
		{
			var basic = new Setting.BasicStruct
			{
				Language = _dropDownLang.SelectedKey,
				IsShowDisclaimer = _checkBoxIsShowDisclaimer.Checked == true,
				IsOpenIPythonSupport = _checkBoxIsOpenIPythonSupport.Checked == true
			};

			var setting = new Setting {BasicSetting = basic};
			return setting;
		}
예제 #5
0
        public void LoadSetting(Setting setting)
        {
			var header = setting.HttpHeaderSetting;
            if (header.HttpHeaderList != null)
            {
	            var items = new DataStoreCollection<HeaderItem>();
	            foreach (var i in header.HttpHeaderList)
	            {
					items.Add(new HeaderItem(i.Key, i.Value));
	            }
	            _gridViewHeader.DataStore = items;
            }
        }
예제 #6
0
        public void LoadSetting(Setting setting)
        {
	        var userAgent = setting.UserAgentSetting;
            _checkBoxIsRandom.Checked = userAgent.IsRandom;
            foreach (var i in userAgent.UserAgentList)
            {
                var item = new ListItem {Key = i.Key, Text = i.Value};
	            _comboBoxUserAgentList.Items.Add(item);
            }
            //从现有的items中选择
            foreach (var item in _comboBoxUserAgentList.Items)
            {
                if (item.Key == userAgent.Selected.Key)
                {
                    _comboBoxUserAgentList.SelectedKey = item.Key;
                    break;
                }          
            }
        }
예제 #7
0
		public void LoadSetting(Setting setting)
		{
			var proxy = setting.ProxySetting;
			switch (proxy.IsNoOrIeOrCustomProxy)
			{
				case 0:
					_radioButtonNoProxy.Checked = true;
					break;
				case 1:
					_radioButtonIeProxy.Checked = true;
					break;
				case 2:
					_radioButtonCustomProxy.Checked = true;
					break;
				default:
					_radioButtonNoProxy.Checked = true;
					break;
			}
			_textBoxProxyAddr.Text = proxy.ProxyAddr;
			_textBoxProxyPort.Text = proxy.ProxyPort;
			_textBoxProxyUser.Text = proxy.ProxyUser;
			_textBoxProxyPasswd.Text = proxy.ProxyPassword;
			_textBoxProxyDomain.Text = proxy.ProxyDomain;
		}
예제 #8
0
 public Welcome(Setting setting)
 {
     Init();
     this._setting = setting;
 }
예제 #9
0
        private void SaveAllSetting()
        {
	        // new setting
	        var basic = _panelBasicSetting.SaveSetting().BasicSetting;
	        var userAgent = _panelUserAgentSetting.SaveSetting().UserAgentSetting;
	        var httpHeader = _panelHttpHeaderSetting.SaveSetting().HttpHeaderSetting;
	        var policy = _panelPolicySetting.SaveSetting().PolicySetting;
	        var proxy = _panelProxySetting.SaveSetting().ProxySetting;
			
			var setting = new Setting(basic, userAgent, httpHeader, policy, proxy);
            // save Setting to xml
            InitWorker.SaveSettingToXml(AppEnvironment.AppPath, setting);
            // reinit GlobalSetting
			InitWorker.InitGlobalSetting(AppEnvironment.AppPath);
        }
예제 #10
0
        public Setting SaveSetting()
        {
            //获取当前窗口配置
            GetProxySetting();
            var proxy = new Setting.ProxyStruct
            {
	            IsNoOrIeOrCustomProxy = _isProxy,
	            ProxyAddr = _proxyAddr,
	            ProxyPort = _proxyPort,
	            ProxyUser = _proxyUser,
	            ProxyPassword = _proxyPasswd,
	            ProxyDomain = _proxyDomain
            };

			var setting = new Setting {ProxySetting = proxy};
	        return setting;
        }
예제 #11
0
        public static void SaveSettingToXml(string settingXmlPath, Setting.Setting setting)
        {
			SettingXmlHandle.WriteXml("setting.xml", settingXmlPath, setting);
        }
예제 #12
0
        public Setting SaveSetting()
        {       
            var httpHeader = new Setting.HttpHeaderStruct();
	        httpHeader.HttpHeaderList = new Dictionary<string, string>();
	        var items = _gridViewHeader.DataStore as DataStoreCollection<HeaderItem>;
            if (items != null)
            {
                foreach (var item in items)
                {
                    var key = item.Key;
                    var value = item.Value;
                    if (!httpHeader.HttpHeaderList.ContainsKey(key))
                    {
                        httpHeader.HttpHeaderList.Add(key, value);
                    }
                }
            }

			var setting = new Setting {HttpHeaderSetting = httpHeader};
	        return setting;
        }
예제 #13
0
        public void LoadSetting(Setting setting)
        {
			var policy = setting.PolicySetting;

            _checkBoxIsParamRandom.Checked = policy.IsParamRandom;
        }