示例#1
0
 /// <summary>
 /// Creates a new directory/file.
 /// </summary>
 /// <param name="args">.</param>
 /// <remarks>
 /// It is normally called by the core on [F7] if the explorer has its flag <see cref="CanCreateFile"/> set.
 /// If the explorer creates something then it may also want to set one of the <c>Post*</c>,
 /// so that the specified file, normally just created, is set current by the core.
 /// </remarks>
 public virtual void CreateFile(CreateFileEventArgs args)
 {
     if (args != null)
     {
         args.Result = JobResult.Ignore;
     }
 }
示例#2
0
        /// <summary>
        /// Calls <see cref="FarNet.Explorer.CreateFile"/> and <see cref="OnThisFileChanged"/>.
        /// </summary>
        /// <param name="args">.</param>
        public virtual void UICreateFile(CreateFileEventArgs args)
        {
            if (args == null)
            {
                return;
            }

            Explorer.CreateFile(args);

            if (args.Result != JobResult.Ignore)
            {
                OnThisFileChanged(args);
            }
        }
示例#3
0
        /// <summary>
        /// Creates a new file or directory.
        /// </summary>
        /// <remarks>
        /// It is normally called on [F7].
        /// It calls <see cref="UICreateFile"/> if the explorer supports it.
        /// <para>
        /// Current file after the operation is defined by <c>Post*</c> in the arguments.
        /// </para>
        /// </remarks>
        public void UICreate()
        {
            // can?
            if (!Explorer.CanCreateFile)
            {
                return;
            }

            // call
            var args = new CreateFileEventArgs(ExplorerModes.None);

            UICreateFile(args);
            if (args.Result != JobResult.Done)
            {
                return;
            }

            // post
            Post(args);

            // show
            Update(true);
            Redraw();
        }