private void ButtonAddItem_Click(object sender, RoutedEventArgs e) { LoginNameEdit window = new LoginNameEdit() { _strDic = _strDic, ShowInTaskbar = false, Owner = this }; window.ShowDialog(); _strDic = null; ShowAllItems(Global.userAccounts); }
private void ButtonEditItem_Click(object sender, RoutedEventArgs e) { if (_SelIndex < 0) { return; } bool canEdit = false; try { UserAccount item = Global.userAccounts[_SelIndex]; if (string.Empty.Equals(item.UserPassword)) { canEdit = true; } else { InputDialog dialog = new InputDialog("请输入密码"); dialog.ShowDialog(); if (dialog.GetResult()) { if (dialog.GetInput().Equals(item.UserPassword)) { canEdit = true; } else { canEdit = false; MessageBox.Show("密码错误"); return; } } } if (canEdit) { LoginNameEdit window = new LoginNameEdit() { _item = Global.userAccounts[_SelIndex], ShowInTaskbar = false, Owner = this }; window.ShowDialog(); ShowAllItems(Global.userAccounts); } } catch (Exception ex) { MessageBox.Show("异常:\n" + ex.Message); } }
private void ButtonEditItem_Click(object sender, RoutedEventArgs e) { if (_SelIndex < 0) { MessageBox.Show("请选择一个用户!", "系统提示"); return; } UserAccount item = Global.userAccounts[_SelIndex]; bool canEdit = false; if (string.Empty.Equals(item.UserPassword) || LoginWindow._userAccount.UserName.Equals("admin")) { canEdit = true; } else { for (int i = 0; i < 1; i++) { InputDialog dialog = new InputDialog("请输入密码!"); dialog.ShowDialog(); if (dialog.GetResult()) { if (dialog.GetInput().Equals(item.UserPassword)) { canEdit = true; break; } else { canEdit = false; MessageBox.Show("密码错误!", "系统提示"); i--; } } } } if (canEdit) { LoginNameEdit window = new LoginNameEdit() { _strDic = this._strDic, _item = Global.userAccounts[_SelIndex], ShowInTaskbar = false, Owner = this }; window.ShowDialog(); this._strDic = null; ShowAllItems(Global.userAccounts); } }
private void ButtonAddItem_Click(object sender, RoutedEventArgs e) { try { LoginNameEdit window = new LoginNameEdit() { ShowInTaskbar = false, Owner = this }; window.ShowDialog(); ShowAllItems(Global.userAccounts); } catch (Exception ex) { MessageBox.Show("异常:\n" + ex.Message); } }