private void BeginSynchronize(SqlCeReplicationHelper.ReinitializeOption option) { try { txtStatus.Text = string.Empty; btnSync.IsEnabled = false; bool useNt = comboBox1.SelectedIndex == 1; //#if DEBUG // txtUrl.Text = "http://erik-pc/ssce35sync/sqlcesa35.dll"; // txtPublisher.Text = "Erik-PC"; // txtPublisherDatabase.Text = "PostCodes"; // txtPublication.Text = "PubPostCodes"; // txtSubscriber.Text = "ERIK-PC"; //#endif _replHelper = new SqlCeReplicationHelper(DatabaseInfo.ConnectionString, txtUrl.Text, txtPublisher.Text, txtPublisherDatabase.Text, txtPublication.Text, txtSubscriber.Text, txtHostname.Text, useNt, txtInternetUsername.Text, txtInternetPassword.Password, txtPublisherUsername.Text, txtPublisherPassword.Password, IsNew, option); _replHelper.Completed += replHelper_Completed; _replHelper.Progress += replHelper_Progress; _replHelper.Synchronize(); } catch (Exception ex) { btnSync.IsEnabled = true; Helpers.DataConnectionHelper.SendError(ex, DatabaseInfo.DatabaseType, false); } }
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)); } } } }
private void BeginSynchronize(SqlCeReplicationHelper.ReinitializeOption option) { try { txtStatus.Text = string.Empty; btnSync.IsEnabled = false; bool useNT = false; if (comboBox1.SelectedIndex == 1) { useNT = true; } //txtUrl.Text = "http://erik-pc/ssce35sync/sqlcesa35.dll"; //txtPublisher.Text = "Erik-PC\\SQL2008R2"; //txtPublisherDatabase.Text = "PostCodes"; //txtPublication.Text = "PubPostCodes"; //txtSubscriber.Text = "ERIK-PC"; replHelper = new SqlCeReplicationHelper(this.Database, txtUrl.Text, txtPublisher.Text, txtPublisherDatabase.Text, txtPublication.Text, txtSubscriber.Text, txtHostname.Text, useNT, txtInternetUsername.Text, txtInternetPassword.Password, txtPublisherUsername.Text, txtPublisherPassword.Password, IsNew, option); replHelper.Completed += new SqlCeReplicationHelper.CompletedHandler(replHelper_Completed); replHelper.Progress += new SqlCeReplicationHelper.ProgressHandler(replHelper_Progress); replHelper.Synchronize(); } catch (Exception ex) { MessageBox.Show(Helpers.DataConnectionHelper.ShowErrors(ex)); } }
private void PrepareUi() { if (IsNew) { btnSample.Visibility = Visibility.Hidden; txtSubscriber.Text = Environment.MachineName; } else { { if (!string.IsNullOrWhiteSpace(Publication)) { try { using (IRepository repository = Helpers.RepositoryHelper.CreateRepository(DatabaseInfo)) { DateTime date = repository.GetLastSuccessfulSyncTime(Publication); if (date != DateTime.MinValue) { lblLastSync.Content = "Last sync: " + date; } ReplicationProperties props = SqlCeReplicationHelper.GetProperties(DatabaseInfo.ConnectionString, Publication); txtUrl.Text = props.InternetUrl; txtPublisher.Text = props.Publisher; txtPublisherDatabase.Text = props.PublisherDatabase; txtPublisherUsername.Text = props.PublisherLogin; txtPublication.Text = props.Publication; txtSubscriber.Text = props.Subscriber; txtHostname.Text = props.HostName; txtInternetUsername.Text = props.InternetLogin; if (props.UseNT) { comboBox1.SelectedIndex = 1; } } } catch (Exception ex) { Helpers.DataConnectionHelper.SendError(ex, DatabaseInfo.DatabaseType, false); } } } } }
private void PrepareUI() { if (this.IsNew) { btnSample.Visibility = System.Windows.Visibility.Hidden; txtSubscriber.Text = Environment.MachineName; } else { try { if (!string.IsNullOrWhiteSpace(Publication)) { using (IRepository repository = new DBRepository(Database)) { DateTime date = repository.GetLastSuccessfulSyncTime(Publication); if (date != DateTime.MinValue) { lblLastSync.Content = "Last sync: " + date.ToString(); } ReplicationProperties props = SqlCeReplicationHelper.GetProperties(Database, Publication); txtUrl.Text = props.InternetUrl; txtPublisher.Text = props.Publisher; txtPublisherDatabase.Text = props.PublisherDatabase; txtPublisherUsername.Text = props.PublisherLogin; txtPublication.Text = props.Publication; txtSubscriber.Text = props.Subscriber; txtHostname.Text = props.HostName; txtInternetUsername.Text = props.InternetLogin; if (props.UseNT) { comboBox1.SelectedIndex = 1; } } } } catch (Exception ex) { MessageBox.Show(Helpers.DataConnectionHelper.ShowErrors(ex)); } } }