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/SlaveItem.cs

    r5599 r5795  
    3131  [Item("SlaveItem", "Represents a slave which receives messages from the core")]
    3232  public class SlaveItem : Item, ISlaveCommunicationCallbacks, IDisposable {
    33     ISlaveCommunication pipeProxy;
    34     DuplexChannelFactory<ISlaveCommunication> pipeFactory;
     33    private ISlaveCommunication pipeProxy;
     34    private DuplexChannelFactory<ISlaveCommunication> pipeFactory;
    3535
    3636    public SlaveItem() {
     
    6262
    6363    public void Open() {
    64       //TODO: read info from app.config
    65       pipeFactory = new DuplexChannelFactory<ISlaveCommunication>(this,
    66         new NetNamedPipeBinding(), new EndpointAddress("net.pipe://localhost/HeuristicLabSlaveCom"));
     64      pipeFactory = new DuplexChannelFactory<ISlaveCommunication>(this, "SlaveCommunicationServiceEndpoint");
     65      RegisterEvents();
     66    }
    6767
    68       pipeProxy = pipeFactory.CreateChannel();
    69       RegisterEvents();
    70 
     68    public bool ReconnectToSlaveCore() {
    7169      try {
     70        pipeProxy = pipeFactory.CreateChannel();
    7271        pipeProxy.Subscribe();
     72        return true;
    7373      }
    7474      catch (Exception e) {
    7575        OnMessageLogged("Couldn't connect to Slave core. Is it possible that the Slave Core isn't running?\nException is: " + e.ToString());
     76        return false;
    7677      }
    7778    }
    7879
    79     public void ReconnectToSlaveCore() {
    80       try {
    81         pipeProxy = pipeFactory.CreateChannel();
    82         pipeProxy.Subscribe();
    83       }
    84       catch (Exception e) {
    85         OnMessageLogged("Couldn't connect to Slave core. Is it possible that the Slave Core isn't running?\nException is: " + e.ToString());
    86       }
    87     }
    88 
    89     public bool isClosed() {
     80    public bool IsClosed() {
    9081      if (pipeFactory == null) return true;
    91       return pipeFactory.State == CommunicationState.Closed;
     82      return pipeFactory.State == CommunicationState.Closed || pipeFactory.State == CommunicationState.Faulted;
    9283    }
    9384
Note: See TracChangeset for help on using the changeset viewer.