Ejemplo n.º 1
0
        /// <summary>
        /// 管控信息默认规则:
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txt_ControlInfo_Rule_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                if (panel1.Visible)
                {
                    panel1.Visible = false;
                }
                else
                {
                    List <RulesXML> listRulesXML = new List <RulesXML>();
                    string          filepath     = System.IO.Directory.GetCurrentDirectory() + "\\EMEWE.CarManagement.Commons.xml";
                    XDocument       xml          = XDocument.Load(filepath);
                    CheckProperties cp           = new CheckProperties();
                    List <string>   list         = cp.GetMethodsReflect();
                    var             p            = xml.Elements("doc").Elements("members").Elements("member");


                    foreach (var l in list)
                    {
                        foreach (var m in p)
                        {
                            if (m.Attribute("name").ToString().Contains(l))
                            {
                                RulesXML rx = new RulesXML();
                                rx.Name1  = m.Value.ToString().Trim();
                                rx.Value1 = l.ToString();
                                listRulesXML.Add(rx);
                                break;
                            }
                        }
                    }
                    lb_CarTypeAttribute.DataSource    = listRulesXML;
                    lb_CarTypeAttribute.DisplayMember = "Name1";
                    lb_CarTypeAttribute.ValueMember   = "Value1";
                    panel1.Visible = true;
                }
            }
            catch
            {
                CommonalityEntity.WriteTextLog("ControlInfoForm.txt_ControlInfo_Rule_DoubleClick()");
            }
        }