Exemple #1
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();
        }
        // ********************************************************************************
        /// <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;
        }