public Form1() { InitializeComponent(); try { store = DeserializeAndLoad.LoadSavedData("MovieStore.dat") as MovieStorage; } catch (Exception e) { store = new MovieStorage(); } store.MovieCollectionChanged += RefreshDataGrid; bs = new BindingSource { DataSource = ConvertToDataTable(store.Movies) }; dataGridView2.DataSource = bs; dataGridView2.Columns[0].Visible = false; dataGridView2.Columns[1].Visible = false; var viewed = new Dictionary <string, bool> { { "All", false }, { "Viewed", true }, { "Unviewed", false } }.ToList(); cbViewed.DataSource = viewed; cbViewed.DisplayMember = "Key"; cbViewed.ValueMember = "Value"; }
private void Save() { try { DeserializeAndLoad.SaveData("MovieStore.dat", store); } catch (Exception ex) { MessageBox.Show(ex.Message); } }