Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/12/11 18:04:25 (13 years ago)
Author:
ascheibe
Message:

#1233

  • fixed a bug in the Slave UI
  • finished renaming Webservice and Dao methods to be consistent with Job/Task naming
  • some cosmetic changes and project dependencies cleanups
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  
    5959    #region Event Handlers
    6060    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);
    6773      }
    68       lstJobs.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
    6974    }
    7075    #endregion
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/LogView.cs

    r6734 r6743  
    6969    #region Event Handlers
    7070    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      }
    7276    }
    7377
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/SlaveCmdsWithKill.cs

    r6734 r6743  
    6565    #region Register Content Events
    6666    protected override void DeregisterContentEvents() {
    67 
    68 
    6967      base.DeregisterContentEvents();
    7068    }
     
    173171    protected override void SetEnabledStateOfControls() {
    174172      base.SetEnabledStateOfControls();
    175       //do nothing at the moment, we have nothing editable
    176173    }
    177174
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/SlaveItem.cs

    r6725 r6743  
    6565
    6666    void pipeFactory_Opened(object sender, EventArgs e) {
    67       OnMessageLogged("Connection to Slave core established");
     67      OnMessageLogged("Connection to Slave core opened");
    6868      OnCoreConnectionChanged(CoreConnection.Connected);
    6969    }
     
    188188      var handler = SlaveDisplayStateChanged;
    189189      if (handler != null) handler(this, new EventArgs<SlaveDisplayStat>(stat));
    190 
    191190    }
    192191
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/SlaveMainViewBase.cs

    r6734 r6743  
    7676      if (Content != null) {
    7777        Content.UserVisibleMessageFired += new System.EventHandler<Common.EventArgs<string>>(Content_UserVisibleMessageFired);
    78         ((SlaveItem)base.Content).Open();
    7978        Task.Factory.StartNew(Connector);
    8079      }
     
    106105
    107106    private void Connector() {
     107      ((SlaveItem)base.Content).Open();
    108108      bool connected = false;
    109109      while (!connected) {
    110         this.Invoke(new Func<bool>(() => connected = ((SlaveItem)base.Content).ReconnectToSlaveCore()));
     110        connected = ((SlaveItem)base.Content).ReconnectToSlaveCore();
    111111
    112112        if (!connected) {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/SlaveMainViewTray.cs

    r6734 r6743  
    2222using System.Windows.Forms;
    2323using HeuristicLab.MainForm;
    24 
    2524
    2625namespace HeuristicLab.Clients.Hive.SlaveCore.Views {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/SlaveStats.cs

    r6734 r6743  
    3535    private SlaveDisplayStat lastSlaveDisplayStat;
    3636
    37 
    3837    public new SlaveItem Content {
    3938      get { return (SlaveItem)base.Content; }
     
    5655      Content.SlaveStatusChanged -= new System.EventHandler<EventArgs<StatusCommons>>(Content_SlaveStatusChanged);
    5756      Content.SlaveDisplayStateChanged -= new EventHandler<EventArgs<SlaveDisplayStat>>(Content_SlaveDisplayStateChanged);
    58       Content.CoreConnectionChanged -= new EventHandler<EventArgs<CoreConnection>>(Content_CoreConnectionChanged);
    5957
    6058      base.DeregisterContentEvents();
     
    6664      Content.SlaveStatusChanged += new System.EventHandler<EventArgs<StatusCommons>>(Content_SlaveStatusChanged);
    6765      Content.SlaveDisplayStateChanged += new EventHandler<EventArgs<SlaveDisplayStat>>(Content_SlaveDisplayStateChanged);
    68       Content.CoreConnectionChanged += new EventHandler<EventArgs<CoreConnection>>(Content_CoreConnectionChanged);
    6966    }
    7067    #endregion
     
    8077    #region Event Handlers
    8178    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      }
    8486    }
    8587
    8688    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      }
    9396    }
    9497    #endregion
    9598
    9699    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();
    102108
    103109
    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);
    109115
    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);
    116122
    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);
    123129
    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);
    130136
    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);
    137143
    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      }
    144151    }
    145152
    146153    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);
    150160
    151       coresChart.Series[0].Points.Clear();
     161        coresChart.Series[0].Points.Clear();
    152162
    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;
    157167
    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      }
    160171    }
    161172  }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/SlaveViewTray.cs

    r6734 r6743  
    3737    #region Register Content Events
    3838    protected override void DeregisterContentEvents() {
    39 
    4039      base.DeregisterContentEvents();
    4140    }
     
    4342    protected override void RegisterContentEvents() {
    4443      base.RegisterContentEvents();
    45 
    46 
    4744    }
    4845    #endregion
Note: See TracChangeset for help on using the changeset viewer.