private void bEdit_Click(object sender, RoutedEventArgs e)
        {
            if (lbAccounts.SelectedItem != null)
            {
                Account acc = (Account)lbAccounts.SelectedItem;
                AccountDialog dialog = new AccountDialog();
                dialog.EditAccount(acc);

                if (dialog.ShowModalDialog())
                {
                    //QSTN: Can this copy be done better?
                    acc.Url = dialog.Account.Url;
                    acc.UserName = dialog.Account.UserName;
                    acc.Password = dialog.Account.Password;

                    if (dialog.Account.IsDefault)
                    {
                        Account oldDefault = AccountManager.FindCurrentDefault();
                        if (oldDefault != null)
                            oldDefault.IsDefault = false;

                        acc.IsDefault = true;
                    }
                }
            }
        }
Example #2
0
 public override void Execute(object parameter)
 {
     var dialog = new AccountDialog();
     if (dialog.ShowDialog().IsTrue())
         AccountManager.AddNewAccount(dialog.Account);
 }
 private void bNew_Click(object sender, RoutedEventArgs e)
 {
     var dialog = new AccountDialog();
     if (dialog.ShowModalDialog())
     {
         AccountManager.AddNewAccount(dialog.Account);
         lbAccounts.SelectedIndex = lbAccounts.Items.Count - 1;
     }
 }