using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Linq; using SOH.Kernel; using SOH.Configuration; using System.Configuration; using EAS.Services; using SOH.BLL; using SOH.Entities; using SOH.Data; using AForge.Video.DirectShow; namespace SOH.BasicSettings { [ModuleAttribute(ModuleID = "02A374E8-934C-4291-8C0E-F253AFA7D70E", ModuleName = "系统基本设置")] public partial class frmBaseSetting : SOH.Window.baseChildForm { public frmBaseSetting() { InitializeComponent(); } private void cb_qydzxyy_CheckedChanged(object sender, EventArgs e) { p_xd.Enabled = cb_qydzxyy.Enabled; } private void frmBaseSetting_Load(object sender, EventArgs e) { System.Configuration.Configuration congf = SOH.Configuration.LocalConfig.Config; var FenDianService = ServiceContainer.GetService(); FenDian fd = FenDianService.getFenDianById(Convert.ToInt32(LoginUser.yydm)); if (fd.isPaidui.ToString() == "1") { this.radioButton1.Checked = true; } else { this.radioButton2.Checked = true; } #region 处理血压 string qyyy = ""; if (congf.AppSettings.Settings.AllKeys.Contains("DZXYY")) { qyyy = congf.AppSettings.Settings["DZXYY"].Value; if (qyyy == "1") { cb_qydzxyy.Checked = true; } else { cb_qydzxyy.Checked = false; } } else { cb_qydzxyy.Checked = false; } /* string BaundRate = conf.AppSettings.Settings["DZXYY_BaundRate"].Value; string DataBits = conf.AppSettings.Settings["DZXYY_DataBits"].Value; string Parity = conf.AppSettings.Settings["DZXYY_Parity"].Value; string PortName = conf.AppSettings.Settings["DZXYY_PortName"].Value; string StopBits = conf.AppSettings.Settings["DZXYY_StopBits"].Value; */ if (congf.AppSettings.Settings.AllKeys.Contains("DZXYY_BaundRate")) { xy_txt_btl.Text = congf.AppSettings.Settings["DZXYY_BaundRate"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("DZXYY_DataBits")) { xy_txt_sjws.Text = congf.AppSettings.Settings["DZXYY_DataBits"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("DZXYY_Parity")) { string parity = congf.AppSettings.Settings["DZXYY_Parity"].Value; if (xy_cbb_jyw.Items.Contains(parity)) { xy_cbb_jyw.SelectedItem = parity; } } if (congf.AppSettings.Settings.AllKeys.Contains("DZXYY_PortName")) { xy_txt_dk.Text = congf.AppSettings.Settings["DZXYY_PortName"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("DZXYY_StopBits")) { string StopBits = congf.AppSettings.Settings["DZXYY_StopBits"].Value; if (xy_cbb_tzws.Items.Contains(StopBits)) { xy_cbb_tzws.SelectedItem = StopBits; } } if (congf.AppSettings.Settings.AllKeys.Contains("DZXYY_SZY")) { xy_txt_szy.Text = congf.AppSettings.Settings["DZXYY_SZY"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("DZXYY_SSY")) { xy_txt_ssy.Text = congf.AppSettings.Settings["DZXYY_SSY"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("DZXYY_XL")) { xy_txt_xl.Text = congf.AppSettings.Settings["DZXYY_XL"].Value; } #endregion #region 处理身高 string qysgy = ""; if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY")) { qysgy = congf.AppSettings.Settings["SGTZY"].Value; if (qysgy == "1") { cb_qysgtzy.Checked = true; } else { cb_qysgtzy.Checked = false; } } else { cb_qysgtzy.Checked = false; } /* string BaundRate = conf.AppSettings.Settings["DZXYY_BaundRate"].Value; string DataBits = conf.AppSettings.Settings["DZXYY_DataBits"].Value; string Parity = conf.AppSettings.Settings["DZXYY_Parity"].Value; string PortName = conf.AppSettings.Settings["DZXYY_PortName"].Value; string StopBits = conf.AppSettings.Settings["DZXYY_StopBits"].Value; */ if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_BaundRate")) { sg_txt_btl.Text = congf.AppSettings.Settings["SGTZY_BaundRate"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_DataBits")) { sg_txt_sjws.Text = congf.AppSettings.Settings["SGTZY_DataBits"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_Parity")) { string parity = congf.AppSettings.Settings["SGTZY_Parity"].Value; if (sg_cbb_jyw.Items.Contains(parity)) { sg_cbb_jyw.SelectedItem = parity; } } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_PortName")) { sg_txt_dk.Text = congf.AppSettings.Settings["SGTZY_PortName"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_StopBits")) { string StopBits = congf.AppSettings.Settings["SGTZY_StopBits"].Value; if (sg_cbb_tzws.Items.Contains(StopBits)) { sg_cbb_tzws.SelectedItem = StopBits; } } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_SG")) { sg_txt_sg.Text = congf.AppSettings.Settings["SGTZY_SG"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_TZ")) { sg_txt_tz.Text = congf.AppSettings.Settings["SGTZY_TZ"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_TZZS")) { sg_txt_tzzs.Text = congf.AppSettings.Settings["SGTZY_TZZS"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_LXTZ")) { sg_txt_tzzs.Text = congf.AppSettings.Settings["SGTZY_LXTZ"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_TZFL")) { sg_txt_tzzs.Text = congf.AppSettings.Settings["SGTZY_TZFL"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_NZZFDJ")) { sg_txt_tzzs.Text = congf.AppSettings.Settings["SGTZY_NZZFDJ"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_TSFL")) { sg_txt_tzzs.Text = congf.AppSettings.Settings["SGTZY_TSFL"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_JRL")) { sg_txt_tzzs.Text = congf.AppSettings.Settings["SGTZY_JRL"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_TDGL")) { sg_txt_tzzs.Text = congf.AppSettings.Settings["SGTZY_TDGL"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_JCDX")) { sg_txt_tzzs.Text = congf.AppSettings.Settings["SGTZY_JCDX"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_ZSYYD")) { sg_txt_tzzs.Text = congf.AppSettings.Settings["SGTZY_ZSYYD"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_RXNL")) { sg_txt_tzzs.Text = congf.AppSettings.Settings["SGTZY_RXNL"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_PHYY")) { sg_txt_tzzs.Text = congf.AppSettings.Settings["SGTZY_PHYY"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_JKZS")) { sg_txt_tzzs.Text = congf.AppSettings.Settings["SGTZY_JKZS"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_KQFS")) { if (congf.AppSettings.Settings["SGTZY_KQFS"].Value.ToString() == "true") { this.radioButton4.Checked = true; } else { this.radioButton3.Checked = true; } } #endregion #region 处理身份证 clsfz(); #endregion #region 处理打印机 czdyj(congf); #endregion #region 处理采集卡 szcjk(congf); #endregion } private FilterInfoCollection videoDevices; private void szcjk(System.Configuration.Configuration congf) { videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); if (videoDevices.Count != 0) { // add all devices to combo foreach (FilterInfo device in videoDevices) { cb_cjk.Items.Add(device); } } else { var fi = new FilterInfo("No DirectShow devices found"); cb_cjk.Items.Add(fi); } cb_cjk.SelectedIndex = 0; //throw new NotImplementedException(); if (congf.AppSettings.Settings.AllKeys.Contains("qybccj")) { if (congf.AppSettings.Settings["qybccj"].Value == "true") { cb_qybbcj.Checked = true; if (congf.AppSettings.Settings.AllKeys.Contains("cjsb")) { cb_cjk.SelectedValue = congf.AppSettings.Settings["cjsb"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("cjfbl")) { cb_fbl.SelectedItem = congf.AppSettings.Settings["cjfbl"].Value; } if (congf.AppSettings.Settings.AllKeys.Contains("cjks")) { txt_cjks.Text = congf.AppSettings.Settings["cjks"].Value; } } else { return; } } else { return; } } /// /// 处理打印机 /// /// private void czdyj(System.Configuration.Configuration congf) { //throw new NotImplementedException(); myinit(); string tmdyjmc = ""; if (congf.AppSettings.Settings.AllKeys.Contains("tmdyjmc")) { tmdyjmc = congf.AppSettings.Settings["tmdyjmc"].Value; } string bgdyjmc = ""; if (congf.AppSettings.Settings.AllKeys.Contains("bgdyjmc")) { bgdyjmc = congf.AppSettings.Settings["bgdyjmc"].Value; } string xpdyjmc = ""; if (congf.AppSettings.Settings.AllKeys.Contains("xpdyjmc")) { xpdyjmc = congf.AppSettings.Settings["xpdyjmc"].Value; } if (ps.Where(t => t.value == tmdyjmc).Any()) { cbb_tmdyj.SelectedValue = tmdyjmc; } if (ps1.Where(t => t.value == bgdyjmc).Any()) { cbb_bgdyj.SelectedValue = bgdyjmc; } if (ps2.Where(t => t.value == xpdyjmc).Any()) { cbb_xpdyj.SelectedValue = xpdyjmc; } } private void clsfz() { System.Configuration.Configuration congf = SOH.Configuration.LocalConfig.Config; if (congf.AppSettings.Settings.AllKeys.Contains("QYSFZDKQ") && congf.AppSettings.Settings["QYSFZDKQ"].Value == "1") { cb_sfzdkq.Checked = true; } List sfzs = new List(); sfzs.Add(new sfz { mc = "中国普天CP IDMR02系列", xh = "SOH.IDCaraRead.Potevio.IDMR02_TG|SOH.IDCaraRead.Potevio.IDMR02_TG.ReadCard" }); cbb_sfzdkqxh.DataSource = sfzs; var group = congf.SectionGroups["object"]; if (group == null) { //group = new ConfigurationSectionGroup(); //conf.SectionGroups.Add("object", group); // MessageBox.Show("系统没有配置读卡器相关配置,请联系管理员设置!"); return; } // ConfigurationSection section = new ConfigurationSection(); // group.Sections.Add("IDCard",) MyAssemblySection section; if (group.Sections.Get("ass") == null) { return; } else { section = group.Sections.Get("ass") as MyAssemblySection; } // = group.Sections["ass"] as MyAssemblySection; MyAssemblyElement myelement = null; foreach (MyAssemblyElement element in section.MyAssemblyElements) { if (element.name == "IDCard") { myelement = element; break; } } if (myelement == null) return; if (sfzs.Where(t => t.xh == myelement.type).Any()) { cbb_sfzdkqxh.SelectedValue = myelement.type; } } private void btn_dzxybc_Click(object sender, EventArgs e) { System.Configuration.Configuration congf = SOH.Configuration.LocalConfig.Config; if (cb_qydzxyy.Checked) { if (congf.AppSettings.Settings.AllKeys.Contains("DZXYY")) { congf.AppSettings.Settings["DZXYY"].Value = "1"; } else { congf.AppSettings.Settings.Add("DZXYY", "1"); } if (congf.AppSettings.Settings.AllKeys.Contains("DZXYY_BaundRate")) { congf.AppSettings.Settings["DZXYY_BaundRate"].Value = xy_txt_btl.Text; } else { congf.AppSettings.Settings.Add("DZXYY_BaundRate", xy_txt_btl.Text); } if (congf.AppSettings.Settings.AllKeys.Contains("DZXYY_DataBits")) { congf.AppSettings.Settings["DZXYY_DataBits"].Value = xy_txt_sjws.Text; } else { congf.AppSettings.Settings.Add("DZXYY_DataBits", xy_txt_sjws.Text); } string parity = "";// congf.AppSettings.Settings["DZXYY_Parity"].Value; if (xy_cbb_jyw.SelectedItem == null) { parity = ""; } else { parity = xy_cbb_jyw.SelectedItem.ToString(); } if (congf.AppSettings.Settings.AllKeys.Contains("DZXYY_Parity")) { congf.AppSettings.Settings["DZXYY_Parity"].Value = parity; } else { congf.AppSettings.Settings.Add("DZXYY_Parity", parity); } if (congf.AppSettings.Settings.AllKeys.Contains("DZXYY_PortName")) { congf.AppSettings.Settings["DZXYY_PortName"].Value = xy_txt_dk.Text; } else { congf.AppSettings.Settings.Add("DZXYY_PortName", xy_txt_dk.Text); } string StopBits = ""; if (xy_cbb_tzws.SelectedItem != null) { StopBits = xy_cbb_tzws.SelectedItem.ToString(); } if (congf.AppSettings.Settings.AllKeys.Contains("DZXYY_StopBits")) { congf.AppSettings.Settings["DZXYY_StopBits"].Value = StopBits; } else { congf.AppSettings.Settings.Add("DZXYY_StopBits", StopBits); } if (congf.AppSettings.Settings.AllKeys.Contains("DZXYY_SZY")) { congf.AppSettings.Settings["DZXYY_SZY"].Value = xy_txt_szy.Text; } else { congf.AppSettings.Settings.Add("DZXYY_SZY", xy_txt_szy.Text); } if (congf.AppSettings.Settings.AllKeys.Contains("DZXYY_SSY")) { congf.AppSettings.Settings["DZXYY_SSY"].Value = xy_txt_ssy.Text; } else { congf.AppSettings.Settings.Add("DZXYY_SSY", xy_txt_ssy.Text); } if (congf.AppSettings.Settings.AllKeys.Contains("DZXYY_XL")) { congf.AppSettings.Settings["DZXYY_XL"].Value = xy_txt_xl.Text; } else { congf.AppSettings.Settings.Add("DZXYY_XL", xy_txt_xl.Text); } } else { if (congf.AppSettings.Settings.AllKeys.Contains("DZXYY")) { congf.AppSettings.Settings["DZXYY"].Value = "0"; } else { congf.AppSettings.Settings.Add("DZXYY", "0"); } } congf.Save(); MessageBox.Show("保存成功!"); } private void cb_qysgtzy_CheckedChanged(object sender, EventArgs e) { p_sg.Enabled = cb_qysgtzy.Checked; } private void btn_sgtzbc_Click(object sender, EventArgs e) { System.Configuration.Configuration congf = SOH.Configuration.LocalConfig.Config; if (cb_qysgtzy.Checked) { if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY")) { congf.AppSettings.Settings["SGTZY"].Value = "1"; } else { congf.AppSettings.Settings.Add("SGTZY", "1"); } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_BaundRate")) { congf.AppSettings.Settings["SGTZY_BaundRate"].Value = sg_txt_btl.Text; } else { congf.AppSettings.Settings.Add("SGTZY_BaundRate", sg_txt_btl.Text); } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_DataBits")) { congf.AppSettings.Settings["SGTZY_DataBits"].Value = sg_txt_sjws.Text; } else { congf.AppSettings.Settings.Add("SGTZY_DataBits", sg_txt_sjws.Text); } string parity = "";// congf.AppSettings.Settings["DZXYY_Parity"].Value; if (sg_cbb_jyw.SelectedItem == null) { parity = ""; } else { parity = sg_cbb_jyw.SelectedItem.ToString(); } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_Parity")) { congf.AppSettings.Settings["SGTZY_Parity"].Value = parity; } else { congf.AppSettings.Settings.Add("SGTZY_Parity", parity); } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_PortName")) { congf.AppSettings.Settings["SGTZY_PortName"].Value = sg_txt_dk.Text; } else { congf.AppSettings.Settings.Add("SGTZY_PortName", sg_txt_dk.Text); } string StopBits = ""; if (sg_cbb_tzws.SelectedItem != null) { StopBits = sg_cbb_tzws.SelectedItem.ToString(); } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_StopBits")) { congf.AppSettings.Settings["SGTZY_StopBits"].Value = StopBits; } else { congf.AppSettings.Settings.Add("SGTZY_StopBits", StopBits); } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_SG")) { congf.AppSettings.Settings["SGTZY_SG"].Value = sg_txt_sg.Text; } else { congf.AppSettings.Settings.Add("SGTZY_SG", sg_txt_sg.Text); } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_TZ")) { congf.AppSettings.Settings["SGTZY_TZ"].Value = sg_txt_tz.Text; } else { congf.AppSettings.Settings.Add("SGTZY_TZ", sg_txt_tz.Text); } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_TZZS")) { congf.AppSettings.Settings["SGTZY_TZZS"].Value = sg_txt_tzzs.Text; } else { congf.AppSettings.Settings.Add("SGTZY_TZZS", sg_txt_tzzs.Text); } //淄博身高体重仪增加 if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_LXTZ")) { congf.AppSettings.Settings["SGTZY_LXTZ"].Value = sg_txt_lxtz.Text; } else { congf.AppSettings.Settings.Add("SGTZY_LXTZ", sg_txt_lxtz.Text); } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_TZFL")) { congf.AppSettings.Settings["SGTZY_TZFL"].Value = sg_txt_tzfl.Text; } else { congf.AppSettings.Settings.Add("SGTZY_TZFL", sg_txt_tzfl.Text); } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_NZZFDJ")) { congf.AppSettings.Settings["SGTZY_NZZFDJ"].Value = sg_txt_nzzfdj.Text; } else { congf.AppSettings.Settings.Add("SGTZY_NZZFDJ", sg_txt_nzzfdj.Text); } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_TSFL")) { congf.AppSettings.Settings["SGTZY_TSFL"].Value = sg_txt_tsfl.Text; } else { congf.AppSettings.Settings.Add("SGTZY_TSFL", sg_txt_tsfl.Text); } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_JRL")) { congf.AppSettings.Settings["SGTZY_JRL"].Value = sg_txt_jrl.Text; } else { congf.AppSettings.Settings.Add("SGTZY_JRL", sg_txt_jrl.Text); } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_TDGL")) { congf.AppSettings.Settings["SGTZY_TDGL"].Value = sg_txt_tdgl.Text; } else { congf.AppSettings.Settings.Add("SGTZY_TDGL", sg_txt_tdgl.Text); } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_JCDX")) { congf.AppSettings.Settings["SGTZY_JCDX"].Value = sg_txt_jcdx.Text; } else { congf.AppSettings.Settings.Add("SGTZY_JCDX", sg_txt_jcdx.Text); } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_ZSYYD")) { congf.AppSettings.Settings["SGTZY_ZSYYD"].Value = sg_txt_zsyyd.Text; } else { congf.AppSettings.Settings.Add("SGTZY_ZSYYD", sg_txt_zsyyd.Text); } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_RXNL")) { congf.AppSettings.Settings["SGTZY_RXNL"].Value = sg_txt_rxnl.Text; } else { congf.AppSettings.Settings.Add("SGTZY_RXNL", sg_txt_rxnl.Text); } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_PHYY")) { congf.AppSettings.Settings["SGTZY_PHYY"].Value = sg_txt_phyy.Text; } else { congf.AppSettings.Settings.Add("SGTZY_PHYY", sg_txt_phyy.Text); } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_JKZS")) { congf.AppSettings.Settings["SGTZY_JKZS"].Value = sg_txt_jkzs.Text; } else { congf.AppSettings.Settings.Add("SGTZY_JKZS", sg_txt_jkzs.Text); } string kqfs = ""; if (radioButton4.Checked == true) { kqfs = "true"; } else { kqfs = "false"; } if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY_KQFS")) { congf.AppSettings.Settings["SGTZY_KQFS"].Value = kqfs; } else { congf.AppSettings.Settings.Add("SGTZY_KQFS", kqfs); } } else { if (congf.AppSettings.Settings.AllKeys.Contains("SGTZY")) { congf.AppSettings.Settings["SGTZY"].Value = "0"; } else { congf.AppSettings.Settings.Add("SGTZY", "0"); } } congf.Save(); MessageBox.Show("保存成功!"); } private void btn_sfz_Click(object sender, EventArgs e) { System.Configuration.Configuration conf = SOH.Configuration.LocalConfig.Config; if (cb_sfzdkq.Checked) { if (conf.AppSettings.Settings.AllKeys.Contains("QYSFZDKQ")) { conf.AppSettings.Settings["QYSFZDKQ"].Value = "1"; } else { conf.AppSettings.Settings.Add("QYSFZDKQ", "1"); } var group = conf.SectionGroups["object"]; if (group == null) { group = new ConfigurationSectionGroup(); conf.SectionGroups.Add("object", group); // MessageBox.Show("系统没有配置读卡器相关配置,请联系管理员设置!"); //return; } // ConfigurationSection section = new ConfigurationSection(); // group.Sections.Add("IDCard",) MyAssemblySection section; if (group.Sections.Get("ass") == null) { section = new MyAssemblySection(); group.Sections.Add("ass", section); } else { section = group.Sections.Get("ass") as MyAssemblySection; } // = group.Sections["ass"] as MyAssemblySection; MyAssemblyElement myelement = null; foreach (MyAssemblyElement element in section.MyAssemblyElements) { if (element.name == "IDCard") { myelement = element; break; } } if (myelement == null) { myelement = new MyAssemblyElement(); section.MyAssemblyElements.Add(myelement); } myelement.name = "IDCard"; myelement.type = cbb_sfzdkqxh.SelectedValue.ToString().Split('|')[1]; myelement.assembly = cbb_sfzdkqxh.SelectedValue.ToString().Split('|')[0]; conf.Save(); } else { if (conf.AppSettings.Settings.AllKeys.Contains("QYSFZDKQ")) { conf.AppSettings.Settings["QYSFZDKQ"].Value = "0"; } else { conf.AppSettings.Settings.Add("QYSFZDKQ", "0"); } } conf.Save(); MessageBox.Show("保存成功!"); } private void cb_sfzdkq_CheckedChanged(object sender, EventArgs e) { cbb_sfzdkqxh.Enabled = cb_sfzdkq.Checked; } class sfz { public string xh { get; set; } public string mc { get; set; } } private void btn_ok_Click(object sender, EventArgs e) { System.Configuration.Configuration congf = SOH.Configuration.LocalConfig.Config; if (congf.AppSettings.Settings.AllKeys.Contains("tmdyjmc")) { congf.AppSettings.Settings["tmdyjmc"].Value = cbb_tmdyj.SelectedValue.ToString(); } else { congf.AppSettings.Settings.Add("tmdyjmc", cbb_tmdyj.SelectedValue.ToString()); } if (congf.AppSettings.Settings.AllKeys.Contains("bgdyjmc")) { congf.AppSettings.Settings["bgdyjmc"].Value = cbb_bgdyj.SelectedValue.ToString(); } else { congf.AppSettings.Settings.Add("bgdyjmc", cbb_bgdyj.SelectedValue.ToString()); } if (congf.AppSettings.Settings.AllKeys.Contains("xpdyjmc")) { congf.AppSettings.Settings["xpdyjmc"].Value = cbb_xpdyj.SelectedValue.ToString(); } else { congf.AppSettings.Settings.Add("xpdyjmc", cbb_xpdyj.SelectedValue.ToString()); } congf.Save(); MessageBox.Show("保持成功!"); } List ps = new List(); List ps1 = new List(); List ps2 = new List(); private void myinit() { //throw new NotImplementedException(); ps.Add(new zprint { name = "默认打印机", value = "" }); ps1.Add(new zprint { name = "默认打印机", value = "" }); ps2.Add(new zprint { name = "默认打印机", value = "" }); foreach (string p in System.Drawing.Printing.PrinterSettings.InstalledPrinters) { ps.Add(new zprint { name = p, value = p }); ps1.Add(new zprint { name = p, value = p }); ps2.Add(new zprint { name = p, value = p }); } cbb_tmdyj.DataSource = ps; cbb_bgdyj.DataSource = ps1; cbb_xpdyj.DataSource = ps2; } class zprint { public string name { get; set; } public string value { get; set; } } private void radioButton1_Click(object sender, EventArgs e) { if (radioButton1.Checked) { //System.Configuration.Configuration congf = SOH.Configuration.LocalConfig.Config; //if (congf.AppSettings.Settings.AllKeys.Contains("isOpenPaidui")) //{ // congf.AppSettings.Settings["isOpenPaidui"].Value = "1"; //} //else //{ // congf.AppSettings.Settings.Add("isOpenPaidui", "0"); //} //congf.Save(); var FenDianService = ServiceContainer.GetService(); FenDian fd = FenDianService.getFenDianById(Convert.ToInt32(LoginUser.yydm)); fd.isPaidui = 1; OperationResult or = FenDianService.Modify(fd); if (or.State == 1) { MessageBox.Show("排队系统开启成功!"); } else { MessageBox.Show("排队系统开启失败!"); } } } private void radioButton2_Click(object sender, EventArgs e) { if (radioButton2.Checked) { //System.Configuration.Configuration congf = SOH.Configuration.LocalConfig.Config; //if (congf.AppSettings.Settings.AllKeys.Contains("isOpenPaidui")) //{ // congf.AppSettings.Settings["isOpenPaidui"].Value = "0"; //} //else //{ // congf.AppSettings.Settings.Add("isOpenPaidui", "0"); //} //congf.Save(); //MessageBox.Show("排队系统关闭完成!"); var FenDianService = ServiceContainer.GetService(); FenDian fd = FenDianService.getFenDianById(Convert.ToInt32(LoginUser.yydm)); fd.isPaidui = 0; OperationResult or = FenDianService.Modify(fd); if (or.State == 1) { MessageBox.Show("排队系统关闭完成!"); } else { MessageBox.Show("排队系统关闭失败!"); } } } private void cb_qybbcj_CheckedChanged(object sender, EventArgs e) { p_cjk.Enabled = cb_qybbcj.Checked; } private VideoCaptureDevice videoDevice; private void cb_cjk_SelectedIndexChanged(object sender, EventArgs e) { FilterInfo device = cb_cjk.SelectedItem as FilterInfo; if (device.MonikerString != "") { videoDevice = new VideoCaptureDevice(device.MonikerString); EnumeratedSupportedFrameSizes(videoDevice); } } private VideoCapabilities[] videoCapabilities; private void EnumeratedSupportedFrameSizes(VideoCaptureDevice videoDevice) { this.Cursor = Cursors.WaitCursor; cb_fbl.Items.Clear(); //snapshotResolutionsCombo.Items.Clear(); try { videoCapabilities = videoDevice.VideoCapabilities; //snapshotCapabilities = videoDevice.SnapshotCapabilities; foreach (VideoCapabilities capabilty in videoCapabilities) { cb_fbl.Items.Add(string.Format("{0}x{1}", capabilty.FrameSize.Width, capabilty.FrameSize.Height)); } /* foreach (VideoCapabilities capabilty in snapshotCapabilities) { snapshotResolutionsCombo.Items.Add(string.Format("{0} x {1}", capabilty.FrameSize.Width, capabilty.FrameSize.Height)); }*/ if (videoCapabilities.Length == 0) { cb_fbl.Items.Add("Not supported"); } /* if (snapshotCapabilities.Length == 0) { snapshotResolutionsCombo.Items.Add("Not supported"); } */ cb_fbl.SelectedIndex = 0; //snapshotResolutionsCombo.SelectedIndex = 0; } finally { this.Cursor = Cursors.Default; } } frm_cjk_test fct; private void btn_test_Click(object sender, EventArgs e) { FilterInfo device = cb_cjk.SelectedItem as FilterInfo; fct = new frm_cjk_test(device.MonikerString, cb_fbl.SelectedItem.ToString()); fct.Show(); } private void button1_Click(object sender, EventArgs e) { fct.getpic(); } private void bt_save_Click(object sender, EventArgs e) { System.Configuration.Configuration congf = SOH.Configuration.LocalConfig.Config; if (cb_qybbcj.Checked) { if (congf.AppSettings.Settings.AllKeys.Contains("qybccj")) { congf.AppSettings.Settings["qybccj"].Value = "true"; } else { congf.AppSettings.Settings.Add("qybccj", "true"); } } else { if (congf.AppSettings.Settings.AllKeys.Contains("qybccj")) { congf.AppSettings.Settings["qybccj"].Value = "false"; } else { congf.AppSettings.Settings.Add("qybccj", "false"); } } FilterInfo device = cb_cjk.SelectedItem as FilterInfo; if (congf.AppSettings.Settings.AllKeys.Contains("cjsb")) { congf.AppSettings.Settings["cjsb"].Value = device.MonikerString; } else { congf.AppSettings.Settings.Add("cjsb", device.MonikerString); } if (congf.AppSettings.Settings.AllKeys.Contains("cjfbl")) { congf.AppSettings.Settings["cjfbl"].Value = cb_fbl.SelectedItem.ToString(); } else { congf.AppSettings.Settings.Add("cjfbl", cb_fbl.SelectedItem.ToString()); } if (congf.AppSettings.Settings.AllKeys.Contains("cjks")) { congf.AppSettings.Settings["cjks"].Value = txt_cjks.Text; } else { congf.AppSettings.Settings.Add("cjks", txt_cjks.Text); } congf.Save(); MessageBox.Show("保存成功!"); } } }