예제 #1
0
 /// <summary>
 /// 显示提示信息
 /// </summary>
 /// <param name="paramData"></param>
 public void OnAfterModify(ParameterData paramData)
 {
     if (AfterModify != null)
     {
         AfterModify(paramData);
     }
     //参数修改之后马上保存
     Save();
 }
예제 #2
0
        /// <summary>
        /// 设置参数
        /// </summary>
        /// <param name="paramPath"></param>
        /// <param name="value"></param>
        public void SetParamData(string paramPath, Object value)
        {
            if (!_paramDic.ContainsKey(paramPath))
            {
                return;
            }
            ParameterData paraData = _paramDic[paramPath];

            paraData.Value = value;
        }
예제 #3
0
        /// <summary>
        /// 注册参数
        /// </summary>
        public void RegisterParameter <T>(string paramPath, T defaultValue, string name,
                                          Func <object, bool> paramVerify, OnsetTime onsetTime)
        {
            if (!_paramDic.ContainsKey(paramPath))
            {
                ParameterData paramData = new ParameterData();
                paramData.Path      = paramPath;
                paramData.ValueType = defaultValue.GetType();
                paramData.Value     = defaultValue;
                paramData.Name      = name;
                paramData.OnsetTime = onsetTime;

                _paramDic.Add(paramPath, paramData);
            }
            ParameterData data = _paramDic[paramPath];

            data.Verify = paramVerify;
        }
예제 #4
0
 /// <summary>
 /// 把字符串转换成ParameterData对象。字符串中只包含Path,ValueType,Value,Name,Description等信息
 /// </summary>
 /// <param name="str"></param>
 /// <returns></returns>
 public static ParameterData Parse(string str)
 {
     string[] items = str.Split(SplitChar);
     if (items.Length != 5)
     {
         return(null);
     }
     try
     {
         ParameterData param = new ParameterData();
         param.Path        = items[0];
         param.ValueType   = Type.GetType(items[1]);
         param.Value       = items[2];
         param.Name        = items[3];
         param.Description = items[4];
         return(param);
     }
     catch (Exception)
     {
         return(null);
     }
 }