/// <summary> /// Handles the Executed event of the AddCommand control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.Input.ExecutedRoutedEventArgs"/> instance containing the event data.</param> private void AddCommand_Executed(object sender, ExecutedRoutedEventArgs e) { e.Handled = true; var param = e.Parameter as ItemParams; if (param == null) { return; } switch (param.Type) { case ObjectType.Category: EditCategoryWindow.CreateCategory(param.IntId); break; case ObjectType.Knowledge: EditKnowledgeWindow.CreateKnowledge(param.IntId); categoryInfo.ReloadItems(); break; case ObjectType.User: EditUserWindow.CreateUser(); docUsers.ResetData(); break; default: e.Handled = false; break; } }
/// <summary> /// Creates the user. /// </summary> public static void CreateUser() { var win = new EditUserWindow { Owner = Application.Current.MainWindow, Title = "Create new user" }; win.ShowDialog(); }
/// <summary> /// Edits the user. /// </summary> /// <param name="id">The id.</param> public static void EditUser(int id) { var entity = KbContext.CurrentKb.ManagerUser.GetByID(id); if (entity == null) { return; } var win = new EditUserWindow { Owner = Application.Current.MainWindow, Title = string.Format("Edit '{0}' user", entity.Login) }; win.ShowUser(entity); win.ShowDialog(); }
/// <summary> /// Handles the Executed event of the EditCommand control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.Input.ExecutedRoutedEventArgs"/> instance containing the event data.</param> private void EditCommand_Executed(object sender, ExecutedRoutedEventArgs e) { var param = (ItemParams)e.Parameter; switch (param.Type) { case ObjectType.Category: EditCategoryWindow.EditCategory(param.IntId); break; case ObjectType.Knowledge: EditKnowledgeWindow.EditKnowledge(param.IntId); break; case ObjectType.User: EditUserWindow.EditUser(param.IntId); docUsers.ResetData(); break; default: throw new ArgumentOutOfRangeException(); } }