public Task CopyDesktopFileToDevice(string sourceDesktopFilePath, string destinationDeviceFilePath) { return(Task.Run(() => { Monitor.Enter(this); try { LOGGER.Debug("Copying {0} to device...", sourceDesktopFilePath); destinationDeviceFilePath = GetAbsoluteDevicePath(destinationDeviceFilePath); device.CreateDirectory(Path.GetDirectoryName(destinationDeviceFilePath)); if (device.FileExists(destinationDeviceFilePath)) { device.DeleteFile(destinationDeviceFilePath); } device.UploadFile(sourceDesktopFilePath, destinationDeviceFilePath); LOGGER.Trace("Finished copying {0}", sourceDesktopFilePath); } finally { Monitor.Exit(this); } })); }