public NodeMasterViewModel(NodeConfig config) { m_Config = config; Name = m_Config.Name; ConnectCommand = new DelegateCommand(ExecuteConnectCommand); try { m_WebSocket = new AgentWebSocket(config.Uri); } catch (Exception e) { ErrorMessage = e.Message; return; } #if !SILVERLIGHT m_WebSocket.AllowUnstrustedCertificate = true; m_WebSocket.Closed += new EventHandler(WebSocket_Closed); m_WebSocket.Error += new EventHandler <ClientEngine.ErrorEventArgs>(WebSocket_Error); m_WebSocket.Opened += new EventHandler(WebSocket_Opened); m_WebSocket.On <string>(CommandName.UPDATE, OnServerUpdated); #else m_WebSocket.ClientAccessPolicyProtocol = System.Net.Sockets.SocketClientAccessPolicyProtocol.Tcp; m_WebSocket.Closed += new EventHandler(CreateAsyncOperation <object, EventArgs>(WebSocket_Closed)); m_WebSocket.Error += new EventHandler <ClientEngine.ErrorEventArgs>(CreateAsyncOperation <object, ClientEngine.ErrorEventArgs>(WebSocket_Error)); m_WebSocket.Opened += new EventHandler(CreateAsyncOperation <object, EventArgs>(WebSocket_Opened)); m_WebSocket.On <string>(CommandName.UPDATE, OnServerUpdatedAsync); #endif StartConnect(); }
void InitializeWebSocket(NodeConfig config) { try { m_WebSocket = new AgentWebSocket(config.Uri); } catch (Exception) { ErrorMessage = "Invalid server URI!"; State = NodeState.Offline; return; } #if !SILVERLIGHT m_WebSocket.AllowUnstrustedCertificate = true; m_WebSocket.Closed += new EventHandler(WebSocket_Closed); m_WebSocket.Error += new EventHandler <ClientEngine.ErrorEventArgs>(WebSocket_Error); m_WebSocket.Opened += new EventHandler(WebSocket_Opened); m_WebSocket.On <string>(CommandName.UPDATE, OnServerUpdated); #else m_WebSocket.ClientAccessPolicyProtocol = System.Net.Sockets.SocketClientAccessPolicyProtocol.Tcp; m_WebSocket.Closed += new EventHandler(WebSocket_Closed); m_WebSocket.Error += new EventHandler <ClientEngine.ErrorEventArgs>(WebSocket_Error); m_WebSocket.Opened += new EventHandler(WebSocket_Opened); m_WebSocket.On <string>(CommandName.UPDATE, OnServerUpdatedAsync); #endif StartConnect(); }
void InitializeWebSocket(NodeConfig config) { try { m_WebSocket = new AgentWebSocket(config.Uri); } catch (Exception) { ErrorMessage = "Invalid server URI!"; State = NodeState.Offline; return; } #if !SILVERLIGHT m_WebSocket.AllowUnstrustedCertificate = true; m_WebSocket.Closed += new EventHandler(WebSocket_Closed); m_WebSocket.Error += new EventHandler<ClientEngine.ErrorEventArgs>(WebSocket_Error); m_WebSocket.Opened += new EventHandler(WebSocket_Opened); m_WebSocket.On<string>(CommandName.UPDATE, OnServerUpdated); #else m_WebSocket.ClientAccessPolicyProtocol = System.Net.Sockets.SocketClientAccessPolicyProtocol.Tcp; m_WebSocket.Closed += new EventHandler(WebSocket_Closed); m_WebSocket.Error += new EventHandler<ClientEngine.ErrorEventArgs>(WebSocket_Error); m_WebSocket.Opened += new EventHandler(WebSocket_Opened); m_WebSocket.On<string>(CommandName.UPDATE, OnServerUpdatedAsync); #endif StartConnect(); }
public NodeMasterViewModel(NodeConfig config) { m_Config = config; Name = m_Config.Name; ConnectCommand = new DelegateCommand(ExecuteConnectCommand); try { m_WebSocket = new AgentWebSocket(config.Uri); } catch (Exception e) { ErrorMessage = e.Message; return; } #if !SILVERLIGHT m_WebSocket.AllowUnstrustedCertificate = true; m_WebSocket.Closed += new EventHandler(WebSocket_Closed); m_WebSocket.Error += new EventHandler<ClientEngine.ErrorEventArgs>(WebSocket_Error); m_WebSocket.Opened += new EventHandler(WebSocket_Opened); m_WebSocket.On<string>(CommandName.UPDATE, OnServerUpdated); #else m_WebSocket.ClientAccessPolicyProtocol = System.Net.Sockets.SocketClientAccessPolicyProtocol.Tcp; m_WebSocket.Closed += new EventHandler(CreateAsyncOperation<object, EventArgs>(WebSocket_Closed)); m_WebSocket.Error += new EventHandler<ClientEngine.ErrorEventArgs>(CreateAsyncOperation<object, ClientEngine.ErrorEventArgs>(WebSocket_Error)); m_WebSocket.Opened += new EventHandler(CreateAsyncOperation<object, EventArgs>(WebSocket_Opened)); m_WebSocket.On<string>(CommandName.UPDATE, OnServerUpdatedAsync); #endif StartConnect(); }
void InitializeWebSocket(NodeConfig config) { try { m_WebSocket = new AgentWebSocket(config.Uri); } catch (Exception) { ErrorMessage = "Invalid server URI!"; State = NodeState.Offline; return; } m_WebSocket.AllowUnstrustedCertificate = true; m_WebSocket.Closed += new EventHandler(WebSocket_Closed); m_WebSocket.Error += new EventHandler <ClientEngine.ErrorEventArgs>(WebSocket_Error); m_WebSocket.Opened += new EventHandler(WebSocket_Opened); m_WebSocket.On <string>(CommandName.UPDATE, OnServerUpdated); StartConnect(); }