private void RefreshSummary(MergeSessionSummary mssSummary) { if (mssSummary != null) { if (mssSummary.Status == MergeSessionStatus.Succeeded) { this.statusLabel.ImageIndex = 0; } this.statusLabel.Text = mssSummary.Status.ToString(); this.durationLabel.Text = (new TimeSpan(mssSummary.Duration * TimeSpan.TicksPerSecond).ToString()); this.uploadsLabel.Text = mssSummary.NumberOfUploads.ToString( System.Globalization.CultureInfo.InvariantCulture); this.downloadsLabel.Text = mssSummary.NumberOfDownloads.ToString( System.Globalization.CultureInfo.InvariantCulture); } else { this.statusLabel.Text = string.Empty; this.durationLabel.Text = string.Empty; this.uploadsLabel.Text = string.Empty; this.downloadsLabel.Text = string.Empty; } }
private void RefreshPane(MergeSessionSummary mssSummary) { RefreshSummary(mssSummary); lastMessageTextBox.Text = mssSummary != null ? mssSummary.LastMessage : string.Empty; RefreshDetails(mssSummary != null ? mssSummary.SessionId : -1); }
private void RefreshNodes(MergeSessionSummary[] rgMss) { int imageIndex = -1; this.summaryTreeView.BeginUpdate(); // Empty the Tree Nodes first this.summaryTreeView.Nodes.Clear(); if (rgMss == null) { return; } // Add the root node and the sessions as children TreeNode parent = new TreeNode(Properties.Resources.MergeSessions, 0, 0); parent.Tag = -1; foreach (MergeSessionSummary mss in rgMss) { switch (mss.Status) { case MergeSessionStatus.Succeeded: imageIndex = 1; break; case MergeSessionStatus.Running: imageIndex = 2; break; case MergeSessionStatus.Failed: imageIndex = 3; break; case MergeSessionStatus.Interrupted: imageIndex = 4; break; } TreeNode treeNode = new TreeNode(Properties.Resources.Completed + mss.StartTime.ToString(), imageIndex, imageIndex); treeNode.Tag = mss.SessionId; parent.Nodes.Add(treeNode); } this.summaryTreeView.Nodes.Add(parent); this.summaryTreeView.ExpandAll(); this.summaryTreeView.EndUpdate(); }
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; } }