- Timestamp:
- 09/12/11 18:04:25 (13 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/JobsView.cs
r6734 r6743 59 59 #region Event Handlers 60 60 void Content_SlaveStatusChanged(object sender, Common.EventArgs<StatusCommons> e) { 61 lstJobs.Items.Clear(); 62 foreach (TaskStatus job in e.Value.Jobs) { 63 ListViewItem item = new ListViewItem(); 64 item.Text = job.TaskId.ToString(); 65 item.SubItems.Add(job.ExecutionTime.ToString()); 66 lstJobs.Items.Add(item); 61 if (InvokeRequired) { 62 Action<object, Common.EventArgs<StatusCommons>> action = new Action<object, Common.EventArgs<StatusCommons>>(Content_SlaveStatusChanged); 63 Invoke(action, sender, e); 64 } else { 65 lstJobs.Items.Clear(); 66 foreach (TaskStatus job in e.Value.Jobs) { 67 ListViewItem item = new ListViewItem(); 68 item.Text = job.TaskId.ToString(); 69 item.SubItems.Add(job.ExecutionTime.ToString()); 70 lstJobs.Items.Add(item); 71 } 72 lstJobs.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); 67 73 } 68 lstJobs.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);69 74 } 70 75 #endregion -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/LogView.cs
r6734 r6743 69 69 #region Event Handlers 70 70 void Content_SlaveMessageLogged(object sender, EventArgs<string> e) { 71 txtLog.AppendText(e.Value + Environment.NewLine); 71 if (txtLog.InvokeRequired) { 72 txtLog.Invoke(new Action<string>(txtLog.AppendText), e.Value + Environment.NewLine); 73 } else { 74 txtLog.AppendText(e.Value + Environment.NewLine); 75 } 72 76 } 73 77 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/SlaveCmdsWithKill.cs
r6734 r6743 65 65 #region Register Content Events 66 66 protected override void DeregisterContentEvents() { 67 68 69 67 base.DeregisterContentEvents(); 70 68 } … … 173 171 protected override void SetEnabledStateOfControls() { 174 172 base.SetEnabledStateOfControls(); 175 //do nothing at the moment, we have nothing editable176 173 } 177 174 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/SlaveItem.cs
r6725 r6743 65 65 66 66 void pipeFactory_Opened(object sender, EventArgs e) { 67 OnMessageLogged("Connection to Slave core established");67 OnMessageLogged("Connection to Slave core opened"); 68 68 OnCoreConnectionChanged(CoreConnection.Connected); 69 69 } … … 188 188 var handler = SlaveDisplayStateChanged; 189 189 if (handler != null) handler(this, new EventArgs<SlaveDisplayStat>(stat)); 190 191 190 } 192 191 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/SlaveMainViewBase.cs
r6734 r6743 76 76 if (Content != null) { 77 77 Content.UserVisibleMessageFired += new System.EventHandler<Common.EventArgs<string>>(Content_UserVisibleMessageFired); 78 ((SlaveItem)base.Content).Open();79 78 Task.Factory.StartNew(Connector); 80 79 } … … 106 105 107 106 private void Connector() { 107 ((SlaveItem)base.Content).Open(); 108 108 bool connected = false; 109 109 while (!connected) { 110 this.Invoke(new Func<bool>(() => connected = ((SlaveItem)base.Content).ReconnectToSlaveCore()));110 connected = ((SlaveItem)base.Content).ReconnectToSlaveCore(); 111 111 112 112 if (!connected) { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/SlaveMainViewTray.cs
r6734 r6743 22 22 using System.Windows.Forms; 23 23 using HeuristicLab.MainForm; 24 25 24 26 25 namespace HeuristicLab.Clients.Hive.SlaveCore.Views { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/SlaveStats.cs
r6734 r6743 35 35 private SlaveDisplayStat lastSlaveDisplayStat; 36 36 37 38 37 public new SlaveItem Content { 39 38 get { return (SlaveItem)base.Content; } … … 56 55 Content.SlaveStatusChanged -= new System.EventHandler<EventArgs<StatusCommons>>(Content_SlaveStatusChanged); 57 56 Content.SlaveDisplayStateChanged -= new EventHandler<EventArgs<SlaveDisplayStat>>(Content_SlaveDisplayStateChanged); 58 Content.CoreConnectionChanged -= new EventHandler<EventArgs<CoreConnection>>(Content_CoreConnectionChanged);59 57 60 58 base.DeregisterContentEvents(); … … 66 64 Content.SlaveStatusChanged += new System.EventHandler<EventArgs<StatusCommons>>(Content_SlaveStatusChanged); 67 65 Content.SlaveDisplayStateChanged += new EventHandler<EventArgs<SlaveDisplayStat>>(Content_SlaveDisplayStateChanged); 68 Content.CoreConnectionChanged += new EventHandler<EventArgs<CoreConnection>>(Content_CoreConnectionChanged);69 66 } 70 67 #endregion … … 80 77 #region Event Handlers 81 78 void Content_SlaveStatusChanged(object sender, EventArgs<StatusCommons> e) { 82 RenderJobChart(e.Value); 83 RenderCoreChart(e.Value); 79 if (InvokeRequired) { 80 Action<object, EventArgs<StatusCommons>> action = new Action<object, EventArgs<StatusCommons>>(Content_SlaveStatusChanged); 81 Invoke(action, sender, e); 82 } else { 83 RenderJobChart(e.Value); 84 RenderCoreChart(e.Value); 85 } 84 86 } 85 87 86 88 void Content_SlaveDisplayStateChanged(object sender, EventArgs<SlaveDisplayStat> e) { 87 lblSlaveState.Text = e.Value.ToString(); 88 lastSlaveDisplayStat = e.Value; 89 } 90 91 void Content_CoreConnectionChanged(object sender, EventArgs<CoreConnection> e) { 92 89 if (InvokeRequired) { 90 Action<object, EventArgs<SlaveDisplayStat>> action = new Action<object, EventArgs<SlaveDisplayStat>>(Content_SlaveDisplayStateChanged); 91 Invoke(action, sender, e); 92 } else { 93 lblSlaveState.Text = e.Value.ToString(); 94 lastSlaveDisplayStat = e.Value; 95 } 93 96 } 94 97 #endregion 95 98 96 99 private void RenderJobChart(StatusCommons status) { 97 jobChart.Series[0].Points.Clear(); 98 jobChart.Series[1].Points.Clear(); 99 jobChart.Series[2].Points.Clear(); 100 jobChart.Series[3].Points.Clear(); 101 jobChart.Series[4].Points.Clear(); 100 if (InvokeRequired) { 101 Invoke(new Action<StatusCommons>(RenderJobChart), status); 102 } else { 103 jobChart.Series[0].Points.Clear(); 104 jobChart.Series[1].Points.Clear(); 105 jobChart.Series[2].Points.Clear(); 106 jobChart.Series[3].Points.Clear(); 107 jobChart.Series[4].Points.Clear(); 102 108 103 109 104 DataPoint pJobs = new DataPoint(1, status.Jobs.Count);105 DataPoint pJobsAborted = new DataPoint(2, status.JobsAborted);106 DataPoint pJobsDone = new DataPoint(3, status.JobsFinished);107 DataPoint pJobsFetched = new DataPoint(4, status.JobsFetched);108 DataPoint pJobsFailed = new DataPoint(5, status.JobsFailed);110 DataPoint pJobs = new DataPoint(1, status.Jobs.Count); 111 DataPoint pJobsAborted = new DataPoint(2, status.JobsAborted); 112 DataPoint pJobsDone = new DataPoint(3, status.JobsFinished); 113 DataPoint pJobsFetched = new DataPoint(4, status.JobsFetched); 114 DataPoint pJobsFailed = new DataPoint(5, status.JobsFailed); 109 115 110 pJobs.LegendText = "Current jobs: " + status.Jobs.Count;111 pJobs.Color = System.Drawing.Color.Yellow;112 pJobs.ToolTip = pJobs.LegendText;113 jobChart.Series[0].Color = System.Drawing.Color.Yellow;114 jobChart.Series[0].LegendText = pJobs.LegendText;115 jobChart.Series[0].Points.Add(pJobs);116 pJobs.LegendText = "Current jobs: " + status.Jobs.Count; 117 pJobs.Color = System.Drawing.Color.Yellow; 118 pJobs.ToolTip = pJobs.LegendText; 119 jobChart.Series[0].Color = System.Drawing.Color.Yellow; 120 jobChart.Series[0].LegendText = pJobs.LegendText; 121 jobChart.Series[0].Points.Add(pJobs); 116 122 117 pJobsAborted.LegendText = "Aborted jobs: " + status.JobsAborted;118 pJobsAborted.Color = System.Drawing.Color.Orange;119 pJobsAborted.ToolTip = pJobsAborted.LegendText;120 jobChart.Series[1].Color = System.Drawing.Color.Orange;121 jobChart.Series[1].LegendText = pJobsAborted.LegendText;122 jobChart.Series[1].Points.Add(pJobsAborted);123 pJobsAborted.LegendText = "Aborted jobs: " + status.JobsAborted; 124 pJobsAborted.Color = System.Drawing.Color.Orange; 125 pJobsAborted.ToolTip = pJobsAborted.LegendText; 126 jobChart.Series[1].Color = System.Drawing.Color.Orange; 127 jobChart.Series[1].LegendText = pJobsAborted.LegendText; 128 jobChart.Series[1].Points.Add(pJobsAborted); 123 129 124 pJobsDone.LegendText = "Finished jobs: " + status.JobsFinished;125 pJobsDone.Color = System.Drawing.Color.Green;126 pJobsDone.ToolTip = pJobsDone.LegendText;127 jobChart.Series[2].Color = System.Drawing.Color.Green;128 jobChart.Series[2].LegendText = pJobsDone.LegendText;129 jobChart.Series[2].Points.Add(pJobsDone);130 pJobsDone.LegendText = "Finished jobs: " + status.JobsFinished; 131 pJobsDone.Color = System.Drawing.Color.Green; 132 pJobsDone.ToolTip = pJobsDone.LegendText; 133 jobChart.Series[2].Color = System.Drawing.Color.Green; 134 jobChart.Series[2].LegendText = pJobsDone.LegendText; 135 jobChart.Series[2].Points.Add(pJobsDone); 130 136 131 pJobsFetched.LegendText = "Fetched jobs: " + status.JobsFetched;132 pJobsFetched.ToolTip = pJobsFetched.LegendText;133 pJobsFetched.Color = System.Drawing.Color.Blue;134 jobChart.Series[3].Color = System.Drawing.Color.Blue;135 jobChart.Series[3].LegendText = pJobsFetched.LegendText;136 jobChart.Series[3].Points.Add(pJobsFetched);137 pJobsFetched.LegendText = "Fetched jobs: " + status.JobsFetched; 138 pJobsFetched.ToolTip = pJobsFetched.LegendText; 139 pJobsFetched.Color = System.Drawing.Color.Blue; 140 jobChart.Series[3].Color = System.Drawing.Color.Blue; 141 jobChart.Series[3].LegendText = pJobsFetched.LegendText; 142 jobChart.Series[3].Points.Add(pJobsFetched); 137 143 138 pJobsFailed.LegendText = "Failed jobs: " + status.JobsFailed; 139 pJobsFailed.ToolTip = pJobsFailed.LegendText; 140 pJobsFailed.Color = System.Drawing.Color.Red; 141 jobChart.Series[4].Color = System.Drawing.Color.Red; 142 jobChart.Series[4].LegendText = pJobsFailed.LegendText; 143 jobChart.Series[4].Points.Add(pJobsFailed); 144 pJobsFailed.LegendText = "Failed jobs: " + status.JobsFailed; 145 pJobsFailed.ToolTip = pJobsFailed.LegendText; 146 pJobsFailed.Color = System.Drawing.Color.Red; 147 jobChart.Series[4].Color = System.Drawing.Color.Red; 148 jobChart.Series[4].LegendText = pJobsFailed.LegendText; 149 jobChart.Series[4].Points.Add(pJobsFailed); 150 } 144 151 } 145 152 146 153 private void RenderCoreChart(StatusCommons statusCommons) { 147 int usedCores = statusCommons.TotalCores - statusCommons.FreeCores; 148 DataPoint pFreeCores = new DataPoint(statusCommons.FreeCores, statusCommons.FreeCores); 149 DataPoint pUsedCores = new DataPoint(usedCores, usedCores); 154 if (InvokeRequired) { 155 Invoke(new Action<StatusCommons>(RenderCoreChart), statusCommons); 156 } else { 157 int usedCores = statusCommons.TotalCores - statusCommons.FreeCores; 158 DataPoint pFreeCores = new DataPoint(statusCommons.FreeCores, statusCommons.FreeCores); 159 DataPoint pUsedCores = new DataPoint(usedCores, usedCores); 150 160 151 coresChart.Series[0].Points.Clear();161 coresChart.Series[0].Points.Clear(); 152 162 153 pFreeCores.LegendText = "Free cores: " + statusCommons.FreeCores;154 pFreeCores.Color = System.Drawing.Color.Green;155 pUsedCores.LegendText = "Used cores: " + usedCores;156 pUsedCores.Color = System.Drawing.Color.Red;163 pFreeCores.LegendText = "Free cores: " + statusCommons.FreeCores; 164 pFreeCores.Color = System.Drawing.Color.Green; 165 pUsedCores.LegendText = "Used cores: " + usedCores; 166 pUsedCores.Color = System.Drawing.Color.Red; 157 167 158 coresChart.Series[0].Points.Add(pFreeCores); 159 coresChart.Series[0].Points.Add(pUsedCores); 168 coresChart.Series[0].Points.Add(pFreeCores); 169 coresChart.Series[0].Points.Add(pUsedCores); 170 } 160 171 } 161 172 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/SlaveViewTray.cs
r6734 r6743 37 37 #region Register Content Events 38 38 protected override void DeregisterContentEvents() { 39 40 39 base.DeregisterContentEvents(); 41 40 } … … 43 42 protected override void RegisterContentEvents() { 44 43 base.RegisterContentEvents(); 45 46 47 44 } 48 45 #endregion
Note: See TracChangeset
for help on using the changeset viewer.