Ejemplo n.º 1
0
        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;
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public override void Execute(object parameter)
 {
     var dialog = new AccountDialog();
     if (dialog.ShowDialog().IsTrue())
         AccountManager.AddNewAccount(dialog.Account);
 }
Ejemplo n.º 3
0
 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;
     }
 }