本文整理汇总了C#中Panel.UIAcceptFiles方法的典型用法代码示例。如果您正苦于以下问题:C# Panel.UIAcceptFiles方法的具体用法?C# Panel.UIAcceptFiles怎么用?C# Panel.UIAcceptFiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Panel
的用法示例。
在下文中一共展示了Panel.UIAcceptFiles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CommitFiles
///
internal void CommitFiles(SuperPanel source, Panel target, IList<FarFile> files, bool move)
{
var dicTypeId = GroupFiles(files, ExplorerFunctions.None);
bool SelectionExists = source.SelectionExists;
var xfilesToStay = new List<FarFile>();
bool toUnselect = false;
bool toUpdate = false;
foreach (var xTypeId in dicTypeId)
{
Log.Source.TraceInformation("AcceptFiles TypeId='{0}'", xTypeId.Key);
object codata = null;
foreach (var kv in xTypeId.Value)
{
// explorer and its files
var explorer = kv.Key;
var xfiles = kv.Value;
var filesToAccept = new List<FarFile>(xfiles.Count);
foreach (var file in xfiles)
filesToAccept.Add(file.File);
// accept, mind co-data
Log.Source.TraceInformation("AcceptFiles Count='{0}' Location='{1}'", filesToAccept.Count, explorer.Location);
var argsAccept = new AcceptFilesEventArgs(ExplorerModes.None, filesToAccept, move, explorer);
argsAccept.Data = codata;
target.UIAcceptFiles(argsAccept);
codata = argsAccept.Data;
// info
bool isIncomplete = argsAccept.Result == JobResult.Incomplete;
bool isAllToStay = isIncomplete && argsAccept.FilesToStay.Count == 0;
// Copy: do not update the source, files are the same
if (!move)
{
// keep it as it is
if (isAllToStay || !SelectionExists)
{
if (isAllToStay && SelectionExists)
foreach(var file in xfiles)
xfilesToStay.Add(file);
continue;
}
// drop selection
toUnselect = true;
// recover
if (isIncomplete)
xfilesToStay.AddRange(SuperFile.SuperFilesOfExplorerFiles(xfiles, argsAccept.FilesToStay, explorer.FileComparer));
continue;
}
// Move: no need to delete or all to stay or cannot delete
if (!argsAccept.ToDeleteFiles || isAllToStay || !explorer.CanDeleteFiles)
{
// the source may have some files deleted, update
toUpdate = true;
// recover selection
if (isIncomplete)
xfilesToStay.AddRange(SuperFile.SuperFilesOfExplorerFiles(
xfiles, isAllToStay ? argsAccept.Files : argsAccept.FilesToStay, explorer.FileComparer));
continue;
}
// Move: delete is requested, delete the source files
// exclude this files to stay from to be deleted
if (isIncomplete)
{
foreach (SuperFile xfile in SuperFile.SuperFilesOfExplorerFiles(xfiles, argsAccept.FilesToStay, explorer.FileComparer))
{
xfiles.Remove(xfile);
xfilesToStay.Add(xfile);
}
}
// call delete on remaining files
object codata2 = null;
var result = DeleteFilesOfExplorer(explorer, xfiles, xfilesToStay, ExplorerModes.Silent, false, ref codata2);
if (result == JobResult.Done || result == JobResult.Incomplete)
toUpdate = true;
}
}
// update the target panel
target.Update(true);
target.Redraw();
// update/recover the source
if (toUpdate)
source.Update(false);
else if (toUnselect)
source.UnselectAll();
//.........这里部分代码省略.........