Example #1
0
 public void TestConnectionCallback(PlinkStatus plinkStatus)
 {
     if (TestConnectionCallbackEvent != null)
     {
         TestConnectionCallbackEvent(this, plinkStatus);
     }
 }
Example #2
0
        private static void HandlePlinkError(PlinkStatus plinkStatus, bool testConnection)
        {
            if (!testConnection)
            {
                TunnelHelper.CurrentTunnelStatus = TunnelStatuses.Paused;
                WcfServerHelper.BroadcastRemoteCallback(x => x.TunnelStatusChanged(TunnelStatuses.Paused));
                StopPlink();
            }
            else if (!_process.HasExited)
            {
                _process.Kill();
            }

            WcfServerHelper.BroadcastRemoteCallback(x => x.TestConnectionCallback(plinkStatus));
        }
        private static void HandlePlinkError(PlinkStatus plinkStatus, bool testConnection)
        {
            if (!testConnection)
            {
                TunnelHelper.CurrentTunnelStatus = TunnelStatuses.Paused;
                WcfServerHelper.BroadcastRemoteCallback(x => x.TunnelStatusChanged(TunnelStatuses.Paused));
                StopPlink();
            }
            else if (!_process.HasExited)
            {
                _process.Kill();
            }

            WcfServerHelper.BroadcastRemoteCallback(x => x.TestConnectionCallback(plinkStatus));
        }
        private void ServiceRemotingCallback_TestConnectionCallbackEvent(object sender, PlinkStatus plinkStatus)
        {
            HideLoadingTestConnection();

            string messageText = "";
            MessageBoxIcon messageBoxIcon = MessageBoxIcon.Warning;

            switch (plinkStatus)
            {
                case PlinkStatus.Success:
                    messageText = "Success!";
                    messageBoxIcon = MessageBoxIcon.Information;
                    break;

                case PlinkStatus.ExecutableNotFound:
                    messageText = "Plink.exe was not found";
                    break;

                case PlinkStatus.ExecutableNotRecognized:
                    messageText = "Plink.exe executable was not recognized";
                    break;

                case PlinkStatus.InvalidHostname:
                    messageText = "Could not connect. This appears to be an invalid hostname or IP";
                    break;

                case PlinkStatus.InvalidPort:
                    messageText = "Could not connect. This appears to be an invalid port";
                    break;

                case PlinkStatus.InvalidUserOrPass:
                    messageText = "Could not connect. Invalid username or password";
                    break;

                case PlinkStatus.TimedOut:
                    messageText = "Connection timed out. This could be due to an invalid hostname or port. Check your internet connection and SSH server settings and try again";
                    break;

                default:
                    messageText = "Unknown error";
                    break;
            }

            CrossThreadMessageBox(messageText, "Test connection status", MessageBoxButtons.OK, messageBoxIcon);
        }
 public void TestConnectionCallback(PlinkStatus plinkStatus)
 {
     if (TestConnectionCallbackEvent != null)
     {
         TestConnectionCallbackEvent(this, plinkStatus);
     }
 }
        private void ServiceRemotingCallback_TestConnectionCallbackEvent(object sender, PlinkStatus plinkStatus)
        {
            HideLoadingTestConnection();

            string         messageText    = "";
            MessageBoxIcon messageBoxIcon = MessageBoxIcon.Warning;

            switch (plinkStatus)
            {
            case PlinkStatus.Success:
                messageText    = "Success!";
                messageBoxIcon = MessageBoxIcon.Information;
                break;

            case PlinkStatus.ExecutableNotFound:
                messageText = "Plink.exe was not found";
                break;

            case PlinkStatus.ExecutableNotRecognized:
                messageText = "Plink.exe executable was not recognized";
                break;

            case PlinkStatus.InvalidHostname:
                messageText = "Could not connect. This appears to be an invalid hostname or IP";
                break;

            case PlinkStatus.InvalidPort:
                messageText = "Could not connect. This appears to be an invalid port";
                break;

            case PlinkStatus.InvalidUserOrPass:
                messageText = "Could not connect. Invalid username or password";
                break;

            case PlinkStatus.TimedOut:
                messageText = "Connection timed out. This could be due to an invalid hostname or port. Check your internet connection and SSH server settings and try again";
                break;

            default:
                messageText = "Unknown error";
                break;
            }

            CrossThreadMessageBox(messageText, "Test connection status", MessageBoxButtons.OK, messageBoxIcon);
        }