Inheritance: PreferencesBase
        /// <summary>
        /// Performs initialization.  Must be called first.
        /// Sets word prediction parameters and initializes Presage
        /// </summary>
        /// <returns>true on success</returns>
        public bool Init()
        {
            bool retVal = false;

            try
            {
                Attributions.Add("PRESAGE",
                                Resources.PresageAttribution);

                Settings.PreferencesFilePath = UserManager.GetFullPath(SettingsFileName);

                _presageSettings = Settings.Load();

                if (_presageSettings.StartPresageIfNotRunning)
                {
                    checkAndRunPresage();
                }

                retVal = initPresage();
                if (!retVal)
                {
                    // failure mostly means the presage config file has an
                    // incorrect database path.  Delete the config file so
                    // it will regenerate and then we can insert the correct
                    // database path when we init again
                    deletePresageConfigFile();
                    retVal = initPresage();
                }
            }
            catch (Exception ex)
            {
                Log.Debug("Error initializing Presage. " + ex);
            }

            return retVal;
        }
Esempio n. 2
0
        /// <summary>
        /// Performs initialization.  Must be called first.
        /// Sets word prediction parameters and initializes Presage
        /// </summary>
        /// <returns>true on success</returns>
        public bool Init()
        {
            bool retVal = false;

            try
            {
                Attributions.Add("PRESAGE",
                                "Predictive text functionality is powered by Presage, the " +
                                "intelligent predictive text engine created by Matteo Vescovi. " +
                                "(http://presage.sourceforge.net/)");

                Settings.PreferencesFilePath = UserManager.GetFullPath(SettingsFileName);

                _presageSettings = Settings.Load();

                if (_presageSettings.StartPresageIfNotRunning)
                {
                    checkAndRunPresage();
                }

                retVal = initPresage();
                if (!retVal)
                {
                    // failure mostly means the presage config file has an
                    // incorrect database path.  Delete the config file so
                    // it will regenerate and then we can insert the correct
                    // database path when we init again
                    deletePresageConfigFile();
                    retVal = initPresage();
                }
            }
            catch (Exception ex)
            {
                Log.Debug("Error initializing Presage. " + ex);
            }

            return retVal;
        }