コード例 #1
0
        /// <summary>
        /// Rename action.
        /// </summary>
        /// <remarks>
        /// It is called for the current item when [ShiftF6] is pressed.
        /// It calls <see cref="UIRenameFile"/> if the explorer supports it.
        /// <para>
        /// Current file after the operation is defined by <c>Post*</c> in the arguments.
        /// </para>
        /// </remarks>
        public void UIRename()
        {
            // can?
            if (!Explorer.CanRenameFile)
            {
                return;
            }

            // file
            var file = CurrentFile;

            if (file == null)
            {
                return;
            }

            // call
            var args = new RenameFileEventArgs(ExplorerModes.None, file);

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

            // post
            Post(args);

            // show
            Update(true);
            Redraw();
        }
コード例 #2
0
ファイル: Panel.UIExplorer.cs プロジェクト: zertyuiop/FarNet
        /// <summary>
        /// Calls <see cref="FarNet.Explorer.RenameFile"/> and <see cref="OnThisFileChanged"/>.
        /// </summary>
        /// <param name="args">.</param>
        public virtual void UIRenameFile(RenameFileEventArgs args)
        {
            if (args == null)
            {
                return;
            }

            Explorer.RenameFile(args);

            if (args.Result != JobResult.Ignore)
            {
                OnThisFileChanged(args);
            }
        }
コード例 #3
0
ファイル: Explorer.cs プロジェクト: fcenobi/FarNet
 /// <summary>
 /// Renames the file.
 /// </summary>
 /// <param name="args">.</param>
 /// <remarks>
 /// It is normally called for the current item in a panel on [ShiftF6].
 /// If renaming is done then the core updates and redraws the panel
 /// so that an item with the new name remains current.
 /// If names are not unique then this is not always possible to do correctly.
 /// In this case set one of the <c>Post*</c>.
 /// </remarks>
 public virtual void RenameFile(RenameFileEventArgs args)
 {
 }