Example #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);
        }
Example #2
0
 /// <summary>
 /// The OnCreatingFile
 /// </summary>
 /// <param name="e">The e<see cref="CreatingFileEventArgs"/></param>
 protected virtual void OnCreatingFile(CreatingFileEventArgs e)
 {
     CreatingFile?.Invoke(this, e);
 }