Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/22/11 16:44:28 (13 years ago)
Author:
ascheibe
Message:

#1233 various slave and slave tray icon improvements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Views/3.4/SlaveView.cs

    r5789 r5795  
    2020#endregion
    2121
     22using System;
     23using System.Threading;
     24using System.Threading.Tasks;
    2225using System.Windows.Forms;
    2326using System.Windows.Forms.DataVisualization.Charting;
     
    7073      } else {
    7174        //try to establish a connection to the slave service
    72         if (base.Content != null && ((SlaveItem)base.Content).isClosed()) {
     75        if (base.Content != null) {
    7376          ((SlaveItem)base.Content).Open();
     77          Task.Factory.StartNew(Connector);
    7478        }
    7579      }
     80    }
     81
     82    private void Connector() {
     83      bool connected = false;
     84      while (!connected) {
     85        this.Invoke(new Func<bool>(() => connected = ((SlaveItem)base.Content).ReconnectToSlaveCore()));
     86
     87        if (!connected) {
     88          Thread.Sleep(1000);
     89        }
     90      }
     91      this.Invoke(new Action(SetEnabledStateOfControls));
    7692    }
    7793
     
    89105    void Content_SlaveShutdown(object sender, System.EventArgs e) {
    90106      txtLog.AppendText("Slave did shutdown\n");
     107      Task.Factory.StartNew(Connector);
    91108    }
    92109
Note: See TracChangeset for help on using the changeset viewer.