Exemple #1
0
 /// <summary>
 /// Accepts module files from another explorer, normally from another module panel.
 /// </summary>
 /// <param name="args">.</param>
 /// <remarks>
 /// Read carefully all about <see cref="AcceptFilesEventArgs"/> and all its members.
 /// <para>
 /// The source explorer can be any explorer of any module panel, not even from this module.
 /// The method should check the source type or type ID and ignore unknown or not supported.
 /// </para>
 /// </remarks>
 public virtual void AcceptFiles(AcceptFilesEventArgs args)
 {
     if (args != null)
     {
         args.Result = JobResult.Ignore;
     }
 }
Exemple #2
0
        /// <summary>
        /// Calls <see cref="FarNet.Explorer.AcceptFiles"/> and <see cref="OnThisFileChanged"/>.
        /// </summary>
        /// <param name="args">.</param>
        public virtual void UIAcceptFiles(AcceptFilesEventArgs args)
        {
            if (args == null)
            {
                return;
            }

            Explorer.AcceptFiles(args);

            if (args.Result != JobResult.Ignore)
            {
                OnThisFileChanged(args);
            }
        }
Exemple #3
0
        /// <summary>
        /// Copy/move action.
        /// </summary>
        /// <param name="move">Tells to move files.</param>
        /// <remarks>
        /// The source and target panel are module panels.
        /// The target panel explorer accepts the selected files.
        /// </remarks>
        public virtual void UICopyMove(bool move)
        {
            // target
            var that = TargetPanel;

            // commit
            if (that == null)
            {
                // can?
                if (!Explorer.CanExportFiles)
                {
                    return;
                }

                // target?
                var native = Far.Api.Panel2;
                if (native.IsPlugin || native.Kind != PanelKind.File)
                {
                    return;
                }

                // args
                var argsExport = new ExportFilesEventArgs(ExplorerModes.None, SelectedFiles, move, native.CurrentDirectory);
                if (argsExport.Files.Count == 0)
                {
                    return;
                }

                // call
                UIExportFiles(argsExport);
                if (argsExport.Result == JobResult.Ignore)
                {
                    return;
                }

                // show
                native.Update(true);
                native.Redraw();

                // complete
                UICopyMoveComplete(argsExport);
                return;
            }

            // can?
            if (!that.Explorer.CanAcceptFiles)
            {
                return;
            }

            // args
            var argsAccept = new AcceptFilesEventArgs(ExplorerModes.None, this.SelectedFiles, move, this.Explorer);

            if (argsAccept.Files.Count == 0)
            {
                return;
            }

            // call
            that.UIAcceptFiles(argsAccept);
            if (argsAccept.Result == JobResult.Ignore)
            {
                return;
            }

            // the target may have new files, update, keep selection
            that.Post(argsAccept);
            that.Update(true);
            that.Redraw();

            // complete
            UICopyMoveComplete(argsAccept);
        }