/// <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> /// Edits the knowledge. /// </summary> /// <param name="id">The id.</param> public static void EditKnowledge(int id) { var win = new EditKnowledgeWindow { Owner = Application.Current.MainWindow, }; win.DataContext = new EditKnowledgeModel(id, win, win.boxSummary); win.ShowDialog(); }
/// <summary> /// Creates the knowledge. /// </summary> /// <param name="parentId">The parent id.</param> public static void CreateKnowledge(int parentId) { var win = new EditKnowledgeWindow { Owner = Application.Current.MainWindow, }; win.DataContext = new EditKnowledgeModel(0, win, win.boxSummary) { Entity = { CategoryID = parentId } };; 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(); } }