コード例 #1
0
        void BLanguageFilterClick(object sender, EventArgs e)
        {
            DefaultTranslateProfile pf = defaultProfile;

            DefaultProfileLanguagesForm form = new DefaultProfileLanguagesForm(pf);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                SubjectCollection subjects         = pf.GetSupportedSubjects();
                SubjectCollection subjectsToDelete = new SubjectCollection();

                foreach (string subject in pf.Subjects)
                {
                    if (!subjects.Contains(subject))
                    {
                        subjectsToDelete.Add(subject);
                    }
                }

                foreach (string subject in subjectsToDelete)
                {
                    pf.Subjects.Remove(subject);
                }

                LanguagePairCollection toDelete = new LanguagePairCollection();
                foreach (LanguagePair lp in pf.History)
                {
                    if (pf.DisabledSourceLanguages.Contains(lp.From) ||
                        pf.DisabledTargetLanguages.Contains(lp.To))
                    {
                        toDelete.Add(lp);
                    }
                }

                foreach (LanguagePair lp in toDelete)
                {
                    pf.History.Remove(lp);
                }
            }
            form.Dispose();
            changed = true;
        }
コード例 #2
0
        void AFilterLanguagesExecute(object sender, EventArgs e)
        {
            DefaultTranslateProfile pf = currentProfile as DefaultTranslateProfile;
            if(pf == null)
                return;

            pf.DisabledLanguagesAlreadySet = true;
            DefaultProfileLanguagesForm form = new DefaultProfileLanguagesForm(pf);
            if(form.ShowDialog(this) == DialogResult.OK)
            {
                SubjectCollection subjects = pf.GetSupportedSubjects();
                SubjectCollection subjectsToDelete = new SubjectCollection();

                foreach(string subject in pf.Subjects)
                {
                    if(!subjects.Contains(subject))
                        subjectsToDelete.Add(subject);
                }

                foreach(string subject in subjectsToDelete)
                    pf.Subjects.Remove(subject);

                LanguagePairCollection toDelete = new LanguagePairCollection();
                foreach(LanguagePair lp in pf.History)
                {
                    if(pf.DisabledSourceLanguages.Contains(lp.From) ||
                        pf.DisabledTargetLanguages.Contains(lp.To))
                    {
                        toDelete.Add(lp);
                    }
                }

                foreach(LanguagePair lp in toDelete)
                    pf.History.Remove(lp);
                languageSelector.Profile = currentProfile;
            }
            form.Dispose();
        }
コード例 #3
0
        void BLanguageFilterClick(object sender, EventArgs e)
        {
            DefaultTranslateProfile pf = defaultProfile;

            DefaultProfileLanguagesForm form = new DefaultProfileLanguagesForm(pf);
            if(form.ShowDialog(this) == DialogResult.OK)
            {
                SubjectCollection subjects = pf.GetSupportedSubjects();
                SubjectCollection subjectsToDelete = new SubjectCollection();

                foreach(string subject in pf.Subjects)
                {
                    if(!subjects.Contains(subject))
                        subjectsToDelete.Add(subject);
                }

                foreach(string subject in subjectsToDelete)
                    pf.Subjects.Remove(subject);

                LanguagePairCollection toDelete = new LanguagePairCollection();
                foreach(LanguagePair lp in pf.History)
                {
                    if(pf.DisabledSourceLanguages.Contains(lp.From) ||
                        pf.DisabledTargetLanguages.Contains(lp.To))
                    {
                        toDelete.Add(lp);
                    }
                }

                foreach(LanguagePair lp in toDelete)
                    pf.History.Remove(lp);
            }
            form.Dispose();
            changed = true;
        }