コード例 #1
0
 public void FindAllWords(string name, int top)
 {
     if (_isthreecc == 1)
     {
         ObservableCollection <Word> list = (Application.Current as App).ThreeCCDB.SelectObservableCollection <Word>(string.Format("select Name,Description_EN,Description_CN,Detail_EN,Detail_CN from ThreeCharClassic where Name like '{0}%' ", name));
         if (list == null || list.Count == 0)
         {
             AllWordsFound(null);
         }
         else
         {
             int count = Math.Min(list.Count, top);
             ObservableCollection <Word> retlist = new ObservableCollection <Word>();
             for (int ix = 0; ix < count; ix++)
             {
                 retlist.Add(list[ix]);
             }
             AllWordsFound(retlist);
         }
     }
     else
     {
         ObservableCollection <Word> list = (Application.Current as App).GlossaryDB.SelectObservableCollection <Word>(string.Format("select Name from SAPDictionary where Name like '{0}%' and Language='{1}' ", name, _lang));
         if (list == null || list.Count == 0)
         {
             if (!EnableRemote)
             {
                 if (AllWordsFound != null)
                 {
                     AllWordsFound(null);
                 }
             }
             else
             {
                 SAPDictionaryService.SAPDictionarySoapClient client = new SAPDictionaryService.SAPDictionarySoapClient();
                 client.FindAllWordsAsync(name, _lang, top);
                 client.FindAllWordsCompleted += new System.EventHandler <SAPDictionaryService.FindAllWordsCompletedEventArgs>(client_FindAllWordsCompleted);
             }
         }
         else
         {
             int count = Math.Min(list.Count, top);
             ObservableCollection <Word> retlist = new ObservableCollection <Word>();
             for (int ix = 0; ix < count; ix++)
             {
                 retlist.Add(list[ix]);
             }
             AllWordsFound(retlist);
         }
     }
 }
コード例 #2
0
 public void FindWordsByAlphabet(char letter)
 {
     if (_isthreecc == 1)
     {
         ObservableCollection <Word> list = (Application.Current as App).ThreeCCDB.SelectObservableCollection <Word>(string.Format("select Name,Description_EN,Description_CN,Detail_EN,Detail_CN from ThreeCharClassic where Name like '{0}%' ", letter));
         if (list == null || list.Count == 0)
         {
             WordsByAlphabetFound(null);
         }
         else
         {
             WordsByAlphabetFound(list);
         }
     }
     else
     {
         ObservableCollection <Word> list = (Application.Current as App).GlossaryDB.SelectObservableCollection <Word>(string.Format("select Name from SAPDictionary where Name like '{0}%' and Language='{1}' ", letter, _lang));
         if (list == null || list.Count == 0)
         {
             if (!EnableRemote)
             {
                 if (WordsByAlphabetFound != null)
                 {
                     WordsByAlphabetFound(null);
                 }
             }
             else
             {
                 SAPDictionaryService.SAPDictionarySoapClient client = new SAPDictionaryService.SAPDictionarySoapClient();
                 client.FindWordsByAlphabetAsync(letter, _lang);
                 client.FindWordsByAlphabetCompleted += new EventHandler <SAPDictionaryService.FindWordsByAlphabetCompletedEventArgs>(client_FindWordsByAlphabetCompleted);
             }
         }
         else
         {
             if (WordsByAlphabetFound != null)
             {
                 WordsByAlphabetFound(list);
             }
         }
     }
 }
コード例 #3
0
 public void FindTheWord(string name)
 {
     if (_isthreecc == 1)
     {
         List <Word> list = (Application.Current as App).ThreeCCDB.SelectList <Word>(string.Format("select Name,Description_EN,Description_CN,Detail_EN,Detail_CN from ThreeCharClassic where Name='{0}' ", name.ToUpper()));
         if (list == null || list.Count == 0)
         {
             _theword = null;
         }
         else
         {
             _theword = list[0];
         }
     }
     else
     {
         List <Word> list = (Application.Current as App).GlossaryDB.SelectList <Word>(string.Format("select Name, Domain, Description from SAPDictionary where Name like '{0}' and Language='{1}' ", name, _lang));
         if (list == null || list.Count == 0)
         {
             if (!EnableRemote)
             {
                 _theword = null;
             }
             else
             {
                 SAPDictionaryService.SAPDictionarySoapClient client = new SAPDictionaryService.SAPDictionarySoapClient();
                 client.FindTheWordAsync(name, _lang);
                 client.FindTheWordCompleted += new EventHandler <SAPDictionaryService.FindTheWordCompletedEventArgs>(client_FindTheWordCompleted);
             }
         }
         else
         {
             _theword = list[0];
         }
     }
     if (TheWordFound != null)
     {
         TheWordFound(_theword);
     }
 }