private void Form1_Load(object sender, EventArgs e) { if (this.DesignMode) { return; } RestoreSizeAndLocation(); // load default/missing cover images. this will also initiate the background image downloader var format = System.Drawing.Imaging.ImageFormat.Jpeg; PictureStorage.SetDefaultImage(PictureSize._80x80, Properties.Resources.default_cover_80x80.ToBytes(format)); PictureStorage.SetDefaultImage(PictureSize._300x300, Properties.Resources.default_cover_300x300.ToBytes(format)); PictureStorage.SetDefaultImage(PictureSize._500x500, Properties.Resources.default_cover_500x500.ToBytes(format)); RefreshImportMenu(); setVisibleCount(null, 0); reloadGrid(); // also applies filter. ONLY call AFTER loading grid loadInitialQuickFilterState(); // init bottom counts backupsCountsLbl.Text = "[Calculating backed up book quantities]"; pdfsCountsLbl.Text = "[Calculating backed up PDFs]"; setBackupCounts(null, null); }
public Form1() { InitializeComponent(); // back up string formats beginBookBackupsToolStripMenuItem_format = beginBookBackupsToolStripMenuItem.Text; beginPdfBackupsToolStripMenuItem_format = beginPdfBackupsToolStripMenuItem.Text; if (this.DesignMode) { return; } // independent UI updates this.Load += (_, _) => this.RestoreSizeAndLocation(Configuration.Instance); this.Load += RefreshImportMenu; this.FormClosing += (_, _) => this.SaveSizeAndLocation(Configuration.Instance); LibraryCommands.LibrarySizeChanged += reloadGridAndUpdateBottomNumbers; LibraryCommands.BookUserDefinedItemCommitted += setBackupCounts; // used by async migrations to update ui when complete DataLayer.UserDefinedItem.Batch_ItemChanged += reloadGridAndUpdateBottomNumbers; var format = System.Drawing.Imaging.ImageFormat.Jpeg; PictureStorage.SetDefaultImage(PictureSize._80x80, Properties.Resources.default_cover_80x80.ToBytes(format)); PictureStorage.SetDefaultImage(PictureSize._300x300, Properties.Resources.default_cover_300x300.ToBytes(format)); PictureStorage.SetDefaultImage(PictureSize._500x500, Properties.Resources.default_cover_500x500.ToBytes(format)); }