private void ExecuteRenameUserCommand(UserInfo obj) { try { EditStringWindow dlg = new EditStringWindow(); dlg.Title = "Rename User"; dlg.Header = "Enter new user name"; dlg.TextItem = obj.User.Account; dlg.Owner = Application.Current.MainWindow; dlg.WindowStartupLocation = WindowStartupLocation.CenterOwner; if (dlg.ShowDialog() == true) { obj.User.Name = dlg.TextItem; obj.User.Account = dlg.TextItem; (MainWindow as MainWindow).lbUsers.Items.SortDescriptions.Clear(); (MainWindow as MainWindow).lbUsers.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription("User.Account", System.ComponentModel.ListSortDirection.Ascending)); } } catch (Exception ex) { MessageBox.Show(ex.Message); } RaiseCanExecuteChanged(); }
private void ExecuteAddNewGroupCommand(object obj) { try { EditStringWindow dlg = new EditStringWindow(); dlg.Title = "New Group"; dlg.Header = "Enter name of new group"; dlg.WindowStartupLocation = WindowStartupLocation.CenterOwner; dlg.Owner = Application.Current.MainWindow; if (dlg.ShowDialog() == true) { AddGroup(dlg.TextItem); } } catch (Exception ex) { MessageBox.Show(ex.Message); } RaiseCanExecuteChanged(); }
private void ExecuteRenameGroupCommand(Group obj) { try { EditStringWindow dlg = new EditStringWindow(); dlg.Title = "Rename Group"; dlg.Header = "Enter new group name for: " + obj.Name; dlg.TextItem = obj.Name; dlg.Owner = Application.Current.MainWindow; dlg.WindowStartupLocation = WindowStartupLocation.CenterOwner; if (dlg.ShowDialog() == true) { obj.Name = dlg.TextItem; } } catch (Exception ex) { MessageBox.Show(ex.Message); } RaiseCanExecuteChanged(); }