private CModule GetModuleInfo(XmlNode node) { CModule module = new CModule { Name = node.Name }; foreach (XmlNode node2 in node.ChildNodes) { if (node2.Name == "fileName") { module.FileName = node2.InnerText; } if (node2.Name == "mainItem") { module.StrMainItems = node2.InnerText; } if (node2.Name == "mainForm") { module.StrMainForms = node2.InnerText; } if (node2.Name == "itemPic") { module.ImgName = node2.InnerText; } if (node2.Name == "formFactory") { module.StrFactory = node2.InnerText; } if (node2.Name == "LcdOrder") { module.LcdOrder = node2.InnerText; } if (node2.InnerText.Contains("OverView")) { module.FileName = "RecordManagement.exe"; module.StrMainItems = "RecordManagement.MainItemUserControl"; } } return(module); }
public void FnButtonCall(Keys k) { string fnText = ""; switch (k) { case Keys.F13: fnText = "档案信息"; break; case Keys.F14: fnText = "纸质档案"; break; case Keys.F15: fnText = "综合查询"; break; case Keys.F19: fnText = "随访人群"; break; case Keys.F20: fnText = "数据同步"; break; case Keys.F21: fnText = "多参数仪"; break; } if (!string.IsNullOrEmpty(fnText)) { CModule module = this.Modules.First <CModule>(t => t.ImgName == fnText); if ((module != null) && (this.myCall != null)) { this.myCall(module); } } }
public CModulesManager(Action <CModule> act, EventHandler cancelClick, int height, int width) { this.Lev2Status = false; this.Modules = new List <CModule>(); this.myCall = act; this.my_cancelCall = cancelClick; this.fm_set = ConfigHelper.GetNode("fsset"); if (string.IsNullOrEmpty(this.fm_set)) { this.fm_set = "111111111"; ConfigHelper.WriteNode("fsset", this.fm_set); } char[] chArray = this.fm_set.ToArray <char>(); string path = Application.StartupPath + @"\ModuleManger.xml"; int index = 0; if (File.Exists(path)) { XmlDocument document = new XmlDocument(); document.Load(path); foreach (XmlNode node in document.DocumentElement["ModuleStore"].ChildNodes) { bool flag = true; if (chArray.Length >= index) { flag = chArray[index].ToString() == "1"; } index++; if (flag) { CModule moduleInfo = this.GetModuleInfo(node); if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\" + moduleInfo.FileName)) { Assembly sampleAssembly = Assembly.LoadFrom(AppDomain.CurrentDomain.BaseDirectory + @"\" + moduleInfo.FileName); if (sampleAssembly != null) { moduleInfo.ModuleAssembly = sampleAssembly; //Button button = this.CreatePicbox(moduleInfo, sampleAssembly); //if (button != null) moduleInfo.C_Btn = button; moduleInfo.ModuleCall = (EventHandler)Delegate.Combine(moduleInfo.ModuleCall, new EventHandler(this.moduleCall)); moduleInfo.ModuleCancelClick += new EventHandler(this.moduleCancelClick); this.Modules.Add(moduleInfo); } } } } } pic_height = height / this.Modules.Count; pic_width = width; foreach (CModule moduleInfo2 in this.Modules) { Assembly sampleAssembly = moduleInfo2.ModuleAssembly; Button button = this.CreatePicbox(moduleInfo2, sampleAssembly); moduleInfo2.C_Btn = button; } }
private Button CreatePicbox(CModule mo, Assembly SampleAssembly) { try { Button button = null; if (SampleAssembly != null) { Bitmap bitmap; if (mo.ImgName == "档案信息") { bitmap = Resources.btndangan00; } else if (mo.ImgName == "随访人群") { bitmap = Resources.btnrenqun00; } else if (mo.ImgName == "医疗服务") { bitmap = Resources.btnyiliaofuwu00; } else if (mo.ImgName == "数据同步") { bitmap = Resources.btnshujutongbu0; } else if (mo.ImgName == "纸质档案") { bitmap = Resources.btnzhizhidangan00; } else if (mo.ImgName == "综合查询") { bitmap = Resources.btnchaxun00; } else if (mo.ImgName == "拍取照片") { bitmap = Resources.btnpaizhao00; } else { bitmap = Resources.未找到; } button = new Button { BackColor = Color.Transparent, BackgroundImage = bitmap, BackgroundImageLayout = ImageLayout.Zoom, FlatStyle = FlatStyle.Flat, Font = new Font("宋体", 10.5f, FontStyle.Regular, GraphicsUnit.Point, 134), TextAlign = ContentAlignment.BottomCenter, Text = "", Margin = new Padding(0, 0, 0, 0), Location = this.GetPicPosition(this.pic_count++), Name = mo.Name, //Size = new Size(this.pic_width, pic_height), Size = new Size(257, 96), Tag = mo.ImgName, TabStop = false }; button.FlatAppearance.BorderSize = 0; string.IsNullOrEmpty(mo.StrMainItems); } return(button); } catch (Exception exception) { MessageBox.Show(exception.Message); } return(null); }