diff --git a/View/MachinesSet.xaml.cs b/View/MachinesSet.xaml.cs index 2392d4a..6102701 100644 --- a/View/MachinesSet.xaml.cs +++ b/View/MachinesSet.xaml.cs @@ -2,6 +2,7 @@ using SunlightCentralizedControlManagement_SCCM_.UserClass; using SunlightCentralizedControlManagement_SCCM_.ViewModel; using System; +using System.Collections; using System.Collections.Generic; using System.Data; using System.Linq; @@ -65,7 +66,20 @@ namespace SunlightCentralizedControlManagement_SCCM_.View { if (!string.IsNullOrEmpty(comboBoxMachine.Text)) { + DataRow dr = MainWindowViewModel.Machines.NewRow();//添加数据 + dr["Name"] = comboBoxMachine.Text; + dr["Group"] = TextMachineGroup; + + SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 + SQLiteHelpers.Open(); //打开数据库 + // SQLiteHelpers.InsertData("Machines", SQLiteHelpers.DataTableToDictionary(dr)); + // MainWindowViewModel.Machines = SQLiteHelpers.ExecuteDataSet("select * from Machines Order by id", null).Tables[0]; //读取表写入缓存 + SQLiteHelpers.Close(); + + + Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView; + comboBoxMachine.Text = null; } else {