示例#1
0
        private void InitializeCulture()
        {
            /* if we were targeting Windows Phone, we'd want to include the next line. */
            // if (Device.OS != TargetPlatform.WinPhone)
            TextResources.Culture = DependencyService.Get <ILocalize>().GetCurrentCultureInfo();

            // Get user's culture preference

            GlobalOption culture
                = _globalOptionService.GetOption(SettingConstant.MachineKey);

            // Get global default preference

            if (culture == null)
            {
                // check for culture text file

                try
                {
                    //string _culturefileName = System.IO.Path.Combine(System.Windows.Forms.Application.StartupPath, "culture.txt");
                    //if (System.IO.File.Exists(_culturefileName))
                    //{
                    //    string _culName = System.IO.File.ReadAllText(_culturefileName);
                    //    System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo(_culName);
                    //    System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo(_culName);
                    //    //
                    //    OptionManager.SetGlobalOptionValue("Culture", _culName);
                    //    //System.IO.File.Delete(_culturefileName);

                    //}



                    //else // leave whatever we have in the Current Culture
                    //{ //set the current one

                    //}
                }
                catch (System.Exception e)
                {
                    _logService.LogException(e);
                }
            }

            _logService.Log("Copying OEM Files", ApplicationSettingsConstant.InstallerFileName);


            _logService.Log("Setting FirstRunComplete Flag...");

            _globalOptionService.SetOption(SettingConstant.FirstRunCompleteKey, "true");

            // Set the date in USA standard
            IFormatProvider dtculture = new CultureInfo("en-US");

            string dt = DateTime.UtcNow.ToString(dtculture);

            _globalOptionService.SetOption(SettingConstant.DateInstalledKey, dt); // added : July 4th, 2008
            _logService.Log(string.Format("{0} {1}", "End StarupManager.DoFirstRunTasks.", dt), ApplicationSettingsConstant.InstallerFileName);
        }
示例#2
0
        /// <summary>
        /// 设置配置项
        /// </summary>
        /// <param name="key">键</param>
        /// <param name="value">值</param>
        /// <returns></returns>
        public static Boolean SetOption(String key, String value)
        {
            GlobalOption model = null;
            String       sql   = String.Format("UPDATE global_options SET value = '{1}' WHERE key = '{0}'", key, value);
            int          num   = SQLiteHelper.ExecuteNonQuery(SQLiteHelper.ConnectionStringLocalTransaction, System.Data.CommandType.Text, sql);

            return(num > 0);
        }
        public GlobalOption GetOption(string ID)
        {
            GlobalOption returnMe = null;

            try
            {
                returnMe = database.Table <GlobalOption>().Where(d => d.ID == ID).FirstOrDefaultAsync().Result;
            }
            catch (Exception)
            {
            }
            return(returnMe);
        }
示例#4
0
        public void SetOption(GlobalOption option)
        {
            var selectedOption = GetOption(option.OptionKey);

            if (selectedOption == null)
            {
                _optionContext.Save(option);
            }
            else
            {
                selectedOption.OptionValue = option.OptionValue;
                _optionContext.Update(selectedOption);
            }
        }
示例#5
0
        public void SetOption(string key, string value)
        {
            var selectedOption = GetOption(key);

            if (selectedOption == null)
            {
                GlobalOption option = new GlobalOption
                {
                    OptionKey   = key,
                    OptionValue = value
                };
                _optionContext.Save(option);
            }
            else
            {
                selectedOption.OptionValue = value;
                _optionContext.Update(selectedOption);
            }
        }
示例#6
0
        /// <summary>
        /// 获取配置项
        /// </summary>
        /// <param name="key">键</param>
        /// <returns></returns>
        public static GlobalOption GetOption(String key)
        {
            GlobalOption model = null;
            String       sql   = String.Format("SELECT * FROM global_options WHERE key = '{0}'", key);

            using (SQLiteDataReader reader = SQLiteHelper.ExecuteReader(SQLiteHelper.ConnectionStringLocalTransaction, System.Data.CommandType.Text, sql))
            {
                if (reader.Read())
                {
                    model = new GlobalOption();
                    if (reader["id"] != null && reader["id"].ToString() != "")
                    {
                        model.Id = int.Parse(reader["id"].ToString());
                    }
                    if (reader["key"] != null && reader["key"].ToString() != "")
                    {
                        model.Key = reader["key"].ToString();
                    }
                    if (reader["value"] != null && reader["value"].ToString() != "")
                    {
                        model.Value = reader["value"].ToString();
                    }
                    if (reader["desc"] != null)
                    {
                        model.Desc = reader["desc"].ToString();
                    }
                    if (reader["visible"] != null)
                    {
                        model.Visible = reader["visible"].ToString() == "1";
                    }
                    if (reader["created_at"] != null && reader["created_at"].ToString() != "")
                    {
                        model.CreatedAt = model.ConvertIntDateTime(Convert.ToInt32(reader["created_at"].ToString()));
                    }
                    if (reader["updated_at"] != null && reader["updated_at"].ToString() != "")
                    {
                        model.UpdatedAt = model.ConvertIntDateTime(Convert.ToInt32(reader["updated_at"].ToString()));
                    }
                }
            }
            return(model);
        }
示例#7
0
 public BaseController(IOptions <GlobalOption> globalOptions)
 {
     _globalOption = globalOptions.Value;
     _dbAccess     = new DbAccess(_globalOption);
 }
 public async Task SetOption(GlobalOption value)
 {
     await database.InsertOrReplaceAsync(value);
 }
示例#9
0
 void Awake()
 {
     instance = this;
     DontDestroyOnLoad(gameObject);
 }
示例#10
0
 public InstructionRoot(GlobalOption option)
 {
     _globalOptions.Add(option);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GlobalOptionRequest"/> class.
 /// </summary>
 /// <param name="option">The global option type.</param>
 /// <param name="arg">The additional argument.</param>
 public GlobalOptionRequest(GlobalOption option, string arg)
 {
     Lines = new string[1];
      Lines[0] = string.Format("{0} {1} {2}", RequestName, option.ToRequestString(), arg);
 }