Пример #1
0
        private void initRecordInfo()
        {
            INIHelper iniHelper = new INIHelper(Common.recordFilePath, "配置信息请勿修改");

            List<RecordModel> recordList = new List<RecordModel>();

            //读取INI信息
            NameValueCollection data_records = new NameValueCollection();
            iniHelper.ReadSectionValues("DataRecords", data_records);

            int recordCount = data_records.Count;
            if (data_records != null && recordCount > 0)
            {
                //不为空,有数据
                for (int i = 1; i < 20; i++)
                {
                    if (recordCount > 20)
                    {
                        recordList.Add(new RecordModel(data_records[recordCount - 20 + i].ToString()));
                    }
                    else if (i < recordCount)
                        recordList.Add(new RecordModel(data_records[i].ToString()));
                }
            }

            //加载recordList 数据
            this.dataGridView1.DataSource = new List<RecordModel>();
            this.dataGridView1.DataSource = recordList;
        }
Пример #2
0
        public static INIHelper getInstance(string AFileName)
        {
            if (iniHelper == null)
                iniHelper = new INIHelper(AFileName);
            iniHelper.FileName = GetFilePath( AFileName);

            return iniHelper;
        }
Пример #3
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            INIHelper ini = new INIHelper(Common.settingFilePath, "配置信息请勿修改");
            try
            {
                string kjqd = string.Empty;
                if (this.cbox_kjqd.CheckState == CheckState.Checked)
                {
                    kjqd = "是";
                }
                else
                {
                    kjqd = "否";
                }

                string zdgx = string.Empty;
                if (this.cbox_zdzx.CheckState == CheckState.Checked)
                {
                    zdgx = "是";
                }
                else
                {
                    zdgx = "否";
                }
                string setting_zdgx = ini.ReadString("服务配置", "自动更新", "");
                if (!setting_zdgx.Contains(zdgx))
                {
                    if (zdgx == "是") { isAutoRunWatch = "yes"; }
                    else { isAutoRunWatch = "no"; }
                }

                string jg = string.Empty;

                if (this.cbox_jg.SelectedIndex == 0)
                {
                    jg = "高";
                }
                else if (this.cbox_jg.SelectedIndex == 1)
                {
                    jg = "中";
                }
                else if (this.cbox_jg.SelectedIndex == 2)
                {
                    jg = "低";
                }

                ini.WriteString("服务配置", "开机启动", kjqd);
                ini.WriteString("服务配置", "自动更新", zdgx);
                ini.WriteString("服务配置", "更新间隔", jg);

                MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK);
                this.DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #4
0
        private void initInfo()
        {
            INIHelper ini = new INIHelper(Common. settingFilePath, "配置信息请勿修改");

            //基本信息
            this.tbx_file.Text = ini.ReadString("基本配置", "扫描文件目录", "");
            this.tbx_ip.Text = ini.ReadString("基本配置", "数据库IP", "");
            this.tbx_port.Text = ini.ReadString("基本配置", "数据库端口", "");
            this.tbx_dbs.Text = ini.ReadString("基本配置", "数据库", "");
            this.tbx_table.Text = ini.ReadString("基本配置", "表名", "");
            this.tbx_uid.Text = ini.ReadString("基本配置", "用户名", "");
            this.tbx_pwd.Text = ini.ReadString("基本配置", "密码", "");
        }
Пример #5
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            INIHelper ini = new INIHelper(Common.settingFilePath, "配置信息请勿修改");

            try
            {
                //基本信息

                if (isDBFCheck)
                {
                    ini.WriteString("SetStatus", "DBFPath", this.tbx_file.Text);
                    ini.WriteString("基本配置", "扫描文件目录", this.tbx_file.Text);
                }
                if (isOracleCheck)
                {
                    ini.WriteString("SetStatus", "OraclePath", str);
                    ini.WriteString("基本配置", "数据库IP", this.tbx_ip.Text);
                    ini.WriteString("基本配置", "数据库端口", this.tbx_port.Text);
                    ini.WriteString("基本配置", "数据库", this.tbx_dbs.Text);
                    ini.WriteString("基本配置", "表名", this.tbx_table.Text);
                    ini.WriteString("基本配置", "用户名", this.tbx_uid.Text);
                    ini.WriteString("基本配置", "密码", this.tbx_pwd.Text);
                }
                if (isDBFCheck || isOracleCheck)
                {
                    this.settingInfoSaveEvent();
                    MessageBox.Show("系统参数保存成功,请重新在服务里打开【自动执行】!", "提示", MessageBoxButtons.OK);
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show("没有数据保存!");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #6
0
        private void iniInfo()
        {
            INIHelper ini = new INIHelper(Common.settingFilePath, "配置信息请勿修改");

            //服务信息
            string kjqd = ini.ReadString("服务配置", "开机启动", "");
            if(kjqd == "是\0")
            {
                this.cbox_kjqd.CheckState = CheckState.Checked;
            }
            else
            {
                this.cbox_kjqd.CheckState = CheckState.Unchecked;
            }

            string zdgx = ini.ReadString("服务配置", "自动更新", "");
            if (zdgx == "是\0")
            {
                this.cbox_zdzx.CheckState = CheckState.Checked;
            }
            else
            {
                this.cbox_zdzx.CheckState = CheckState.Unchecked;
            }

            string gxjg = ini.ReadString("服务配置", "更新间隔", "");
            if (gxjg == "高\0")
            {
                this.cbox_jg.SelectedIndex = 0;
            }
            else if (gxjg == "中\0")
            {
                this.cbox_jg.SelectedIndex = 1;
            }
            else if (gxjg == "低\0")
            {
                this.cbox_jg.SelectedIndex = 2;
            }
        }