예제 #1
0
		/// <summary>
		/// Moves the selected items to the destination on a separate thread
		/// </summary>
		/// <param name="dataObject">Contains the items you want to moe</param>
		/// <param name="destination">The place you want to move the items to</param>
		private void DoMove(IDataObject dataObject, IListItemEx destination) {
			var handle = this.Handle;
			var thread = new Thread(() => {
				IShellItem[] items =
					dataObject.GetDataPresent("FileDrop") ?
					items = ((F.DataObject)dataObject).GetFileDropList().OfType<String>().Select(s => FileSystemListItem.ToFileSystemItem(IntPtr.Zero, s.ToShellParsingName()).ComInterface).ToArray()
					:
					dataObject.ToShellItemArray().ToArray();

				try {
					var fo = new IIFileOperation(handle);
					foreach (var item in items) {
						fo.MoveItem(item, destination, null);
					}

					fo.PerformOperations();
				}
				catch (SecurityException) {
					throw;
				}
			});

			thread.SetApartmentState(ApartmentState.STA);
			thread.Start();
		}