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); }
public void SetTheme(string name) { string themeName = $"{ApplicationSettingsConstant.ThemePrefix}{name}"; _globalOptionService.SetOption(new GlobalOption { OptionKey = themeName, OptionValue = name }); }
public void SaveSponsor(SponsorZip sponsorZip) { Queue <Guid> keys = new Queue <Guid>(); keys.Enqueue(new Guid("61c98633-6a56-4e6c-b778-67ca9c2fd788")); keys.Enqueue(new Guid("5dcf147e-ca79-46e6-b0bc-56f72712bbcc")); keys.Enqueue(new Guid("3a4c4e4c-a8e7-42a5-b443-bf7ce06b4dc9")); keys.Enqueue(new Guid("8a4fc4db-32ad-43e0-9c4f-a53a723556e1")); keys.Enqueue(new Guid("8868a907-81fd-4fbe-b6ba-bd41aec38113")); keys.Enqueue(new Guid("98ef9d9e-010b-4c42-a9b4-0af1400fadf2")); keys.Enqueue(new Guid("59cddf7c-8f63-46d2-8c39-2b76b0e929ef")); keys.Enqueue(new Guid("f33afe4b-dea7-41c4-86da-307f108eae90")); keys.Enqueue(new Guid("ff7f8731-427f-4d3f-b9cb-c7e1eee07576")); List <Sponsor> result = new List <Sponsor>(); if (sponsorZip == null || sponsorZip.ZipFile.IsEmpty()) { } else { } string fileName = ApplicationSettingsConstant.SponsorFileName; string path = Path.Combine(_crossFileService.GetDefaultDirectory(), ApplicationSettingsConstant.DocumentsDirectory, fileName); if (!_crossFileService.IsFileExists(path)) { StringBuilder sb = new StringBuilder(); sb.AppendLine(SettingConstant.milkDigitalID); sb.AppendLine(SettingConstant.SilverDigitalID); sb.AppendLine(SettingConstant.EarsWebSite); _crossFileService.Save(sb.ToString(), path); } string content = _crossFileService.Load(path); string[] sponsorEntries = Regex.Split(content, Environment.NewLine); foreach (string sponsorEntry in sponsorEntries) { string[] sponsorAttributes = sponsorEntry.Split(','); if (sponsorAttributes.Length == 3) { Sponsor sponsor = new Sponsor(); if (sponsorAttributes[1].Contains("Club")) { sponsor.SponsorKey = Guid.Empty; } else { sponsor.SponsorKey = keys.Dequeue(); } sponsor.SponsorIcon = sponsorAttributes[0].ConvertToBase64String(); sponsor.SponsorName = sponsorAttributes[1].Trim(); sponsor.SponsorUrl = sponsorAttributes[2].Trim(); result.Add(sponsor); } } // Store Sponsor List to database if needed // Store the new sponsor id and list for re-use.....Andy string sponsorList = JsonConvert.SerializeObject(result); _globalOptionService.SetOption(SettingConstant.SponsorListKey, sponsorList); string sponsorId = sponsorZip == null? _globalOptionService.GetOptionContent(SettingConstant.SponsorIdKey) : sponsorZip.ZipId.ToString(); _globalOptionService.SetOption(SettingConstant.SponsorIdKey, sponsorId); }
public void CheckSponsor() { string registrationId = _globalOptionService.GetOptionContent(SettingConstant.RegistrationKey); string promoCode = _globalOptionService.GetOptionContent(SettingConstant.PromoCodeKey); //we have sponsor info from the database string sponsorId = _globalOptionService.GetOptionContent(SettingConstant.SponsorIdKey); // now compare sponsorid with the web sponsor id string newSponsorId = GetSponsorId(registrationId, promoCode); // If they ( web and databse) match then download new sponsorinfo // There is a good change both of them are null. // a new user who couldn't connect to the web if (sponsorId == null && newSponsorId == null) { _sponsorService.SaveSponsor(sponsorZip: null); return; } // existing sponsor user who couldn't connect to the web if (sponsorId != null && newSponsorId == null) { // stay with current one and exit return; } if (sponsorId != newSponsorId) { _sponsorService.SaveSponsor(GetSponsorData()); // Update New SponsorId _globalOptionService.SetOption(SettingConstant.SponsorIdKey, newSponsorId); } }