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; } }
public YSFTPClient(YSFTPUser user) { Host = user.Host; Port = user.Port; UserName = user.UserName; UserPass = user.UserPass; }
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)); }
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(); }