Exemplo n.º 1
0
        private void btnTestConnect_Click(object sender, RoutedEventArgs e)
        {
            string server = tbServer.Text;
            string port   = tbPort.Text;

            if (Common.isIP(server) && Common.isPort(port))
            {
                try {
                    Common.sshServer = server;
                    Common.sshPort   = Int32.Parse(port);
                    if (SSHConnect.sshConnected(Common.sshServer, Common.sshPort, Common.sshUID, Common.sshPWD))
                    {
                        MessageBox.Show(Messages.SSHCONNECTED);
                        this.Close();
                    }
                    else
                    {
                    }
                } catch (Exception ex) {
                    throw ex;
                }
            }
            else
            {
                if (!Common.isIP(server))
                {
                    MessageBox.Show(Messages.SERVER_ERROR);
                }
                if (!Common.isPort(port))
                {
                    MessageBox.Show(Messages.PORT_ERROR);
                }
            }
        }
Exemplo n.º 2
0
 public MainWindow()
 {
     if (Load.configRead())
     {
         InitializeComponent();
         if (!SSHConnect.sshConnected(Common.sshServer, Common.sshPort, Common.sshUID, Common.sshPWD))
         {
             MessageBox.Show(Messages.SSH_ERROR);
         }
         loginWindow login = new loginWindow();
         login.ShowDialog();
         this.Loaded += MainWindow_Loaded;
     }
     else
     {
         MessageBox.Show(Messages.CONFIG_LOAD_ERROR);
         Application.Current.Shutdown();
     }
 }