コード例 #1
0
        /// <summary>
        /// 将修改后的参数保存到本地
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                for (int i = 0; i < ParSetAdjust.P_I.g_ParSetAdjust_L.Count; i++)
                {
                    BaseParSetAdjust baseParSetAdjust = (BaseParSetAdjust)dgSetAdjust.Items[i];
                    ParSetAdjust.P_I[g_Name][i] = baseParSetAdjust;
                }

                ParSetAdjust.P_I[g_Name, -1].Title    = txtTitle.Text.Trim();      //当前控件的标题
                ParSetAdjust.P_I[g_Name, -1].BlHidden = (bool)chbHidden.IsChecked; //是否隐藏控件

                if (g_Name.Contains("adj"))
                {
                    if ((bool)rdoSamll.IsChecked)
                    {
                        ParSetAdjust.P_I.TypeWinAdjust_e = TypeWinAdjust_enum.small;
                    }
                    else if ((bool)rdoNormal.IsChecked)
                    {
                        ParSetAdjust.P_I.TypeWinAdjust_e = TypeWinAdjust_enum.normal;
                    }
                    else
                    {
                        ParSetAdjust.P_I.TypeWinAdjust_e = TypeWinAdjust_enum.full;
                    }
                }
                else
                {
                    if ((bool)rdoSamll.IsChecked)
                    {
                        ParSetAdjust.P_I.TypeWinStd_e = TypeWinAdjust_enum.small;
                    }
                    else
                    {
                        ParSetAdjust.P_I.TypeWinStd_e = TypeWinAdjust_enum.normal;
                    }
                }

                ParSetAdjust.P_I.WriteIni(g_Name);

                btnSave.RefreshDefaultColor("保存成功", true);
            }
            catch (Exception ex)
            {
                Log.L_I.WriteError(NameClass, ex);
            }
        }
コード例 #2
0
        /// <summary>
        /// 将修改后的参数保存到本地
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                for (int i = 0; i < ParSetAdjust.P_I.g_ParSetAdjust_L.Count; i++)
                {
                    BaseParSetAdjust baseParSetAdjust = (BaseParSetAdjust)dgSetAdjust.Items[i];
                    ParSetAdjust.P_I.g_ParSetAdjust_L[i] = baseParSetAdjust;
                }
                ParSetAdjust.P_I.g_Title = txtTitle.Text.Trim();
                ParSetAdjust.P_I.WriteIni();

                btnSave.RefreshDefaultColor("保存成功", true);
            }
            catch (Exception ex)
            {
            }
        }
コード例 #3
0
ファイル: ParSetAdjust.cs プロジェクト: xhyangxianjun/InspOld
        /// <summary>
        /// 从Ini文件中读取参数
        /// </summary>
        public void ReadIniStr()
        {
            try
            {
                g_ParSetAdjust_L.Clear();
                //title


                for (int i = 0; i < C_NumValue; i++)
                {
                    string basekey = "Value" + (i + 1).ToString();

                    //名称
                    string name = IniFile.I_I.ReadIniStr(g_Section, "Name" + basekey, C_PathSavePar);
                    if (name == "")
                    {
                        name = "Value" + (i + 1).ToString();
                    }

                    //小数点个数
                    string strIncrement = IniFile.I_I.ReadIniStr(g_Section, "Increment" + basekey, C_PathSavePar);
                    if (!strIncrement.Contains("Num"))
                    {
                        strIncrement = "Num2";
                    }


                    //最大最小值
                    base.StrDouble = IniFile.I_I.ReadIniStr(g_Section, "Min" + basekey, C_PathSavePar);
                    double min = Convert.ToDouble(base.StrDouble);
                    base.StrDouble = IniFile.I_I.ReadIniStr(g_Section, "Max" + basekey, C_PathSavePar);
                    double max = Convert.ToDouble(base.StrDouble);
                    if (min == 0 &&
                        max == 0)
                    {
                        min = int.MinValue;
                        max = int.MaxValue;
                    }

                    //权限
                    bool   blWorker  = true;
                    string strWorker = IniFile.I_I.ReadIniStr(g_Section, "Worker" + basekey, C_PathSavePar);
                    if (strWorker == "")
                    {
                    }
                    else
                    {
                        try
                        {
                            blWorker = Boolean.Parse(strWorker);
                        }
                        catch (Exception)
                        {
                            blWorker = true;
                        }
                    }

                    bool   blEngineer  = true;
                    string strEngineer = IniFile.I_I.ReadIniStr(g_Section, "Engineer" + basekey, C_PathSavePar);
                    if (strEngineer == "")
                    {
                    }
                    else
                    {
                        try
                        {
                            blEngineer = Boolean.Parse(strEngineer);
                        }
                        catch (Exception)
                        {
                            blEngineer = true;
                        }
                    }

                    BaseParSetAdjust baseParSetAdjust = new BaseParSetAdjust()
                    {
                        No           = i,
                        Name         = name,
                        StrIncrement = strIncrement,
                        Min          = min,
                        Max          = max,

                        Worker   = blWorker,
                        Engineer = blEngineer
                    };
                    g_ParSetAdjust_L.Add(baseParSetAdjust);
                }
            }
            catch (Exception ex)
            {
            }
        }
コード例 #4
0
ファイル: ParSetAdjust.cs プロジェクト: 0000duck/TW_CT2
        /// <summary>
        /// 读取基准值的配置
        /// </summary>
        public void ReadIniRptAdj()
        {
            try
            {
                #region std
                for (int j = 0; j < 18; j++)
                {
                    List <BaseParSetAdjust> parSetAdjust_L = new List <BaseParSetAdjust>();
                    string section = "radj" + (j + 1).ToString();
                    for (int i = 0; i < C_NumValue; i++)
                    {
                        string basekey = "Value" + (i + 1).ToString();

                        //名称
                        string name = IniFile.I_I.ReadIniStr(section, "Name" + basekey, C_PathSavePar);
                        if (name == "")
                        {
                            name = "Null";
                        }

                        //小数点个数
                        string strIncrement = IniFile.I_I.ReadIniStr(section, "Increment" + basekey, C_PathSavePar);
                        if (!strIncrement.Contains("Num"))
                        {
                            strIncrement = "Num2";
                        }

                        //最大最小值
                        base.StrDouble = IniFile.I_I.ReadIniStr(section, "Min" + basekey, C_PathSavePar);
                        double min = Convert.ToDouble(base.StrDouble);
                        base.StrDouble = IniFile.I_I.ReadIniStr(section, "Max" + basekey, C_PathSavePar);
                        double max = Convert.ToDouble(base.StrDouble);
                        if (min == 0 &&
                            max == 0)
                        {
                            min = int.MinValue;
                            max = int.MaxValue;
                        }

                        #region  权限
                        bool blWorker   = true;
                        bool blEngineer = true;

                        #endregion  权限

                        BaseParSetAdjust baseParSetAdjust = new BaseParSetAdjust()
                        {
                            No           = i,
                            Name         = name,
                            StrIncrement = strIncrement,
                            Min          = min,
                            Max          = max,

                            Worker   = blWorker,
                            Engineer = blEngineer
                        };
                        parSetAdjust_L.Add(baseParSetAdjust);
                    }

                    ParSetAdjust par = new ParSetAdjust();

                    //标题
                    par.Title = IniFile.I_I.ReadIniStr(section, "Title", C_PathSavePar);

                    par.g_ParSetAdjust_L = parSetAdjust_L;

                    //将配置添加到哈希表
                    g_HtAdjConfig.Add(section, par);
                }
                #endregion std
            }
            catch (Exception ex)
            {
                Log.L_I.WriteError(NameClass, ex);
            }
        }