Example #1
0
        /// <summary>
        /// Called to handle the "add" action.
        /// </summary>
        /// <param name="addedItems"></param>
        /// <returns>True if items were added, false otherwise.</returns>
        protected override bool AddItems(out IList <CannedTextSummary> addedItems)
        {
            addedItems = new List <CannedTextSummary>();
            var editor   = new CannedTextEditorComponent(GetCategoryChoices());
            var exitCode = LaunchAsDialog(this.Host.DesktopWindow, editor, SR.TitleAddCannedText);

            if (exitCode == ApplicationComponentExitCode.Accepted)
            {
                addedItems.Add(editor.UpdatedCannedTextSummary);
                return(true);
            }
            return(false);
        }
Example #2
0
        /// <summary>
        /// Called to handle the "edit" action.
        /// </summary>
        /// <param name="items">A list of items to edit.</param>
        /// <param name="editedItems">The list of items that were edited.</param>
        /// <returns>True if items were edited, false otherwise.</returns>
        protected override bool EditItems(IList <CannedTextSummary> items, out IList <CannedTextSummary> editedItems)
        {
            editedItems = new List <CannedTextSummary>();
            var item = CollectionUtils.FirstElement(items);

            var editor   = new CannedTextEditorComponent(GetCategoryChoices(), item.CannedTextRef);
            var exitCode = LaunchAsDialog(this.Host.DesktopWindow, editor, SR.TitleUpdateCannedText);

            if (exitCode == ApplicationComponentExitCode.Accepted)
            {
                editedItems.Add(editor.UpdatedCannedTextSummary);
                return(true);
            }
            return(false);
        }
Example #3
0
        public void DuplicateAdd()
        {
            try
            {
                var item = CollectionUtils.FirstElement(this.SelectedItems);
                IList <CannedTextSummary> addedItems = new List <CannedTextSummary>();
                var editor = new CannedTextEditorComponent(GetCategoryChoices(), item.CannedTextRef, true);

                var exitCode = LaunchAsDialog(
                    this.Host.DesktopWindow, editor, SR.TitleDuplicateCannedText);
                if (exitCode == ApplicationComponentExitCode.Accepted)
                {
                    addedItems.Add(editor.UpdatedCannedTextSummary);
                    this.Table.Items.AddRange(addedItems);
                    this.SummarySelection = new Selection(addedItems);
                }
            }
            catch (Exception e)
            {
                // failed to launch editor
                ExceptionHandler.Report(e, this.Host.DesktopWindow);
            }
        }