Beispiel #1
0
        ///--------------------------------------------------------------------------------
        /// <summary>This method is used to copy/paste a new item.</summary>
        ///
        /// <param name="copyItem">The item to copy/paste.</param>
        /// <param name="savePaste">Flag to determine whether to save the results of the paste.</param>
        ///--------------------------------------------------------------------------------
        public CodeTemplateViewModel PasteCodeTemplate(CodeTemplateViewModel copyItem, bool savePaste = true)
        {
            CodeTemplate newItem = new CodeTemplate();

            newItem.ReverseInstance = new CodeTemplate();
            newItem.TransformDataFromObject(copyItem.CodeTemplate, null, false);
            newItem.TemplateID    = Guid.NewGuid();
            newItem.IsAutoUpdated = false;

            newItem.Solution = Solution;
            newItem.Solution = Solution;
            CodeTemplateViewModel newView = new CodeTemplateViewModel(newItem, Solution);

            newView.ResetModified(true);
            AddCodeTemplate(newView);

            // paste children
            if (savePaste == true)
            {
                Solution.CodeTemplateList.Add(newItem);
                newView.OnUpdated(this, null);
                Solution.ResetModified(true);
            }
            return(newView);
        }