public void startService() { try { messageHandler = new transportClient.NewMsgHandler(newMessageRecived); signHandler = new transportClient.NewSignalization(newSignalization); client = new transportClient(CloudIP, CloudPort); client.OnNewMessageRecived += messageHandler; client.OnNewSignalization += signHandler; client.sendMessage(nodeName + "#"); displayStatusMessage(Constants.SERVICE_START_OK, Constants.LOG_INFO); } catch { displayStatusMessage(Constants.SERVICE_START_ERROR, Constants.LOG_ERROR); } if (this.isStarted()) { this.mainWindow.ConnectButton.IsEnabled = false; this.mainWindow.statusBar.Text = "Connected"; this.mainWindow.Button_1.IsEnabled = true; this.mainWindow.statusBar.Foreground = Brushes.Green; } }
public void startService() { try { cloud = new transportClient(CloudIP, CloudPort); signalizationNetwork = new transportClient(CloudIP, CloudPort); newMessageHandler = new transportClient.NewMsgHandler(newMessageRecived); orderListener = new transportClient.NewMsgHandler(newControlOrder); signHandler = new transportClient.NewSignalization(newSignalization); cloud.OnNewSignalization += signHandler; cloud.OnNewMessageRecived += newMessageHandler; signalizationNetwork.OnNewMessageRecived += orderListener; cloud.sendMessage(this.NodeId + "#"); signalizationNetwork.sendMessage(this.NodeId + "@CallControll#"); Thread.Sleep(500); signalizationNetwork.sendMessage(this.networkController + "@CallControll#MyParams#" + this.NodeId); addLog(logs, Constants.SERVICE_START_OK, Constants.LOG_INFO); this.STM = new SynchronousTransportModule[portsOutTemp.Count]; for (int i = 0; i < STM.Length; i++) { this.STM[i] = new SynchronousTransportModule(3);// TUTAJ DODAC JESZCZE PARAMETR Z XMLA } startSending(); manager = new transportClient(ManagerIP, ManagerPort); newOrderHandler = new transportClient.NewMsgHandler(newOrderRecived); manager.OnNewMessageRecived += newOrderHandler; } catch { addLog(logs, Constants.SERVICE_START_ERROR, Constants.LOG_ERROR); if (cloud == null) { addLog(logs, Constants.CANNOT_CONNECT_TO_CLOUD, Constants.LOG_ERROR); } else if (!cloud.isConnected()) { addLog(logs, Constants.CANNOT_CONNECT_TO_CLOUD, Constants.LOG_ERROR); } if (manager == null) { addLog(logs, Constants.CANNOT_CONNECT_TO_MANAGER, Constants.LOG_ERROR); } else if (!manager.isConnected()) { addLog(logs, Constants.CANNOT_CONNECT_TO_MANAGER, Constants.LOG_ERROR); } } }
public void stopService() { try { client.OnNewMessageRecived -= messageHandler; client.OnNewSignalization -= signHandler; messageHandler = null; signHandler = null; client.stopService(); client = null; } catch { } }
public void startService() { try { messageHandler = new transportClient.NewMsgHandler(newMessageRecived); signHandler = new transportClient.NewSignalization(newSignalization); client = new transportClient(CloudIP, CloudPort); client.OnNewMessageRecived += messageHandler; client.OnNewSignalization += signHandler; client.sendMessage(nodeName + "#"); displayStatusMessage(Constants.SERVICE_START_OK, Constants.LOG_INFO); } catch { displayStatusMessage(Constants.SERVICE_START_ERROR, Constants.LOG_ERROR); } }
public void stopService() { try { client.OnNewMessageRecived -= messageHandler; client.OnNewSignalization -= signHandler; messageHandler = null; signHandler = null; client.stopService(); client = null; } catch { } }
public void startService() { try { messageHandler = new transportClient.NewMsgHandler(newMessageRecived); signHandler = new transportClient.NewSignalization(newSignalization); client = new transportClient(CloudIP, CloudPort); client.OnNewMessageRecived += messageHandler; client.OnNewSignalization += signHandler; client.sendMessage(nodeName + "#"); displayStatusMessage(Constants.SERVICE_START_OK, Constants.LOG_INFO); } catch { displayStatusMessage(Constants.SERVICE_START_ERROR, Constants.LOG_ERROR); } if (this.isStarted()) { this.mainWindow.ConnectButton.IsEnabled = false; this.mainWindow.statusBar.Text = "Connected"; this.mainWindow.Button_1.IsEnabled = true; this.mainWindow.statusBar.Foreground = Brushes.Green; } }
private void newSignalization(object a, MessageArgs e) { addLog(logs, e.message, Constants.LOG_ERROR); this.mainWindow.Dispatcher.Invoke( System.Windows.Threading.DispatcherPriority.Normal, new Action(() => { this.mainWindow.startButton.IsEnabled = true; }) ); cloud.OnNewMessageRecived -= newMessageHandler; cloud.OnNewSignalization -= signHandler; newMessageHandler = null; signHandler = null; cloud.stopService(); cloud = null; }
public void stopService() { try { if (cloud != null) { cloud.OnNewMessageRecived -= newMessageHandler; cloud.OnNewSignalization -= signHandler; signalizationNetwork.OnNewMessageRecived -= orderListener; manager.OnNewMessageRecived -= newOrderHandler; signHandler = null; newMessageHandler = null; newOrderHandler = null; orderListener = null; cloud.stopService(); cloud = null; manager.stopService(); manager = null; signalizationNetwork.stopService(); signalizationNetwork = null; } } catch { cloud.OnNewMessageRecived -= newMessageHandler; cloud.OnNewSignalization -= signHandler; manager.OnNewMessageRecived -= newOrderHandler; signHandler = null; newMessageHandler = null; newOrderHandler = null; cloud = null; manager = null; } }
public void startService() { try { cloud = new transportClient(CloudIP, CloudPort); signalizationNetwork = new transportClient(CloudIP, CloudPort); newMessageHandler = new transportClient.NewMsgHandler(newMessageRecived); orderListener = new transportClient.NewMsgHandler(newControlOrder); signHandler = new transportClient.NewSignalization(newSignalization); cloud.OnNewSignalization += signHandler; cloud.OnNewMessageRecived += newMessageHandler; signalizationNetwork.OnNewMessageRecived += orderListener; cloud.sendMessage(this.NodeId + "#"); signalizationNetwork.sendMessage(this.NodeId + "@CallControll#"); Thread.Sleep(500); signalizationNetwork.sendMessage(this.networkController+"@CallControll#MyParams#" + this.NodeId); addLog(logs, Constants.SERVICE_START_OK, Constants.LOG_INFO); this.STM = new SynchronousTransportModule[portsOutTemp.Count]; for (int i = 0; i < STM.Length; i++) { this.STM[i] = new SynchronousTransportModule(3);// TUTAJ DODAC JESZCZE PARAMETR Z XMLA } startSending(); manager = new transportClient(ManagerIP, ManagerPort); newOrderHandler = new transportClient.NewMsgHandler(newOrderRecived); manager.OnNewMessageRecived += newOrderHandler; } catch { addLog(logs, Constants.SERVICE_START_ERROR, Constants.LOG_ERROR); if(cloud==null) addLog(logs, Constants.CANNOT_CONNECT_TO_CLOUD, Constants.LOG_ERROR); else if(!cloud.isConnected()) addLog(logs, Constants.CANNOT_CONNECT_TO_CLOUD, Constants.LOG_ERROR); if(manager==null) addLog(logs, Constants.CANNOT_CONNECT_TO_MANAGER, Constants.LOG_ERROR); else if(!manager.isConnected()) addLog(logs, Constants.CANNOT_CONNECT_TO_MANAGER, Constants.LOG_ERROR); } }
public void startService() { try { messageHandler = new transportClient.NewMsgHandler(newMessageRecived); signHandler = new transportClient.NewSignalization(newSignalization); client = new transportClient(CloudIP, CloudPort); client.OnNewMessageRecived += messageHandler; client.OnNewSignalization += signHandler; client.sendMessage(nodeName + "#"); displayStatusMessage(Constants.SERVICE_START_OK, Constants.LOG_INFO); } catch { displayStatusMessage(Constants.SERVICE_START_ERROR, Constants.LOG_ERROR); } }