//On UI Context async public virtual Task PerformImport() { using (FrameworkDataUpdater d = new FrameworkDataUpdater(Core)) { GeocacheIgnoreSupport.Instance.IgnoreCounter = 0; await Task.Run(() => { try { ImportMethod(); } catch (Exception e) { System.Windows.Forms.MessageBox.Show(e.Message, Utils.LanguageSupport.Instance.GetTranslation("Error"), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } }); if (GeocacheIgnoreSupport.Instance.IgnoreCounter > 0) { using (Dialogs.GeocachesIgnoredMessageForm dlg = new Dialogs.GeocachesIgnoredMessageForm(Core, GeocacheIgnoreSupport.Instance.IgnoreCounter)) { dlg.ShowDialog(); } } } }
//On UI Context async public virtual Task PerformImport() { using (FrameworkDataUpdater d = new FrameworkDataUpdater(Core)) { GeocacheIgnoreSupport.Instance.IgnoreCounter = 0; await Task.Run(() => { try { ImportMethod(); } catch (Exception e) { System.Windows.Forms.MessageBox.Show(e.Message, Utils.LanguageSupport.Instance.GetTranslation("Error"), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } }); if (GeocacheIgnoreSupport.Instance.IgnoreCounter > 0) { using (Dialogs.GeocachesIgnoredMessageForm dlg = new Dialogs.GeocachesIgnoredMessageForm(Core, GeocacheIgnoreSupport.Instance.IgnoreCounter)) { dlg.ShowDialog(); } } } }
//On UI Context public virtual void PerformImport() { using (FrameworkDataUpdater d = new FrameworkDataUpdater(Core)) { GeocacheIgnoreSupport.Instance.IgnoreCounter = 0; _actionReady.Reset(); Thread thrd = new Thread(new ThreadStart(this.importThreadMethod)); thrd.Start(); while (!_actionReady.WaitOne(100)) { System.Windows.Forms.Application.DoEvents(); } thrd.Join(); if (GeocacheIgnoreSupport.Instance.IgnoreCounter > 0) { using (Dialogs.GeocachesIgnoredMessageForm dlg = new Dialogs.GeocachesIgnoredMessageForm(Core, GeocacheIgnoreSupport.Instance.IgnoreCounter)) { dlg.ShowDialog(); } } } }