예제 #1
0
 public override void Deactivate()
 {
     if (_gatherControl != null)
     {
         _gatherControl.Cleanup();
     }
     // get the counts cached before we deactivate
     GetRemainingCount();
     GetReferenceCount();
     base.Deactivate();
     _gatherControl.Dispose();
     _gatherControl = null;
     UpdateCurrentWords();             // clears out orphan records
 }
예제 #2
0
        public override void Activate()
        {
#if DEBUG
            //Thread.Sleep(5000);
#endif

            base.Activate();
            var parser = WeSayWordsProject.Project.Container.Resolve <LocalizedListParser>();

            parser.ReadListFile();
            _semanticDomainWritingSystem =
                BasilProject.Project.WritingSystems.Get(WritingSystemIdForNamesAndQuestions);
            if (DomainKeys == null)
            {
                _domainKeys      = parser.Keys;
                _domainQuestions = parser.QuestionDictionary;

                // always have at least one domain and one question
                // so default indexes of 0 are valid.
                if (_domainKeys.Count == 0)
                {
                    _domainKeys.Add(string.Empty);
                }
                if (_domainQuestions.Count == 0)
                {
                    var emptyList = new List <string>();
                    emptyList.Add(string.Empty);
                    _domainQuestions.Add(string.Empty, emptyList);
                }
            }
            if (_semanticDomainOptionsList == null)
            {
                _semanticDomainOptionsList = parser.OptionsList;
            }
            ReadTaskMemory();

            UpdateCurrentWords();
            if (CurrentDomainIndex == -1)
            {            //this is probably never (or rarely?) encountered now that we have task memory
                GotoLastDomainWithAnswers();
            }
            _gatherControl = new GatherBySemanticDomainsControl(this);
        }