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(); } } }
private void loadLastAgentSessionSummary() { // Create the connection and monitor objects. ServerConnection conn = new ServerConnection(Properties.Settings.Default.Subscriber); MergeSubscriberMonitor msmMonitor = new MergeSubscriberMonitor(conn); // Set subscription properties. msmMonitor.SubscriberDB = Properties.Settings.Default.SubscriptionDatabase; msmMonitor.Publisher = Properties.Settings.Default.Publisher; msmMonitor.PublisherDB = Properties.Settings.Default.PublicationDatabase; msmMonitor.Publication = Properties.Settings.Default.Publication; MergeSessionSummary s = msmMonitor.GetLastSessionSummary(); if (s == null) return; textBox1.Text = s.StartTime.ToString(); textBox2.Text = s.LastMessage; switch (s.Status) { case MergeSessionStatus.Failed: toolTip1.SetToolTip(pictureBox1, "失败"); pictureBox1.BackgroundImage = Properties.Resources.warning_48; break; case MergeSessionStatus.Interrupted: toolTip1.SetToolTip(pictureBox1, "中断"); pictureBox1.BackgroundImage = Properties.Resources.warning_48; break; case MergeSessionStatus.NotStarted: toolTip1.SetToolTip(pictureBox1, "未启动"); pictureBox1.BackgroundImage = Properties.Resources.warning_48; break; case MergeSessionStatus.Retry: toolTip1.SetToolTip(pictureBox1, "重试"); pictureBox1.BackgroundImage = Properties.Resources.warning_48; break; case MergeSessionStatus.Idle: toolTip1.SetToolTip(pictureBox1, "空闲"); pictureBox1.BackgroundImage = Properties.Resources.accepted_48; break; case MergeSessionStatus.Running: toolTip1.SetToolTip(pictureBox1, "运行中"); pictureBox1.BackgroundImage = Properties.Resources.accepted_48; break; case MergeSessionStatus.Starting: toolTip1.SetToolTip(pictureBox1, "正在启动"); pictureBox1.BackgroundImage = Properties.Resources.accepted_48; break; case MergeSessionStatus.Succeeded: toolTip1.SetToolTip(pictureBox1, "成功"); pictureBox1.BackgroundImage = Properties.Resources.accepted_48; break; default: break; } }
private void loadLastAgentSessionSummary() { // Create the connection and monitor objects. ServerConnection conn = new ServerConnection(Properties.Settings.Default.Subscriber); MergeSubscriberMonitor msmMonitor = new MergeSubscriberMonitor(conn); // Set subscription properties. msmMonitor.SubscriberDB = Properties.Settings.Default.SubscriptionDatabase; msmMonitor.Publisher = Properties.Settings.Default.Publisher; msmMonitor.PublisherDB = Properties.Settings.Default.PublicationDatabase; msmMonitor.Publication = Properties.Settings.Default.Publication; MergeSessionSummary s = msmMonitor.GetLastSessionSummary(); if (s == null) { return; } textBox1.Text = s.StartTime.ToString(); textBox2.Text = s.LastMessage; switch (s.Status) { case MergeSessionStatus.Failed: toolTip1.SetToolTip(pictureBox1, "失败"); pictureBox1.BackgroundImage = Properties.Resources.warning_48; break; case MergeSessionStatus.Interrupted: toolTip1.SetToolTip(pictureBox1, "中断"); pictureBox1.BackgroundImage = Properties.Resources.warning_48; break; case MergeSessionStatus.NotStarted: toolTip1.SetToolTip(pictureBox1, "未启动"); pictureBox1.BackgroundImage = Properties.Resources.warning_48; break; case MergeSessionStatus.Retry: toolTip1.SetToolTip(pictureBox1, "重试"); pictureBox1.BackgroundImage = Properties.Resources.warning_48; break; case MergeSessionStatus.Idle: toolTip1.SetToolTip(pictureBox1, "空闲"); pictureBox1.BackgroundImage = Properties.Resources.accepted_48; break; case MergeSessionStatus.Running: toolTip1.SetToolTip(pictureBox1, "运行中"); pictureBox1.BackgroundImage = Properties.Resources.accepted_48; break; case MergeSessionStatus.Starting: toolTip1.SetToolTip(pictureBox1, "正在启动"); pictureBox1.BackgroundImage = Properties.Resources.accepted_48; break; case MergeSessionStatus.Succeeded: toolTip1.SetToolTip(pictureBox1, "成功"); pictureBox1.BackgroundImage = Properties.Resources.accepted_48; break; default: break; } }