示例#1
0
        private void ButtonConnect_Click(object sender, RoutedEventArgs e)
        {
            if (!SetConnection())
            {
                return;
            }
            if (!SetFTP())
            {
                return;
            }

            try
            {
                Status = "Connecting...";
                stackPanelConnection.IsEnabled = true;
                stackPanelConnection.Opacity   = 1;
                imageConnect.Source            = (BitmapImage)Application.Current.Resources["bitmapImageConnect"];
                ListDirectory("/");
                Status = "Connected";
            }
            catch (Exception ex)
            {
                Status = ex.Message;
                DisableBar();
            }
            finally
            {
                selectedUser = null;
            }
        }
示例#2
0
 public YSFTPClient(YSFTPUser user)
 {
     Host     = user.Host;
     Port     = user.Port;
     UserName = user.UserName;
     UserPass = user.UserPass;
 }
示例#3
0
        private void NewMenuItem_Click(object sender, RoutedEventArgs e)
        {
            var clickedItem = (sender as MenuItem);

            selectedUser                 = (clickedItem.Tag as YSFTPUser);
            textBoxHost.Text             = selectedUser.Host;
            textBoxUserName.Text         = selectedUser.UserName;
            passwordBoxUserPass.Password = selectedUser.UserPass;
            textBoxPort.Text             = selectedUser.Port.ToString();
            buttonConnect.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
        }
示例#4
0
        private void ButtonSave_Click(object sender, RoutedEventArgs e)
        {
            var newUser = new YSFTPUser
            {
                ServerName = textBoxServerName.Text,
                Host       = textBoxHost.Text,
                Port       = Convert.ToInt32(textBoxPort.Text),
                UserName   = textBoxUserName.Text,
                UserPass   = passwordBoxUserPass.Password
            };

            MainWindow.ServerList.Add(newUser);
            ResetInput();
        }