private void SnappedPage(object sender, CalendarSnapshotEventArgs e) { var path = new OneNoteProvider().Export(e.Page.PageID); Logger.Current.WriteLine($"exported page '{e.Page.Title}' to {path}"); var location = PointToScreen(e.Bounds.Location); location.Offset(50, 70); snapForm = new SnapshotForm(e.Page, path); snapForm.Location = location; snapForm.Deactivate += DeactivateSnap; snapForm.Show(this); }
private void DeactivateSnap(object sender, EventArgs e) { if (snapForm != null) { var path = snapForm.Path; snapForm.Dispose(); snapForm = null; if (File.Exists(path)) { try { File.Delete(path); } catch (Exception exc) { Logger.Current.WriteLine("error deleting temp metafile", exc); } } } }