//初始化加载 private void Window_Loaded(object sender, RoutedEventArgs e) { //初始化连接池 ConnectionPool.Init("sa", "golden", this.ip, "6327", 10); var Connection = ConnectionPool.TryGetConnection(); //实例化基本信息服务,传入连接对象 BaseImpl ibase = new BaseImpl(Connection); int[] tableid = ibase.GetTablesId(); for (int i = 0; i < tableid.Length; i++) { this.TableNames.Items.Add(ibase.GetTablePropertyById(tableid[i]).Name); } }
//下拉框表选择 private void TableNames_SelectionChanged(object sender, SelectionChangedEventArgs e) { var Connection = ConnectionPool.TryGetConnection(); //实例化基本信息服务,传入连接对象 BaseImpl ibase = new BaseImpl(Connection); string SelectName = this.TableNames.SelectedItem.ToString(); //筛选条件 SearchConditionTotal allcssonditonLast = new SearchConditionTotal(); int[] allBookPoissnt = ibase.Search(new SearchConditionTotal() { Table = SelectName }, 5000, DataSort.ID); try { headcheckBox.IsChecked = false; } catch { }; //获取所有属性 List <FullPoint> Allresssult = ibase.GetPointsProperty(allBookPoissnt); dataGrid.DataContext = null; //data = new Data(); Data.Clear(); foreach (FullPoint point in Allresssult) { Data.Add(new Member() { choice = false, Name = SelectName + "." + point.BasePoint.Tag, Entity = point.BasePoint.DataType, ID = point.BasePoint.Id.ToString(), describe = point.BasePoint.Desc }); } dataGrid.DataContext = Data.memberData; }