コード例 #1
0
        //=====================================================================

        /// <summary>
        /// This is used to see if the project can be edited.  If not, abort
        /// the change by throwing an exception.
        /// </summary>
        private void CheckProjectIsEditable()
        {
            CancelEventArgs ce = new CancelEventArgs();

            projectFile.OnQueryEditProjectFile(ce);

            if (ce.Cancel)
            {
                throw new OperationCanceledException("Project cannot be edited");
            }
        }
コード例 #2
0
        //=====================================================================

        /// <summary>
        /// This is used to see if the project can be edited.  If not, abort
        /// the change by throwing an exception.
        /// </summary>
        protected void CheckProjectIsEditable()
        {
            // If not associated with a project, allow it by default
            if (projectFile == null)
            {
                isDirty = true;
            }
            else
            {
                CancelEventArgs ce = new CancelEventArgs();
                projectFile.OnQueryEditProjectFile(ce);

                if (ce.Cancel)
                {
                    throw new OperationCanceledException(
                              "Project cannot be edited");
                }

                isDirty = true;
                projectFile.MarkAsDirty();
            }
        }