예제 #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");
            }
        }