public override void Activate() { try { base.Activate(); // _dictionaryControl = new DictionaryControl(LexEntryRepository, ViewTemplate, _taskMemory.CreateNewSection("view"), _logger); var temp = _taskMemory.CreateNewSection("view"); _dictionaryControl = _dictionaryControlFactory(temp); _dictionaryControl.SelectedIndexChanged += new EventHandler(OnSelectedEntryOfDictionaryControlChanged); // Debug.Assert(_userSettings.Get("one", "0") == "1"); var url = _taskMemory.Get(LastUrlKey, null); if (_taskMemory != null && url != null) { try { _dictionaryControl.GoToUrl(url); } catch (Exception error) { //there's no scenario where it is worth crashing or even notifying Logger.WriteEvent("Error: " + error.Message); #if DEBUG ErrorReport.NotifyUserOfProblem(error, "Could not find the entry at '{0}'\r\n{1}", url, error.Message); #endif } } else { _dictionaryControl.GotoFirstEntry(); } } catch (ConfigurationException) { IsActive = false; throw; } #if DEBUG //Thread.Sleep(5000); #endif }
public override void GoToUrl(string url) { try { if (IsActive) //activation may be delayed via a timer, if so, just file this away until we are ready for it { _dictionaryControl.GoToUrl(url); } else { if (_taskMemory != null) { _taskMemory.Set(LastUrlKey, url); } } } catch (Exception error) { Palaso.Reporting.ErrorReport.NotifyUserOfProblem("Could not navigate to {0}. {1}", url, error.Message); } }