public DictionarySectionUI(DualSectionImporter dualSection, IDictionarySectionImporter importer) { InitializeComponent(); this.dualSection = dualSection; this.importer = importer; }
public void Cancel() { if (Interlocked.CompareExchange(ref state, 2, 1) != 1) { throw new InvalidOperationException(Resources.Errors.ImportHadNotBegun); } if (first != null) { first.Cancel(); first.Dispose(); first = null; // The second one hasn't started yet, so no need to dispose it, and it // cannot start importing because state is now set to 2. if (second != null) { second.Dispose(); second = null; } } else if (second != null) { second.Cancel(); second.Dispose(); } }
private void UnwireEvents(IDictionarySectionImporter importer) { if (importer != null) // Most likely because of Cancel() { importer.ProgressChanged -= new EventHandler <ProgressMessageEventArgs>(ImporterProgressChanged); } }
/// <summary> /// Sets the two importers used to import the two sections of the dictionary. /// </summary> public void SetImporters(IDictionarySectionImporter first, string firstPath, IDictionarySectionImporter second, string secondPath, bool generateSecondHalf) { if (this.first != null || this.second != null) { throw new InvalidOperationException(); } this.shouldGenerateSecondHalf = generateSecondHalf && (second == null); this.first = first; this.firstPath = firstPath; this.second = second; this.secondPath = secondPath; }
private void WireEvents(IDictionarySectionImporter importer) { importer.ProgressChanged += new EventHandler <ProgressMessageEventArgs>(ImporterProgressChanged); }