private void DeleteTable_OnClick(object sender, RoutedEventArgs e) { var model = (TableStructViewModel)((MenuItem)sender).DataContext; string messageBoxText = "Do you want to save changes?"; string caption = "Delete"; MessageBoxButton button = MessageBoxButton.YesNo; MessageBoxImage icon = MessageBoxImage.Warning; var result = MessageBox.Show(messageBoxText, caption, button, icon); if (result == MessageBoxResult.Yes) { _tableAccessService.DeleteTable(model.Database, model.TableName, model.Owner); RefreshTree(); } }
private void Delete_Click(object sender, RoutedEventArgs e) { if (TablesList.SelectedItems.Count == 0) { return; } var item = (TableViewModel)TablesList.SelectedItems[0]; string messageBoxText = "Do you want to delete table?"; string caption = "Delete"; MessageBoxButton button = MessageBoxButton.YesNo; MessageBoxImage icon = MessageBoxImage.Warning; var result = MessageBox.Show(messageBoxText, caption, button, icon); if (result == MessageBoxResult.Yes) { _tableAccessService.DeleteTable(_database, item.TableName, item.Owner); GetValue(); MainWindow.Refresh(); } }