Пример #1
0
        /// <summary>
        /// The NewApplicationFile
        /// </summary>
        /// <returns>The <see cref="bool"/></returns>
        public bool NewApplicationFile()
        {
            if (ChangeDetector.Changed && !SaveApplicationFile())
            {
                return(false);
            }

            string suggestedFilename     = GetSuggestedFilename();
            var    creatingFileEventArgs = new CreatingFileEventArgs(suggestedFilename);

            OnCreatingFile(creatingFileEventArgs);
            if (!creatingFileEventArgs.Cancel)
            {
                var createFileEventArgs = new CreateFileEventArgs()
                {
                    Failed = false, FileName = creatingFileEventArgs.FileName
                };
                OnCreateFile(createFileEventArgs);

                var failed = createFileEventArgs.Failed;
                var createdFileEventArgs = new CreatedFileEventArgs(failed);
                OnCreatedFile(createdFileEventArgs);
                ChangeDetector.Changed = false;

                FileName = createFileEventArgs.FileName;

                return(!createdFileEventArgs.Failed);
            }

            return(false);
        }
Пример #2
0
 /// <summary>
 /// The OnCreatedFile
 /// </summary>
 /// <param name="e">The e<see cref="CreatedFileEventArgs"/></param>
 protected virtual void OnCreatedFile(CreatedFileEventArgs e)
 {
     CreatedFile?.Invoke(this, e);
 }