예제 #1
0
        /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         * ~
         * ~ Private methods
         * ~
         * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

        /// <summary>
        /// Validate all of the pages in the designated document.
        /// </summary>
        /// <param name="document">Visio document.</param>
        private ModelCommandResult ValidateAll(IVDocument document)
        {
            #region Validations

            if (document == null)
            {
                throw new ArgumentNullException(nameof(document));
            }

            #endregion

            ModelCommandResult result = new ModelCommandResult();

            int pageCount = document.Pages.Count;

            for (int i = 1; i <= pageCount; i++)
            {
                Page          page = document.Pages[i];
                PageEventArgs ev   = new PageEventArgs(i, pageCount, page.Name);

                OnPageStart(ev);

                ModelCommandPageResult pageResult = Work(page, true);
                result.Add(pageResult);

                OnPageEnd(ev);
            }

            return(result);
        }
예제 #2
0
        /// <summary>
        /// Validate and export the designated page.
        /// </summary>
        /// <param name="page">Visio page.</param>
        private ModelCommandResult ExportPage(IVPage page)
        {
            #region Validations

            if (page == null)
            {
                throw new ArgumentNullException(nameof(page));
            }

            #endregion

            ModelCommandResult result = new ModelCommandResult();

            PageEventArgs ev = new PageEventArgs(1, 1, page.Name);
            OnPageStart(ev);

            ModelCommandPageResult pageResult = Work(page, false);
            result.Add(pageResult);

            OnPageEnd(ev);

            return(result);
        }
예제 #3
0
        private static ModelCommandResult BuildResult(string pageName, string itemId)
        {
            #region Validations

            if (pageName == null)
            {
                throw new ArgumentNullException(nameof(pageName));
            }

            if (itemId == null)
            {
                throw new ArgumentNullException(nameof(itemId));
            }

            #endregion

            ModelCommandPageResult pageResult = new ModelCommandPageResult(pageName);
            pageResult.Add(itemId);

            ModelCommandResult result = new ModelCommandResult();
            result.Add(pageResult);

            return(result);
        }