Exemplo n.º 1
0
 /// <summary>
 ///     更新Value
 /// </summary>
 /// <param name="optionValue"></param>
 public static void UpdateValue(ConfigurationFileOption.ConfigValue optionValue)
 {
     if (SelectedConfigurationValueDictionary.ContainsKey(optionValue.Path))
     {
         SelectedConfigurationValueDictionary.Remove(optionValue.Path);
     }
     SelectedConfigurationValueDictionary.Add(optionValue.Path, optionValue);
 }
Exemplo n.º 2
0
        /// <summary>
        ///     定义的配置
        /// </summary>
        public void SetItemDefine(ConfigurationFileOption.Define value)
        {
            //版本检查
            lblPrimaryVersion.Text = string.Empty;
            if (value.NewSinceVersion != MongoUtility.Basic.EnumMgr.PrimaryVersion.V000)
            {
                //新版本
                lblPrimaryVersion.Text = "New Since " + value.NewSinceVersion;
            }
            if (value.DeprecatedSinceversion != MongoUtility.Basic.EnumMgr.PrimaryVersion.V000)
            {
                //过时版本
                lblPrimaryVersion.Text = "Deprecated Since " + value.DeprecatedSinceversion;
            }
            //路径
            lblPath.Text = value.Path;
            lblDescription.Text = value.Description;
            lblValueType.Text = value.ValueType.ToString();

            //全部不可见
            lblBoolean.Visible = false;
            lblInteger.Visible = false;
            lblList.Visible = false;
            lblString.Visible = false;

            radFalse.Visible = false;
            radTrue.Visible = false;
            intValue.Visible = false;
            cmbValue.Visible = false;
            txtValue.Visible = false;

            fileValue.Visible = false;

            switch (value.ValueType)
            {
                case ConfigurationFileOption.MetaType.String:
                    lblString.Visible = true;
                    txtValue.Visible = true;
                    if (ConfigItemDefine.SelectedConfigurationValueDictionary.ContainsKey(value.Path))
                    {
                        var SelectValue = ConfigItemDefine.SelectedConfigurationValueDictionary[value.Path];
                        txtValue.Text = SelectValue.ValueLiteral;
                    }
                    break;
                case ConfigurationFileOption.MetaType.PathName:
                    fileValue.Visible = true;
                    fileValue.PickerType = ResourceLib.UI.CtlFilePicker.DialogType.Directory;
                    break;
                case ConfigurationFileOption.MetaType.FileName:
                    fileValue.Visible = true;
                    fileValue.PickerType = ResourceLib.UI.CtlFilePicker.DialogType.SaveFile;
                    break;
                case ConfigurationFileOption.MetaType.Int:
                    intValue.Visible = true;
                    lblInteger.Visible = true;
                    if (!(value.RangeMax == 0 && value.RangeMin == 0))
                    {
                        intValue.Maximum = value.RangeMax;
                        intValue.Minimum = value.RangeMin;
                    }
                    if (ConfigItemDefine.SelectedConfigurationValueDictionary.ContainsKey(value.Path))
                    {
                        var SelectValue = ConfigItemDefine.SelectedConfigurationValueDictionary[value.Path];
                        intValue.Text = SelectValue.ValueLiteral;
                    }
                    break;
                case ConfigurationFileOption.MetaType.Boolean:
                    lblBoolean.Visible = true;
                    radFalse.Visible = true;
                    radTrue.Visible = true;
                    if (ConfigItemDefine.SelectedConfigurationValueDictionary.ContainsKey(value.Path))
                    {
                        var SelectValue = ConfigItemDefine.SelectedConfigurationValueDictionary[value.Path];
                        if (SelectValue.ValueLiteral == true.ToString())
                        {
                            radTrue.Checked = true;
                        }
                        else
                        {
                            radFalse.Checked = true;
                        }
                    }
                    break;
                case ConfigurationFileOption.MetaType.List:
                    lblList.Visible = true;
                    cmbValue.Visible = true;
                    //Load ValueList
                    cmbValue.Items.Clear();
                    foreach (var OptionalValue in value.OptionValueList)
                    {
                        cmbValue.Items.Add(OptionalValue);
                    }
                    if (ConfigItemDefine.SelectedConfigurationValueDictionary.ContainsKey(value.Path))
                    {
                        var SelectValue = ConfigItemDefine.SelectedConfigurationValueDictionary[value.Path];
                        cmbValue.Text = SelectValue.ValueLiteral;
                    }
                    break;
                default:
                    break;
            }
        }
Exemplo n.º 3
0
 /// <summary>
 ///     
 /// </summary>
 /// <param name="value"></param>
 public void SetItemValue(ConfigurationFileOption.ConfigValue value)
 {
     var rtnOptionItem = ConfigItemDefine.ConfigurationItemDictionary[value.Path];
     switch (rtnOptionItem.ValueType)
     {
         case ConfigurationFileOption.MetaType.String:
             txtValue.Text = value.ValueLiteral;
             break;
         case ConfigurationFileOption.MetaType.PathName:
             fileValue.SelectedPathOrFileName = value.ValueLiteral;
             break;
         case ConfigurationFileOption.MetaType.FileName:
             fileValue.SelectedPathOrFileName = value.ValueLiteral;
             break;
         case ConfigurationFileOption.MetaType.Int:
             intValue.Text = value.ValueLiteral;
             break;
         case ConfigurationFileOption.MetaType.Boolean:
             if (value.ValueLiteral.Equals("true"))
             {
                 radTrue.Checked = true;
             }
             else
             {
                 radFalse.Checked = true;
             }
             break;
         case ConfigurationFileOption.MetaType.List:
             cmbValue.Text = value.ValueLiteral;
             break;
         default:
             break;
     }
 }