Exemple #1
0
 private void SearchSemanticDomains(string searchString)
 {
     // The FindDomainsThatMatch method returns IEnumerable<ICmSemanticDomain>
     // based on the search string we give it.
     m_textSearch.Update();
     if (!string.IsNullOrEmpty(searchString))
     {
         try
         {
             m_listView.ItemChecked -= OnDomainListChecked;
             var semDomainsToShow = m_semDomRepo.FindDomainsThatMatch(searchString);
             SemanticDomainSelectionUtility.UpdateDomainListLabels(
                 ObjectLabel.CreateObjectLabels(m_cache, semDomainsToShow, string.Empty,
                                                m_cache.LanguageWritingSystemFactoryAccessor.GetStrFromWs(m_cache.DefaultAnalWs)),
                 m_stylesheet, m_listView, true);
             m_treeView.Visible = false;
             m_listView.Visible = true;
             m_btnCancelSearch.SearchIsActive = true;
         }
         finally
         {
             m_listView.ItemChecked += OnDomainListChecked;
         }
     }
     else
     {
         m_treeView.Visible = true;
         m_listView.Visible = false;
         m_btnCancelSearch.SearchIsActive = false;
     }
 }
Exemple #2
0
        private void SearchSemanticDomains()
        {
            IEnumerable <ObjectLabel> labels = new List <ObjectLabel>();

            // The FindDomainsThatMatch method returns IEnumerable<ICmSemanticDomain>
            // based on the search string we give it.
            var searchString = TrimmedSearchBoxText;

            if (!string.IsNullOrEmpty(searchString))
            {
                btnCancelSearch.SearchIsActive = true;
                domainList.ItemChecked        -= OnDomainListChecked;
                var semDomainsToShow = m_semdomRepo.FindDomainsThatMatch(searchString);
                SemanticDomainSelectionUtility.UpdateDomainListLabels(
                    ObjectLabel.CreateObjectLabels(Cache, semDomainsToShow, string.Empty, DisplayWs),
                    m_stylesheet, domainList, displayUsageCheckBox.Checked);
                domainTree.Visible      = false;
                domainList.Visible      = true;
                domainList.ItemChecked += OnDomainListChecked;
            }
            else
            {
                domainTree.Visible             = true;
                domainList.Visible             = false;
                btnCancelSearch.SearchIsActive = false;
            }
            SearchInProgress = false;
        }
Exemple #3
0
        private void SearchSemanticDomains()
        {
            IEnumerable <ObjectLabel> labels = new List <ObjectLabel>();

            // The FindDomainsThatMatch method returns IEnumerable<ICmSemanticDomain>
            // based on the search string we give it.
            var searchString = TrimmedSearchBoxText;

            if (!string.IsNullOrEmpty(searchString))
            {
                if (m_searchIconSet)
                {
                    // When disabled, we use a Background image rather than a regular image so that it
                    // does not gray out. When showing the search icon, the button is never enabled,
                    // so it is a shame to have it grey-out our pretty magnifying glass. The X however
                    // can work as a normal button image (which avoids needing to make it larger
                    // than the button etc. in order to avoid repeating it as wallpaper, which is how
                    // BackgroundImage works.)
                    btnCancelSearch.Image           = FieldWorks.Resources.Images.X;
                    btnCancelSearch.BackgroundImage = null;
                    m_searchIconSet         = false;
                    btnCancelSearch.Enabled = true;
                }
                domainList.ItemChecked -= OnDomainListChecked;
                var semDomainsToShow = m_semdomRepo.FindDomainsThatMatch(searchString);
                SemanticDomainSelectionUtility.UpdateDomainListLabels(ObjectLabel.CreateObjectLabels(Cache, semDomainsToShow, string.Empty, DisplayWs), domainList, displayUsageCheckBox.Checked);
                domainTree.Visible      = false;
                domainList.Visible      = true;
                domainList.ItemChecked += OnDomainListChecked;
            }
            else
            {
                domainTree.Visible = true;
                domainList.Visible = false;
                if (!m_searchIconSet)
                {
                    btnCancelSearch.BackgroundImage = FieldWorks.Resources.Images.Search;
                    btnCancelSearch.Image           = null;
                    m_searchIconSet         = true;
                    btnCancelSearch.Enabled = false;
                }
            }
        }
        public void FindOneDomain_Alpha_WholeWordMatchesGroup1CaseInsensitive()
        {
            //Setup
            const string searchString = "sky";
            const string expectedNum  = "1.1";            // group1 match
            const string expectedName = "Sky";
            const string expectedNum2 = "8.3.3";          // group3 match

            // SUT
            var result = m_semdomRepo.FindDomainsThatMatch(searchString);

            // Verification
            var resultList = result.ToList();
            var cresult    = resultList.Count;

            Assert.AreEqual(2, cresult, WRONG_NUMBER_OF_MATCHES);
            Assert.AreEqual(expectedNum, resultList[0].Abbreviation.BestAnalysisAlternative.Text,
                            WRONG_SEMDOM_NUMBER);
            Assert.AreEqual(expectedName, resultList[0].Name.BestAnalysisAlternative.Text,
                            WRONG_SEMDOM_NAME);
            Assert.AreEqual(expectedNum2, resultList[1].Abbreviation.BestAnalysisAlternative.Text,
                            WRONG_SEMDOM_NUMBER);
        }