Пример #1
0
		void PerformCopy (string targetDir)
		{
			double? total_bytes = null;

			var progress = new ProgressInteraction ("Copying", ComputeTotalFiles (), total_bytes);
			var runstate = Terminal.Begin (progress);
			using (var copyOperation = new CopyOperation (progress)) {
#if !DEBUG
				var timer = Terminal.MainLoop.AddTimeout (TimeSpan.FromSeconds (1), mainloop => {
					progress.UpdateStatus (copyOperation);
					return true;
				});
				Task t = Task.Factory.StartNew (delegate {
#endif
				foreach (var node in Selection ()) {
					bool isDir = node is Listing.DirNode;
					var r = copyOperation.Perform (CurrentPath, listing.GetPathAt (node.StartIdx), isDir, node.Info.Protection, targetDir);
					if (r == FileOperation.Result.Cancel)
						break;
				}

#if !DEBUG
					Terminal.Stop ();
				}, null);
				Terminal.RunLoop (runstate, true);
				Terminal.MainLoop.RemoveTimeout (timer);
#endif
			}
			
			Terminal.End (runstate);
		}