/// ------------------------------------------------------------------------------------ /// <summary> /// When dialog closes, finish up the pending stuff. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs"/> that contains the event data.</param> /// ------------------------------------------------------------------------------------ protected override void OnClosed(EventArgs e) { using (new WaitCursor(this)) { // Enhance JohnT: Normally we would make sure all these changes were a single Undo action, // but for now we know this is part of a still larger Undoable task, the whole import. // CollapseToMark is used to convert them all into one. // Insert any new books into bookfilter that need to be visible m_bookFilter.Add(m_newBooks.ToArray()); if (m_cache.ActionHandlerAccessor != null) { UndoChangeFilter undoItem = new UndoChangeFilter(m_bookFilter, m_newBooks, m_overwrittenBooks); m_cache.ActionHandlerAccessor.AddAction(undoItem); } // Delete empty revisions created for this import. //if (m_booksImported.BooksOS.Count == 0) // m_booksImported.DeleteUnderlyingObject(); if (m_backupVersion.BooksOS.Count == 0) m_backupVersion.DeleteUnderlyingObject(); if (e != null) base.OnClosed(e); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// When dialog closes, finish up the pending stuff. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs"/> that contains the event data.</param> /// ------------------------------------------------------------------------------------ protected override void OnClosed(EventArgs e) { using (new WaitCursor(this)) { // User should not see undo tasks, so the strings don't need to be localized. UndoableUnitOfWorkHelper.Do("Remove empty", "Remove empty", m_cache.ServiceLocator.GetInstance<IActionHandler>(), () => { // Enhance JohnT: Normally we would make sure all these changes were a single Undo action, // but for now we know this is part of a still larger Undoable task, the whole import. // CollapseToMark is used to convert them all into one. if (m_bookFilter != null) { // Insert any new books into bookfilter that need to be visible m_bookFilter.Add(m_newBooks); UndoChangeFilter undoItem = new UndoChangeFilter(m_bookFilter, m_newBooks, m_overwrittenBooks); m_cache.ActionHandlerAccessor.AddAction(undoItem); } // Delete empty revisions created for this import. //if (m_booksImported.BooksOS.Count == 0) // m_booksImported.DeleteUnderlyingObject(); if (m_backupVersion.BooksOS.Count == 0) { m_scr.ArchivedDraftsOC.Remove(m_backupVersion); m_backupVersion = null; } }); if (e != null) base.OnClosed(e); } }