public void DropSubscription(object sender, ExecutedRoutedEventArgs e) { if (EnvDteHelper.ShowMessageBox("Do you really want to remove replication metadata from the SQL Server Compact database?", Microsoft.VisualStudio.Shell.Interop.OLEMSGBUTTON.OLEMSGBUTTON_YESNO, Microsoft.VisualStudio.Shell.Interop.OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_SECOND, Microsoft.VisualStudio.Shell.Interop.OLEMSGICON.OLEMSGICON_WARNING) == System.Windows.Forms.DialogResult.No) { return; } var menuItem = sender as MenuItem; if (menuItem == null) { return; } var menuInfo = menuItem.CommandParameter as MenuCommandParameters; if (menuInfo == null) { return; } try { SqlCeReplicationHelper.DropPublication(menuInfo.DatabaseInfo.ConnectionString, menuInfo.Name); if (_parentWindow != null && _parentWindow.Content != null) { ExplorerControl control = _parentWindow.Content as ExplorerControl; control.BuildDatabaseTree(); } Helpers.DataConnectionHelper.LogUsage("SubscriptionDrop"); } catch (Exception ex) { Helpers.DataConnectionHelper.SendError(ex, menuInfo.DatabaseInfo.DatabaseType, false); } }
public void DropSubscription(object sender, ExecutedRoutedEventArgs e) { if (MessageBox.Show("Do you really want to remove replication metadata from the SQL Server Compact database?", "SQL Server Compact Toolbox", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No, MessageBoxOptions.None) == MessageBoxResult.No) { return; } var menuItem = sender as MenuItem; if (menuItem != null) { var menuInfo = menuItem.CommandParameter as MenuCommandParameters; if (menuInfo != null) { try { SqlCeReplicationHelper.DropPublication(menuInfo.Connectionstring, menuInfo.Name); if (_parent != null) { _parent.BuildDatabaseTree(); } } catch (Exception ex) { MessageBox.Show(Helpers.DataConnectionHelper.ShowErrors(ex)); } } } }