//Checks if old data exists in app and sets all toggles to reflect the options void cacheCheck() { MatchFormat.EntryParams x; bool containsVal = false; if (!String.IsNullOrWhiteSpace(Preferences.Get("tempParams", ""))) { try { x = JsonConvert.DeserializeObject <MatchFormat.EntryParams> (Preferences.Get("tempParams", "")); containsVal = true; } catch (JsonException) { containsVal = false; x = Entry; } } else { containsVal = false; x = Entry; } if (containsVal) { MatchFormat.EntryParams entries = x; matchnum.Text = entries.matchNum.ToString(); PositionPicker.SelectedIndex = entries.side; crossbase.IsToggled = entries.crossBaseline; autoLvl.SelectedIndex = entries.autoLvl; autoOTele.IsToggled = entries.autoOTele; death.SelectedIndex = entries.deathType; climbSwitch.IsToggled = entries.climb; climbLvl.SelectedIndex = entries.climbLvl; assisted.IsToggled = entries.giveAstClimb; needed.IsToggled = entries.needAstClimb; giveAssistClimbLvl.SelectedIndex = entries.giveAstClimbLvl; fouls.Text = entries.fouls.ToString(); yellow.IsToggled = entries.yellowCard; red.IsToggled = entries.redCard; comments.Text = entries.comments; Entry = entries; } else { death.SelectedIndex = (int)MatchFormat.DEATH_TYPE.noDeath; fouls.Text = "0"; } setAutoButtons(); setEndGameSelfButtons(); setEndGameOtherButtons(); }
//Clears all properties for use in next match public static void clearMatchItems() { Preferences.Set("teamStart", 0); Preferences.Set("appState", 0); Preferences.Set("timerValue", 0); Preferences.Set("lastItemPicked", 0); Preferences.Set("lastItemDropped", 0); Preferences.Set("tempParams", ""); Preferences.Set("tempMatchEvents", ""); NewMatchStart.timerValue = 0; MatchEvents.update = true; NewMatchStart.events.Clear(); Entry = new MatchFormat.EntryParams(); }
//Checks if old data exists in app and sets all toggles to reflect the options void cacheCheck() { MatchFormat.EntryParams x; bool containsVal = false; if (!String.IsNullOrWhiteSpace(Preferences.Get("tempParams", ""))) { try { x = JsonConvert.DeserializeObject <MatchFormat.EntryParams> (Preferences.Get("tempParams", "")); containsVal = true; } catch (JsonException) { containsVal = false; x = Entry; } } else { containsVal = false; x = Entry; } if (containsVal) { MatchFormat.EntryParams entries = x; matchnum.Text = entries.matchNum.ToString(); PositionPicker.SelectedIndex = entries.side; crossbase.IsToggled = entries.crossBaseline; death.Value = entries.deathAmt; climbLvl.SelectedIndex = entries.climbLvl; yellow.IsToggled = entries.yellowCard; red.IsToggled = entries.redCard; comments.Text = entries.comments; Entry = entries; } else { death.Value = (int)MatchFormat.DEATH_TYPE.noDeath; } }