private void DataGrid_Drop(object sender, DragEventArgs e) { var files = e.Data.GetData(DataFormats.FileDrop) as string[]; if (files == null) { return; } AddFiles?.Invoke(this, new FileListEventArgs(files)); }
public static void GetFilesFromDb() { try { ulong count = dbCore.DbOps.GetFilesCount(); const ulong PAGE = 2500; ulong offset = 0; #if DEBUG stopwatch.Restart(); #endif while (dbCore.DbOps.GetFiles(out List <DbFile> files, offset, PAGE)) { if (files.Count == 0) { break; } UpdateProgress?.Invoke(null, $"Loaded file {offset} of {count}", (long)offset, (long)count); AddFiles?.Invoke(files); offset += PAGE; } #if DEBUG stopwatch.Stop(); Console.WriteLine("Core.GetFilesFromDb(): Took {0} seconds to get all files from the database", stopwatch.Elapsed.TotalSeconds); #endif Finished?.Invoke(); } catch (ThreadAbortException) {} catch (Exception ex) { if (Debugger.IsAttached) { throw; } Failed?.Invoke($"Exception {ex.Message}\n{ex.InnerException}"); #if DEBUG Console.WriteLine("Exception {0}\n{1}", ex.Message, ex.InnerException); #endif } }