async void AcceptDragDrop(IDataObject dataObject, bool controlKeyHeld) { if (UrlDragDropUtils.IsUriDataPresent(dataObject)) { if (controlKeyHeld) { await logSourcesController.DeleteAllLogsAndPreprocessings(); } var urls = UrlDragDropUtils.GetURLs(dataObject).ToArray(); await preprocessingManager.Preprocess( urls.Select(url => preprocessingStepsFactory.CreateURLTypeDetectionStep(new PreprocessingStepParams(url))), urls.Length == 1?urls[0] : "Urls drag&drop" ); } else if (dataObject.GetDataPresent(DataFormats.FileDrop, false)) { if (controlKeyHeld) { await logSourcesController.DeleteAllLogsAndPreprocessings(); } ((dataObject.GetData(DataFormats.FileDrop) as string[]) ?? new string[0]).Select(file => preprocessingManager.Preprocess( Enumerable.Repeat(preprocessingStepsFactory.CreateFormatDetectionStep(new PreprocessingStepParams(file)), 1), file ) ).ToArray(); } }
bool ShouldAcceptDragDrop(IDataObject dataObject) { if (dataObject.GetDataPresent(DataFormats.FileDrop, false)) { return(true); } else if (UrlDragDropUtils.IsUriDataPresent(dataObject)) { return(true); } return(false); }