Пример #1
0
        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
        }
Пример #2
0
 public override void Deactivate()
 {
     base.Deactivate();
     _dictionaryControl.Dispose();
     _dictionaryControl = null;
 }