Esempio n. 1
0
        private void DataConnection_Load(object sender, EventArgs e)
        {
            string a = System.IO.Directory.GetCurrentDirectory();

            try
            {
                ListModel = new DBLogin().GDList(null);
                if (ListModel != null)
                {
                    var db = SysTool.EnumToList <EDType>();
                    SelDataType.SelectedIndexChanged -= new EventHandler(SelDataType_SelectedIndexChanged);
                    SelDataType.DataSource            = db;
                    var IsReadModel = ListModel.Where(w => w.IsRead == 1);
                    if (IsReadModel.Count() == 0)
                    {
                        var rs = ListModel.First();
                        BindData(rs);
                        SelDataType.SelectedIndex = 0;
                        BindIp(rs.BaseName, rs.Ip);
                    }
                    else
                    {
                        var ReadFirst = IsReadModel.First();
                        BindData(ReadFirst);
                        SelDataType.Text = ReadFirst.BaseName;
                        BindIp(ReadFirst.BaseName, ReadFirst.Ip);
                    }
                    SelDataType.SelectedIndexChanged += new EventHandler(SelDataType_SelectedIndexChanged);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("错误:" + ex.Message);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 加载条件枚举。
        /// </summary>
        private void LoadModelCondition()
        {
            cklmodel.Items.Clear();
            var r = SysTool.EnumToList <ModelType>();

            foreach (var item in r)
            {
                cklmodel.Items.Add(item);
            }
        }