Example #1
0
 internal TermBaseQuery(TermBaseSet termbaseSet)
 {
     _TermbaseSet = termbaseSet;
     _Worker      = new TermBaseQueryWorker(this, _TermbaseSet.TermBases);
     LCID1        = -1;
     LCID2        = -1;
 }
Example #2
0
        // ********************************************************************************
        /// <summary>
        /// 
        /// </summary>
        /// <param name="srcTerm"></param>
        /// <param name="termbaseSet"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        /// <created>UPh,17.11.2015</created>
        /// <changed>UPh,17.11.2015</changed>
        // ********************************************************************************
        public void SetData(string srcTerm, TermBaseSet termbaseSet, List<TermInfoResultArgs> result)
        {
            _TermbaseSet = termbaseSet;
            _Result = result;

            txtSrcTerm.Text = srcTerm;
            FillCombo();

            if (cmbMatches.Items.Count > 0)
                cmbMatches.SelectedIndex = 0;
        }
Example #3
0
        // ********************************************************************************
        /// <summary>
        ///
        /// </summary>
        /// <param name="srcTerm"></param>
        /// <param name="termbaseSet"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        /// <created>UPh,17.11.2015</created>
        /// <changed>UPh,17.11.2015</changed>
        // ********************************************************************************
        public void SetData(string srcTerm, TermBaseSet termbaseSet, List <TermInfoResultArgs> result)
        {
            _TermbaseSet = termbaseSet;
            _Result      = result;

            txtSrcTerm.Text = srcTerm;
            FillCombo();

            if (cmbMatches.Items.Count > 0)
            {
                cmbMatches.SelectedIndex = 0;
            }
        }
Example #4
0
        // ********************************************************************************
        /// <summary>
        /// 
        /// </summary>
        /// <param name="set"></param>
        /// <returns></returns>
        /// <created>UPh,29.08.2015</created>
        /// <changed>UPh,29.08.2015</changed>
        // ********************************************************************************
        public TermBaseSelectionForm(TermBaseSet set)
        {
            if (PlProfile.Type != PlProfile.ProfileType.Unknown)
            {
                _StorePosition = new PlStorePosition();
                _StorePosition.Initialize(this);
            }
            InitializeComponent();

            DataChanged = false;
            _TermbaseSet = set;

            lstFiles.FillList(_TermbaseSet);
            lstFiles.ActiveChanged += lstFiles_ActiveChanged;

            UpdateControls();
        }
        // ********************************************************************************
        /// <summary>
        ///
        /// </summary>
        /// <param name="set"></param>
        /// <returns></returns>
        /// <created>UPh,29.08.2015</created>
        /// <changed>UPh,29.08.2015</changed>
        // ********************************************************************************
        public TermBaseSelectionForm(TermBaseSet set)
        {
            if (PlProfile.Type != PlProfile.ProfileType.Unknown)
            {
                _StorePosition = new PlStorePosition();
                _StorePosition.Initialize(this);
            }
            InitializeComponent();

            DataChanged  = false;
            _TermbaseSet = set;

            lstFiles.FillList(_TermbaseSet);
            lstFiles.ActiveChanged += lstFiles_ActiveChanged;

            UpdateControls();
        }
Example #6
0
        // ********************************************************************************
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        /// <created>UPh,31.10.2015</created>
        /// <changed>UPh,31.10.2015</changed>
        // ********************************************************************************
        public MainForm()
        {
            CultureInfo ci = new CultureInfo("en-US");
            Thread.CurrentThread.CurrentCulture = ci;
            Thread.CurrentThread.CurrentUICulture = ci;

            Icon = Resources.app;

            string inipath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            inipath = Path.Combine(inipath, "EasyTermViewer\\profile.ini");
            PlProfile.SetProfileName(inipath, PlProfile.ProfileType.IniFile);
            EasyTermCoreSettings.ProfilePath = inipath;

            _StorePosition = new PlStorePosition();
            _StorePosition.Initialize(this);

            InitializeComponent();

            _TermbaseSet = new TermBaseSet();
            _TermbaseSet.SettingsFile = Environment.ExpandEnvironmentVariables("%appdata%\\EasyTermViewer\\settings.xml");
            Directory.CreateDirectory(Path.GetDirectoryName(_TermbaseSet.SettingsFile));

            _TermbaseSet.LoadStoredAndLocal();
            _TermBaseQuery = _TermbaseSet.Query;

            _TermBaseQuery.TermListResult    += TermBaseQuery_TermListResult;
            _TermBaseQuery.TermInfoResult    += TermBaseQuery_TermInfoResult;
            _TermBaseQuery.TerminologyResult += TermBaseQuery_TerminologyResult;

            _TermListResult = new TermListResultCallback(OnTermListResult);
            _TermInfoResult = new TermInfoResultCallback(OnTermInfoResult);
            _TerminologyResult = new TerminologyResultCallback(OnTerminologyResult);

            lstTerms.TermBaseSet = _TermbaseSet;
            lstTerminology.TermBaseSet = _TermbaseSet;

            lstTerms.Dock = DockStyle.Fill;
            lstTerminology.Dock = DockStyle.Fill;

            FindType = FindTypes.Text;

            InitializeLanguageComboBoxes();
            InitializeLanguageSelection();
        }
Example #7
0
        // ********************************************************************************
        /// <summary>
        /// 
        /// </summary>
        /// <param name="init"></param>
        /// <param name="apptools"></param>
        /// <param name="addin"></param>
        /// <returns></returns>
        /// <created>UPh,07.11.2015</created>
        /// <changed>UPh,07.11.2015</changed>
        // ********************************************************************************
        public override int Initialize(CPAIInit init, CPAIApplicationTools apptools, CPAIAddIn addin)
        {
            _AddIn = addin;

            init.Ident = "EasyTerm";
            init.InfoText = "Provides terminology from tbx,csv and MultiTerm files";
            init.Name = "EasyTerm";
            init.Type = AddinType.Translate | AddinType.Tools;
            init.Style = enmPAIStyle.SetupData;

            if (!init.IsRegistration)
            {
                _TermBaseSet = new TermBaseSet();
                string dataFolder = addin.GetDataFolder();
                _TermBaseSet.SettingsFile = Path.Combine(dataFolder, "settings.xml");
                _TermBaseSet.LoadStoredAndLocal();
            }

            return 0;
        }
Example #8
0
        // ********************************************************************************
        /// <summary>
        /// 
        /// </summary>
        /// <param name="resource"></param>
        /// <param name="checker"></param>
        /// <returns></returns>
        /// <created>UPh,29.11.2015</created>
        /// <changed>UPh,29.11.2015</changed>
        // ********************************************************************************
        public override uint BeginCheckTokens(Pass.AddIn.Core.CPAIResource resource, Pass.AddIn.Core.CPAITokenCheck checker)
        {
            if (_AddInComponent == null)
            {
                _AddInComponent = AddInInstance as EasyTermAddInComponent;
                if (_AddInComponent == null)
                    return 0;

                _TermBaseSet = _AddInComponent._TermBaseSet;
                if (_TermBaseSet == null)
                    return 0;

                _Query = _TermBaseSet.Query;
            }

            bCheckTermUsage       = false;
            bCheckProhibitedTerms = false;

            if (_Query == null)
                return 0;

            var stringlist = checker.GetStringList();
            if (stringlist == null)
                return 0;

            var listinfo = stringlist.GetListInfo();
            if (listinfo == null)
                return 0;

            checker.GetOption(PslConstant.TCO_CUSTOM_0, ref bCheckTermUsage);
            checker.GetOption(PslConstant.TCO_CUSTOM_1, ref bCheckProhibitedTerms);
            if (!bCheckProhibitedTerms && !bCheckTermUsage)
                return 0;

            _Query.SetLanguagePair(listinfo.Lang1, listinfo.Lang2);

            return 0;
        }
Example #9
0
        // ********************************************************************************
        /// <summary>
        /// Syncs this TermBase list with the TermBaseSet
        /// </summary>
        /// <param name="set"></param>
        /// <returns></returns>
        /// <created>UPh,25.10.2015</created>
        /// <changed>UPh,25.10.2015</changed>
        // ********************************************************************************
        internal void Update(TermBaseSet set, int lcid1, int lcid2)
        {
            TermBases newList = new TermBases();

            foreach (TermBaseFile file in set.Files)
            {
                file.OpenError = "";

                if (!file.Active)
                {
                    continue;
                }

                // Check if we already have this file
                TermBase tb = FindTermBase(file);
                if (tb != null)
                {
                    // Add existing termbase
                    newList.Add(tb);
                    Remove(tb);
                }
                else
                {
                    // Add new termbase
                    tb = TermBaseFactory.CreateTermBase(file);
                    if (tb != null)
                    {
                        newList.Add(tb);
                        tb.InitLanguagePair(lcid1, lcid2);
                    }
                }
            }

            // Copy new list
            Clear();
            AddRange(newList);
        }
Example #10
0
        // ********************************************************************************
        /// <summary>
        ///
        /// </summary>
        /// <param name="set"></param>
        /// <returns></returns>
        /// <created>UPh,29.08.2015</created>
        /// <changed>UPh,29.08.2015</changed>
        // ********************************************************************************
        internal void FillList(TermBaseSet set)
        {
            Items.Clear();

            Items.AddRange(set.Files.ToArray());
        }
Example #11
0
        // ********************************************************************************
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        /// <created>UPh,07.11.2015</created>
        /// <changed>UPh,07.11.2015</changed>
        // ********************************************************************************
        void InitializeTermbase()
        {
            _AddInComponent = AddInInstance as EasyTermAddInComponent;
            if (_AddInComponent == null)
                return;

            _TermBaseSet = _AddInComponent._TermBaseSet;
            _Query = _TermBaseSet.Query;

            _Query.TerminologyResult += Query_TerminologyResult;
        }
Example #12
0
        // ********************************************************************************
        /// <summary>
        /// 
        /// </summary>
        /// <param name="set"></param>
        /// <returns></returns>
        /// <created>UPh,29.08.2015</created>
        /// <changed>UPh,29.08.2015</changed>
        // ********************************************************************************
        internal void FillList(TermBaseSet set)
        {
            Items.Clear();

            Items.AddRange(set.Files.ToArray());
        }