This commit is contained in:
sc committed 2024-11-23 22:01:30 +08:00
commit 83e77f50f3
1 file changed
+23 -1
+23 -1
View File
@@ -62,12 +62,34 @@ 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)//测试按钮
{