Beispiel #1
0
        private void SaveConfig()
        {
            #region -IsAutoStart-
            try
            {
                if (AutoStart.Checked)
                {
                    _data.UpdateConfig("IsAutoStart", "true");
                }
                else
                {
                    _data.UpdateConfig("IsAutoStart", "false");
                }
            }
            catch (Exception ex)
            {
                log.WriteLog(ex.ToString());
            }
            #endregion

            #region -DefaultSearch-
            try
            {
                if (RbtnBaidu.Checked)
                {
                    _data.UpdateConfig("DefaultSearch", "1");
                }
                else if (RbtnGoogle.Checked)
                {
                    _data.UpdateConfig("DefaultSearch", "2");
                }
                else if (RbtnYahoo.Checked)
                {
                    _data.UpdateConfig("DefaultSearch", "3");
                }
                else if (RbtnSoso.Checked)
                {
                    _data.UpdateConfig("DefaultSearch", "4");
                }
                else if (RbtnBing.Checked)
                {
                    _data.UpdateConfig("DefaultSearch", "5");
                }
                else if (Rbtn360.Checked)
                {
                    _data.UpdateConfig("DefaultSearch", "6");
                }
            }
            catch (Exception ex)
            {
                log.WriteLog(ex.ToString());
            }
            #endregion

            #region -Website-
            try
            {
                _data.ClearConfigWebsite();

                if (int_WebsiteCount > 0)
                {
                    int k = 0;
                    for (int i = 0; i < 16; i++)
                    {
                        if (string.IsNullOrEmpty(_iWebsite[i].WebsiteUrl))
                        {
                            continue;
                        }
                        else
                        {
                            _data.AddConfigWebsite(k.ToString(), _iWebsite[i].WebsiteName, _iWebsite[i].WebsiteUrl);
                            k++;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                log.WriteLog(ex.ToString());
            }
            #endregion

            #region -CityCode-
            try
            {
                if (comboBoxXian.SelectedItem != null)
                {
                    ComboBoxItem xian = (ComboBoxItem)comboBoxXian.SelectedItem;
                    _data.UpdateConfig("CityCode", xian.Value);
                }
            }
            catch (Exception ex)
            {
                log.WriteLog(ex.ToString());
            }
            #endregion

            ReloadConfigHandlor();
        }