예제 #1
0
        private void Instance_ConnectionFailed(object sender, ConnectFailedEventArgs e)
        {
            string message;

            switch (e.Reason)
            {
            case ConnectionFailure.AlreadyConnected:
                message = "You can only connect when not currently connected".Localize();
                break;

            case ConnectionFailure.UnsupportedBaudRate:
                message = "Unsupported Baud Rate".Localize();
                break;

            case ConnectionFailure.PortInUse:
                message = "Serial port in use".Localize();
                break;

            case ConnectionFailure.PortNotFound:
                message = "Port not found".Localize();
                break;

            case ConnectionFailure.PortUnavailable:
                message = "Port not available".Localize();
                break;

            case ConnectionFailure.ConnectionTimeout:
                message = "Connection timed out".Localize();
                break;

            default:
                message = "Unknown Reason".Localize();
                break;
            }

            this.WriteLine("Connection Failed".Localize() + ": " + message);

            this.WriteLine("Lost connection to printer");
        }
예제 #2
0
 private void client_ConnectFailed(ConnectFailedEventArgs e)
 {
     _isAuth = false;
     _connectionStatus = ServerConnectionStatus.Disconnected;
     ConnectError = string.Format("Connection to server failed: {0}:{1}", Server, Port);
     mre.Set();
     IsAuth = false;
     ConnectionStatus = ServerConnectionStatus.Disconnected;
 }
예제 #3
0
 private void Connection_ConnectFailed(object sender, ConnectFailedEventArgs e)
 {
     ConnectFailed.Fire(this, e);
 }
예제 #4
0
        private void Server_OnConnectFail(object sender, ConnectFailedEventArgs e)
        {
            AddLine(ServerStrings.ConnectionFailedMessage.With(SocketErrorTranslator.GetMessage(e.SocketErrorCode)));

            ThreadHelper.InvokeAfter(TimeSpan.FromSeconds(4), delegate { server.Connect(); });
        }