sc 11 months ago
parent
commit
0b8dab4424
  1. 20
      View/MachinesSet.xaml.cs

20
View/MachinesSet.xaml.cs

@ -77,15 +77,19 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
{
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;
MessageBoxResult vr = System.Windows.MessageBox.Show(Properties.Resources.Delete + comboBoxMachine.Text, "SCCM", MessageBoxButton.OKCancel, MessageBoxImage.Question);
if (vr == MessageBoxResult.OK) // 如果是确定,就执行下面代码,记得换上自己的代码喔
{
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
else
{
textlog.Text = "Invalid";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));

Loading…
Cancel
Save