Пример #1
0
        private void GetSubscriptionConnection()
        {
            try
            {
                // Show the connect dialog, if needed.
                if (showDialog)
                {
                    ConnectDialog connectDialog = new ConnectDialog();
                    if (DialogResult.OK == connectDialog.ShowDialog())
                    {
                        // Create the connection and monitor objects.
                        conn       = new ServerConnection(connectDialog.Subscriber);
                        msmMonitor = new MergeSubscriberMonitor(conn);

                        // Set subscription properties.
                        msmMonitor.SubscriberDB = connectDialog.SubscriberDB;
                        msmMonitor.Publisher    = connectDialog.Publisher;
                        msmMonitor.PublisherDB  = connectDialog.PublisherDB;
                        msmMonitor.Publication  = connectDialog.Publication;
                    }
                    else
                    {
                        this.Close();
                        return;
                    }
                }
                // Otherwise, use the passed-in values.
                else
                {
                    // Create the connection and monitor objects.
                    conn       = new ServerConnection(subscriberName);
                    msmMonitor = new MergeSubscriberMonitor(conn);

                    // Set subscription properties.
                    msmMonitor.SubscriberDB = subscriptionDBName;
                    msmMonitor.Publisher    = publisherName;
                    msmMonitor.PublisherDB  = publicationDBName;
                    msmMonitor.Publication  = publicationName;
                }

                // Get the session summary details
                this.rgSessionSummary = msmMonitor.GetSessionsSummary();
            }
            catch (Exception ex)
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(ex);
                emb.Show(this);
                return;
            }
            finally
            {
                if (conn != null)
                {
                    conn.Disconnect();
                }
            }
        }
Пример #2
0
        private void GetSubscriptionConnection()
        {
            try
            {
                // Show the connect dialog, if needed.
                if (showDialog)
                {
                    ConnectDialog connectDialog = new ConnectDialog();
                    if (DialogResult.OK == connectDialog.ShowDialog())
                    {
                        // Create the connection and monitor objects.
                        conn = new ServerConnection(connectDialog.Subscriber);
                        msmMonitor = new MergeSubscriberMonitor(conn);

                        // Set subscription properties.
                        msmMonitor.SubscriberDB = connectDialog.SubscriberDB;
                        msmMonitor.Publisher = connectDialog.Publisher;
                        msmMonitor.PublisherDB = connectDialog.PublisherDB;
                        msmMonitor.Publication = connectDialog.Publication;
                    }
                    else
                    {
                        this.Close();
                        return;
                    }
                }
                // Otherwise, use the passed-in values.
                else
                {
                    // Create the connection and monitor objects.
                    conn = new ServerConnection(subscriberName);
                    msmMonitor = new MergeSubscriberMonitor(conn);

                    // Set subscription properties.
                    msmMonitor.SubscriberDB = subscriptionDBName;
                    msmMonitor.Publisher = publisherName;
                    msmMonitor.PublisherDB = publicationDBName;
                    msmMonitor.Publication = publicationName;
                }

                // Get the session summary details
                this.rgSessionSummary = msmMonitor.GetSessionsSummary();
            }
            catch (Exception ex)
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(ex);
                emb.Show(this);
                return;
            }
            finally
            {
                if (conn != null)
                {
                    conn.Disconnect();
                }
            }
        }