コード例 #1
0
        public void AddSelectionToHistory()
        {
            if (lbFrom.SelectedIndex == -1 || lbTo.SelectedIndex == -1)
            {
                return;
            }

            LanguageContainerPair currSel = new LanguageContainerPair((LanguageDataContainer)lbFrom.SelectedItem, (LanguageDataContainer)lbTo.SelectedItem);
            int idx = lbHistory.Items.IndexOf(currSel);

            if (idx != -1)
            {
                lbHistory.Items.RemoveAt(idx);
            }
            lbHistory.Items.Insert(0, currSel);
            lbHistory.SelectedIndex = 0;

            LanguagePair lp = new LanguagePair(currSel.From.Language, currSel.To.Language);

            idx = history.IndexOf(lp);
            if (idx != -1)
            {
                history.RemoveAt(idx);
            }
            history.Insert(0, lp);
        }
コード例 #2
0
        public override ReadOnlyLanguagePairCollection GetLanguagePairs()
        {
            PrepareProcessing();
            LanguagePairCollection result = new LanguagePairCollection();

            int index;

            foreach (ServiceItemData sid in services)
            {
                if (Subjects.BinarySearch(sid.Subject) >= 0)
                {
                    index = result.BinarySearch(sid.LanguagePair);
                    if (index < 0)
                    {
                        result.Insert(~index, sid.LanguagePair);
                    }
                }
            }

            return(new ReadOnlyLanguagePairCollection(result));
        }
コード例 #3
0
        public override ReadOnlyLanguagePairCollection GetLanguagePairs()
        {
            PrepareProcessing();
            LanguagePairCollection result = new LanguagePairCollection();

            int index;

            foreach (ServiceItem item in Manager.ServiceItems)
            {
                foreach (string subject in item.SupportedSubjects)
                {
                    if (Subjects.BinarySearch(subject) >= 0)
                    {
                        foreach (LanguagePair lp in item.SupportedTranslations)
                        {
                            if (disabledSourceLanguages.BinarySearch(lp.From) >= 0)
                            {
                                continue;
                            }

                            if (disabledTargetLanguages.BinarySearch(lp.To) >= 0)
                            {
                                continue;
                            }

                            index = result.BinarySearch(lp);
                            if (index < 0)
                            {
                                result.Insert(~index, lp);
                            }
                        }
                    }
                }
            }

            return(new ReadOnlyLanguagePairCollection(result));
        }
コード例 #4
0
        public override ReadOnlyLanguagePairCollection GetLanguagePairs()
        {
            PrepareProcessing();
            LanguagePairCollection result = new LanguagePairCollection();

            int index;
            foreach(ServiceItem item in Manager.ServiceItems)
            {
                foreach(string subject in item.SupportedSubjects)
                {
                    if(Subjects.BinarySearch(subject) >= 0)
                    {
                        foreach(LanguagePair lp in item.SupportedTranslations)
                        {
                            if(disabledSourceLanguages.BinarySearch(lp.From) >= 0)
                                continue;

                            if(disabledTargetLanguages.BinarySearch(lp.To) >= 0)
                                continue;

                            index = result.BinarySearch(lp);
                            if(index < 0)
                            {
                                result.Insert(~index,lp);
                            }
                        }
                    }
                }
            }

            return new ReadOnlyLanguagePairCollection(result);
        }