private void btnAddAdmin_Click(object sender, RoutedEventArgs e) { EditAdminWindow win = new EditAdminWindow(true, null); if (win.ShowDialog() == true) { AdminController.Instance.GetAllAdmin(); } }
private void OpenEditWindow(PermissionsEuiState.AdminData?data) { var window = new EditAdminWindow(this, data); window.SaveButton.OnPressed += _ => SaveAdminPressed(window); window.OpenCentered(); window.OnClose += () => _subWindows.Remove(window); if (data != null) { window.RemoveButton !.OnPressed += _ => RemoveButtonPressed(window); } _subWindows.Add(window); }
private void btnEditAdmin_Click(object sender, RoutedEventArgs e) { if (this.datagridAdmin.SelectedItem is AdminUIModel) { MessageBox.Show("abc行修改。"); } if (AdminController.Instance.GetCheckedItemsCount() != 1) { MessageBox.Show("请选择一个管理员进行修改。"); return; } var admin = AdminController.Instance.GetFirstCheckedAdmin(); if (admin != null) { EditAdminWindow win = new EditAdminWindow(false, admin); if (win.ShowDialog() == true) { AdminController.Instance.GetAllAdmin(); } } }
private void RemoveButtonPressed(EditAdminWindow window) { SendMessage(new RemoveAdmin { UserId = window.SourceData !.Value.UserId });