Beispiel #1
0
        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);
                        }
                    }
                }
            }
        }
Beispiel #2
0
        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));
                }
            }
        }