Exemple #1
0
 /// <summary>
 /// Exports files to a native destination.
 /// </summary>
 /// <param name="args">.</param>
 /// <remarks>
 /// This method gives some more control than default export performed with <see cref="GetContent"/>.
 /// </remarks>
 public virtual void ExportFiles(ExportFilesEventArgs args)
 {
     if (args != null)
     {
         args.Result = JobResult.Ignore;
     }
 }
Exemple #2
0
        /// <summary>
        /// Calls <see cref="FarNet.Explorer.ExportFiles"/> and <see cref="OnThisFileChanged"/>.
        /// </summary>
        /// <param name="args">.</param>
        public virtual void UIExportFiles(ExportFilesEventArgs args)
        {
            if (args == null)
            {
                return;
            }

            Explorer.ExportFiles(args);

            if (args.Result != JobResult.Ignore && args.Move)
            {
                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);
        }