public void Status() { string opId = ""; if (nodes != null) { foreach (KeyValuePair <string, OperatorNode> pair in nodes) { try { opId = pair.Key; OperatorNode node = pair.Value; PuppetMasterAsyncVoidDelegate remoteDel = new PuppetMasterAsyncVoidDelegate(node.Status); AsyncCallback puppetCallback = new AsyncCallback(PuppetMasterCommandsVoidAsyncCallBack); remoteDel.BeginInvoke(puppetCallback, null); } catch (NullReferenceException) { Console.WriteLine($"Due to unexpected problems puppet master couldn't invoke Status on operator {opId}."); } catch (SocketException e) { Console.WriteLine($"Due to connection problems puppet master couldn't invoke Status on operator {opId}."); } } } }
public void Start(string opId) { try { if (nodes != null && nodes[opId] != null) { PuppetMasterAsyncVoidDelegate remoteDel = new PuppetMasterAsyncVoidDelegate(nodes[opId].Start); AsyncCallback puppetCallback = new AsyncCallback(PuppetMasterCommandsVoidAsyncCallBack); remoteDel.BeginInvoke(puppetCallback, null); } } catch (KeyNotFoundException knfe) { Console.WriteLine($"Puppet master could not find operator {opId}"); } catch (SocketException se) { Console.WriteLine($"Due to connection problems, puppet master couldn't invoke Start on operator {opId} "); } }