private void GetLockScreenSetting() { string lockScreenValue = string.Empty; try { if (IS.GetSettingStringValue("Stopwatch-LockScreen") == string.Empty) { toggleLockScreen.IsChecked = false; toggleLockScreen.Content = AppResources.Disabled; } else { lockScreenValue = IS.GetSettingStringValue("Stopwatch-LockScreen"); if (lockScreenValue == "Enabled") { toggleLockScreen.IsChecked = true; toggleLockScreen.Content = AppResources.Enabled; } else { toggleLockScreen.IsChecked = false; toggleLockScreen.Content = AppResources.Disabled; } } } catch (Exception) { } }
//This proc will add 1 to the number of times the app has been opened and return that value and save that value public static int AppOpenedCount() { int returnValue = 0; string settingValue = string.Empty; try { if (IS.GetSettingStringValue("AppOpenedCount") != string.Empty) { settingValue = IS.GetSettingStringValue("AppOpenedCount"); returnValue = Convert.ToInt16(settingValue) + 1; IS.SaveSetting("AppOpenedCount", returnValue.ToString()); } else //has not been opened yet so intitialize as first time being opened { IS.SaveSetting("AppOpenedCount", "1"); returnValue = 1; } } catch (Exception) { ; return(0); } return(returnValue); }
private void GetCountdownAlarmSetting() { string countdownAlarmValue = string.Empty; try { if (IS.GetSettingStringValue("Countdown-Alarm") == string.Empty) { togglePlayAlarm.IsChecked = false; togglePlayAlarm.Content = AppResources.Disabled; } else { countdownAlarmValue = IS.GetSettingStringValue("Countdown-Alarm"); if (countdownAlarmValue == "Enabled") { togglePlayAlarm.IsChecked = true; togglePlayAlarm.Content = AppResources.Enabled; } else { togglePlayAlarm.IsChecked = false; togglePlayAlarm.Content = AppResources.Disabled; } } } catch (Exception) { } }
public Options() { string lockScreenValue = string.Empty; InitializeComponent(); if (IS.GetSettingStringValue("Stopwatch-LockScreen") == string.Empty) { toggleswitch.IsChecked = false; toggleswitch.Content = AppResources.Disabled; } else { lockScreenValue = IS.GetSettingStringValue("Stopwatch-LockScreen"); if (lockScreenValue == "Enabled") { toggleswitch.IsChecked = true; toggleswitch.Content = AppResources.Enabled; } else { toggleswitch.IsChecked = false; toggleswitch.Content = AppResources.Disabled; } } }
private TimeSpan GetCountdownDefaultTime() { TimeSpan returnValue; if (IS.GetSettingStringValue("Countdown-DefaultTime") == string.Empty) { returnValue = new TimeSpan(0, 1, 0); } else { returnValue = TimeSpan.Parse(IS.GetSettingStringValue("Countdown-DefaultTime")); } return(returnValue); }
private string GetLastCountdownValue() { string returnValue = string.Empty; if (IS.GetSettingStringValue("Countdown-LastValue") == string.Empty) { returnValue = string.Empty; } else { returnValue = IS.GetSettingStringValue("Countdown-LastValue"); } return(returnValue); }
private string GetCountdownAlarmSetting() { string returnValue = string.Empty; if (IS.GetSettingStringValue("Countdown-Alarm") == string.Empty) { returnValue = "Enabled"; IS.SaveSetting("Countdown-Alarm", "Enabled"); } else { returnValue = IS.GetSettingStringValue("Countdown-Alarm"); } return(returnValue); }
private void GetCountdownDefaultTime() { string countdownAlarmValue = string.Empty; try { if (IS.GetSettingStringValue("Countdown-DefaultTime") == string.Empty) { ctlDefaultCountdownTime.Value = new TimeSpan(0, 1, 0); } else { countdownAlarmValue = IS.GetSettingStringValue("Countdown-DefaultTime"); ctlDefaultCountdownTime.Value = TimeSpan.Parse(countdownAlarmValue); } } catch (Exception) { } }
public string IsStopWatchRunning() { string returnValue = string.Empty; try { if (IS.GetSettingStringValue("Stopwatch-IsRunning") != string.Empty) { returnValue = IS.GetSettingStringValue("Stopwatch-IsRunning"); } else { returnValue = "No"; } } catch (Exception) { return("No"); } return(returnValue); }
public void LoadLapAndSplitData() { string[] laps; string[] splits; laps = IS.GetSettingStringValue("Stopwatch-Laps").Split(','); splits = IS.GetSettingStringValue("Stopwatch-Splits").Split(','); for (int i = laps.Count() - 1; i >= 0; i--) { if (laps[i] != string.Empty) { StopwatchTimes stopwatchTimes = new StopwatchTimes(); stopwatchTimes.ItemCount = laps.Count() - i - 1; stopwatchTimes.LapTime = laps[i]; stopwatchTimes.SplitTime = splits[i]; StopwatchTimesCollection.Insert(0, stopwatchTimes); _lastSplitTime = TimeSpan.Parse(stopwatchTimes.SplitTime); } } }
public static string HasAppBeenRated() { string returnValue = string.Empty; try { if (IS.GetSettingStringValue("AppRated") != string.Empty) { returnValue = IS.GetSettingStringValue("AppRated"); } else { IS.SaveSetting("AppRated", "No"); returnValue = "No"; } } catch (Exception) { return("No"); } return(returnValue); }
private void SetLockScreenSetting() { string lockScreenValue = string.Empty; if (IS.GetSettingStringValue("Stopwatch-LockScreen") != string.Empty) { lockScreenValue = IS.GetSettingStringValue("Stopwatch-LockScreen"); if (lockScreenValue == "Enabled") { PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Enabled; } else { PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; } } else //if lockscreen setting not set then default to disabling lockscreen { PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; IS.SaveSetting("Stopwatch-LockScreen", "Disabled"); } }
//private void LoadPlayMusicSetting() //{ // string settingValue = string.Empty; // if (IS.GetSettingStringValue("BabyApp-PlayMusic").ToString() == string.Empty) // { // togglePlayMusic.IsChecked = false; // togglePlayMusic.Content = "Off"; // } // else // { // settingValue = IS.GetSettingStringValue("BabyApp-PlayMusic").ToString(); // if (settingValue == "On") // { // togglePlayMusic.IsChecked = true; // togglePlayMusic.Content = "On"; // } // else // { // togglePlayMusic.IsChecked = false; // togglePlayMusic.Content = "Off"; // } // } //} private void LoadShowTextSetting() { string settingValue = string.Empty; if (IS.GetSettingStringValue("BabyApp-ShowText").ToString() == string.Empty) { toggleShowText.IsChecked = false; toggleShowText.Content = "Off"; } else { settingValue = IS.GetSettingStringValue("BabyApp-ShowText").ToString(); if (settingValue == "On") { toggleShowText.IsChecked = true; toggleShowText.Content = "On"; } else { toggleShowText.IsChecked = false; toggleShowText.Content = "Off"; } } }
private void LoadPlaySoundSetting() { string settingValue = string.Empty; if (IS.GetSettingStringValue("BabyApp-PlaySounds").ToString() == string.Empty) { togglePlaySounds.IsChecked = false; togglePlaySounds.Content = "Off"; } else { settingValue = IS.GetSettingStringValue("BabyApp-PlaySounds").ToString(); if (settingValue == "On") { togglePlaySounds.IsChecked = true; togglePlaySounds.Content = "On"; } else { togglePlaySounds.IsChecked = false; togglePlaySounds.Content = "Off"; } } }
private async void WriteUserInfoToCloud(bool trial) { try { bool isAppPaid = false; if (App.FREE_VERSION) { if (App.DoesUserHaveAbilityToTrackAllStats()) { isAppPaid = true; } } else { if (!App.IsTrial) { isAppPaid = true; } } if (IS.GetSetting(USER_ID) == null) { string newGuid = Guid.NewGuid().ToString(); AllUsers rowToInsert = new AllUsers() { Guid = newGuid, TimesOpened = 1, FreeVersion = App.FREE_VERSION, TrialVersion = App.IsTrial, TotalTimeInApp = new TimeSpan(0, 0, 0), Paid = isAppPaid, LastLogin = DateTime.Now }; await App.MobileService.GetTable <AllUsers>().InsertAsync(rowToInsert); var newUserRow = await allUsersTable .Where(x => x.Guid == newGuid).ToListAsync(); _clientRow = newUserRow.FirstOrDefault(); //Update IS IS.SaveSetting(USER_ID, _clientRow.Id); //Remove the GUID, we no longer need it rowToInsert.Guid = string.Empty; await App.MobileService.GetTable <AllUsers>().UpdateAsync(rowToInsert); } //Update else { var rows = await allUsersTable .Where(x => x.Id == IS.GetSettingStringValue(USER_ID)).ToListAsync(); AllUsers userRow = rows.ToList().FirstOrDefault(); userRow.LastLogin = DateTime.Now; userRow.TimesOpened += 1; userRow.FreeVersion = App.FREE_VERSION; userRow.TrialVersion = App.IsTrial; userRow.Paid = isAppPaid; _clientRow = userRow; await App.MobileService.GetTable <AllUsers>().UpdateAsync(userRow); } } catch (Exception ex) { } }
private void LoadLanguageSettings() { string settingValue = string.Empty; try { if (IS.GetSettingStringValue("BabyApp-English").ToString() == string.Empty) { chkEnglish.IsChecked = false; } else { settingValue = IS.GetSettingStringValue("BabyApp-English").ToString(); if (settingValue == "Yes") { chkEnglish.IsChecked = true; } else { chkEnglish.IsChecked = false; } } if (IS.GetSettingStringValue("BabyApp-Spanish").ToString() == string.Empty) { chkSpanish.IsChecked = false; } else { settingValue = IS.GetSettingStringValue("BabyApp-Spanish").ToString(); if (settingValue == "Yes") { chkSpanish.IsChecked = true; } else { chkSpanish.IsChecked = false; } } if (IS.GetSettingStringValue("BabyApp-Italian") == string.Empty) { chkItalian.IsChecked = false; } else { settingValue = IS.GetSettingStringValue("BabyApp-Italian").ToString(); if (settingValue == "Yes") { chkItalian.IsChecked = true; } else { chkItalian.IsChecked = false; } } if (IS.GetSettingStringValue("BabyApp-French") == string.Empty) { chkFrench.IsChecked = false; } else { settingValue = IS.GetSettingStringValue("BabyApp-French").ToString(); if (settingValue == "Yes") { chkFrench.IsChecked = true; } else { chkFrench.IsChecked = false; } } if (IS.GetSettingStringValue("BabyApp-Polish") == string.Empty) { chkPolish.IsChecked = false; } else { settingValue = IS.GetSettingStringValue("BabyApp-Polish").ToString(); if (settingValue == "Yes") { chkPolish.IsChecked = true; } else { chkPolish.IsChecked = false; } } if (IS.GetSettingStringValue("BabyApp-German") == string.Empty) { chkGerman.IsChecked = false; } else { settingValue = IS.GetSettingStringValue("BabyApp-German").ToString(); if (settingValue == "Yes") { chkGerman.IsChecked = true; } else { chkGerman.IsChecked = false; } } if (IS.GetSettingStringValue("BabyApp-Portuguese") == string.Empty) { chkPortuguese.IsChecked = false; } else { settingValue = IS.GetSettingStringValue("BabyApp-Portuguese").ToString(); if (settingValue == "Yes") { chkPortuguese.IsChecked = true; } else { chkPortuguese.IsChecked = false; } } if (IS.GetSettingStringValue("BabyApp-Japanese") == string.Empty) { chkJapanese.IsChecked = false; } else { settingValue = IS.GetSettingStringValue("BabyApp-Japanese").ToString(); if (settingValue == "Yes") { chkJapanese.IsChecked = true; } else { chkJapanese.IsChecked = false; } } if (IS.GetSettingStringValue("BabyApp-Chinese").ToString() == string.Empty) { chkChinese.IsChecked = false; } else { settingValue = IS.GetSettingStringValue("BabyApp-Chinese").ToString(); if (settingValue == "Yes") { chkChinese.IsChecked = true; } else { chkChinese.IsChecked = false; } } } catch (Exception ex) { throw; } }
public StopWatchUserControl() { InitializeComponent(); App.gStopWatch = new Stopwatch(); _isRunning = IsStopWatchRunning(); StopwatchTimesCollection = new ObservableCollection <StopwatchTimes>(); LoadLapAndSplitData(); //Need to determine what/if any adjustment should be made to clock //For example, if clock was paused previously we want to start at last clock value with clock paused //For example, if clock was running previously we want to add time that has accrued since app was shot down if ((IS.GetSettingStringValue("Stopwatch-DateTimeLastStart") == string.Empty) || (_isRunning.ToUpper() == "NO")) { if (IS.GetSettingStringValue("Stopwatch-DateTimeLastStart") == string.Empty) { _adjustment = new TimeSpan(); } else { if (IS.GetSettingStringValue("Stopwatch-LastValue") == string.Empty) { _adjustment = new TimeSpan(); } else { _adjustment = TimeSpan.Parse(IS.GetSettingStringValue("Stopwatch-LastValue")); } } } else //clock was running when it was last opened, so add accrued time { _dateTimeLastStart = DateTime.Parse(IS.GetSettingStringValue("Stopwatch-DateTimeLastStart")); _adjustment = TimeSpan.Parse(IS.GetSettingStringValue("Stopwatch-LastValue")) + (DateTime.Now - _dateTimeLastStart); } _timer = new DispatcherTimer(); _timer.Tick += new EventHandler(Timer_Tick); _timer.Interval = new TimeSpan(0, 0, 0); _timer.Start(); if (_isRunning.ToUpper() == "YES") { Mode = AppResources.StartText; Start.Background = new SolidColorBrush(Colors.Green); StartTimer(); } else { if (_adjustment == new TimeSpan(0, 0, 0)) { Mode = AppResources.StartText; Start.Background = new SolidColorBrush(Colors.Green); } else { Mode = AppResources.ResumeText; Start.Background = new SolidColorBrush(Colors.Green); } } this.DataContext = this; }
public async void UpdateErrorLog(string method, string error) { await Task.Factory.StartNew(() => WriteErrorToCloud(IS.GetSettingStringValue(USER_ID), method, error)); }