示例#1
0
        //using ConnectionController to check port/IP address if IP and port box are NOT NULL
        private void GetListOfFiles(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(ServerIPBox.Text) && !string.IsNullOrEmpty(ServerPortBox.Text))
            {
                if (!myConnection.IsConnected)
                {
                    if (myConnection.CheckIP(ServerIPBox.Text, int.Parse(ServerPortBox.Text)))
                    {
                        myConnection.Connect();

                        if (myConnection.IsConnected)
                        {
                            ServerName.Text       = "Files from: " + ServerIPBox.Text + ":" + ServerPortBox.Text;
                            ServerName.Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(0, 255, 0));
                            SFiles = myConnection.ReturnServerFiles();
                            ServerFilesRefresh();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("You are already connected");
                }
            }
            else
            {
                MessageBox.Show("Enter server IP & port");
            }
        }
 public MainWindowVM(IDialogService dialogService)
 {
     _dialogService        = dialogService;
     _connectionController = new ConnectionController(ConnectionErrorHandler, StatusUpdate);
     _focuser             = new WindowFocuser();
     ConnectCommand       = new DelegateCommand(() => { _connectionController.Connect(); _refresher.Start(); });
     FocusNotepadCommand  = new DelegateCommand(() => _focuser.FocusAndWrite("notepad++", "message"));
     SetSettingsCommand   = new DelegateCommand(SetSettings);
     ExitCommand          = new DelegateCommand(Exit);
     StartCommand         = new DelegateCommand(StartDevice, CanStart);
     StopCommand          = new DelegateCommand(StopDevice, CanStop);
     _refresher.AutoReset = true;
     _refresher.Elapsed  += Refresher_Elapsed;
 }
示例#3
0
    public void OnClick()
    {
        if (controller == null)
        {
            controller = GameObject.FindObjectOfType <ConnectionController>();
        }

        if (!IsValidIP(text.text) && text.text != "localhost")
        {
            Debug.Log("invalid ip");
            return;
        }

        controller.Connect(text.text);
    }
示例#4
0
 public void EntryButton()
 {
     nickname = nameField.text;
     ws.Connect();
 }