void ConnectCommand_() { if (!IsHostUsed) { try { Host = "ws://127.0.0.1:2012"; //DEBUG Connection = new SocketModel(Host); IsHostUsed = true; Connection.Opened += Socket_Opened; Connection.Open(); ConnectText = "Abort"; Status = "Connecting..."; } catch { Status = "Connection failed"; } } else { IsHostUsed = false; ConnectText = "Connect"; Status = "Connection aborted"; Connection.Opened -= Socket_Opened; Connection.Dispose(); } }