diff --git a/View/MachinesSet.xaml.cs b/View/MachinesSet.xaml.cs index fde1291..00a96ee 100644 --- a/View/MachinesSet.xaml.cs +++ b/View/MachinesSet.xaml.cs @@ -63,11 +63,33 @@ namespace SunlightCentralizedControlManagement_SCCM_.View private void Save_Click(object sender, RoutedEventArgs e) { + if (!string.IsNullOrEmpty(comboBoxMachine.Text)) + { + } + else + { + textlog.Text = "Invalid"; + textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0)); + } } private void Delete_Click(object sender, RoutedEventArgs e) { - + if (!string.IsNullOrEmpty(comboBoxMachine.Text)) + { + SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 + SQLiteHelpers.Open(); //打开数据库 + SQLiteHelpers.Delete("Machines","Name='"+comboBoxMachine.Text+"'",null); + MainWindowViewModel.Machines = SQLiteHelpers.ExecuteDataSet("select * from Machines Order by id", null).Tables[0]; //读取表写入缓存 + SQLiteHelpers.Close(); + Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView; + comboBoxMachine.Text = null; + } + else + { + textlog.Text = "Invalid"; + textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0)); + } } private void Test_Click(object sender, RoutedEventArgs e)//测试按钮 {