//Done on background thread private static void UploadFile(string path) { Byte[] contents; try { contents = File.ReadAllBytes(path); } catch (Exception ex) { Debug.Print("Failed to read file contents. "+ ex.Message); return; } var db = new FishTaggingDataContext(); var file = new RawDataFile { FileName = Path.GetFileName(path), FolderName = Path.GetDirectoryName(path), Contents = contents }; db.RawDataFiles.InsertOnSubmit(file); try { db.SubmitChanges(); } catch (Exception ex) { Debug.Print("Failed to submit file. " + ex.Message); } }
//Done on background thread static private void UploadFile(string path) { Byte[] contents; try { contents = File.ReadAllBytes(path); } catch (Exception ex) { Debug.Print("Failed to read file contents. " + ex.Message); return; } var db = new FishTaggingDataContext(); var file = new RawDataFile { FileName = Path.GetFileName(path), FolderName = Path.GetDirectoryName(path), Contents = contents }; db.RawDataFiles.InsertOnSubmit(file); try { db.SubmitChanges(); } catch (Exception ex) { Debug.Print("Failed to submit file. " + ex.Message); } }
private void RefreshDataGrid() { FilesDataGridView.DataSource = null; CurrentContext = new FishTaggingDataContext(); FilesDataGridView.DataSource = CurrentContext.RawDataFiles; FilesDataGridView.Columns[0].Visible = false; FilesDataGridView.Columns[1].HeaderText = "File"; FilesDataGridView.Columns[2].HeaderText = "Folder"; FilesDataGridView.Columns[3].HeaderText = "When"; FilesDataGridView.Columns[4].HeaderText = "Who"; FilesDataGridView.Columns[5].Visible = false; }
private void RefreshDataGrid() { FilesDataGridView.DataSource = null; CurrentContext = new FishTaggingDataContext(); FilesDataGridView.DataSource = CurrentContext.RawDataFiles; FilesDataGridView.Columns[0].Visible = false; FilesDataGridView.Columns[1].HeaderText = "File"; FilesDataGridView.Columns[2].HeaderText = "Folder"; FilesDataGridView.Columns[3].HeaderText = "When"; FilesDataGridView.Columns[4].HeaderText = "Who"; FilesDataGridView.Columns[5].Visible = false; }