Ejemplo n.º 1
0
        /// <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;
            }
        }
Ejemplo n.º 2
0
        /// <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();
        }
Ejemplo n.º 3
0
        /// <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();
        }
Ejemplo n.º 4
0
        /// <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();
            }
        }