private void HighScoreInputUserControl1_ButtonOk_Click(object sender, RoutedEventArgs e) { _highScoreList.Add(HighScoreInputUserControl1.TextBoxInitials.Text, HighScoreInputUserControl1.Score); RectangleOverlay.Visibility = Visibility.Collapsed; HighScoreInputUserControl1.Visibility = Visibility.Collapsed; }
private async void Handler_SeeHighScore(object sender, EventArgs e) { await DispatcherHelper.RunAsync(() => { var DefaultColor = new LinearGradientBrush(); DefaultColor.StartPoint = new Point(0.5, 0); DefaultColor.EndPoint = new Point(0.5, 1); DefaultColor.GradientStops = new GradientStopCollection(); DefaultColor.GradientStops.Add(new GradientStop() { Color = Windows.UI.Colors.Gray, Offset = 0 }); DefaultColor.GradientStops.Add(new GradientStop() { Color = Windows.UI.Colors.Brown, Offset = 1 }); HighScoreBackGround = DefaultColor; QuestionFieldBackground = DefaultColor; QuestionField = "Tryck på knappen i mitten för att gå till Startsidan."; AlternativeOneBackground = DefaultColor; AlternativeOneField = ""; AlternativeTwoBackground = DefaultColor; ExternalButtons.ButtonTwoPressed += ButtonTwoGoHomePressed; AlternativeTwoField = "Gå till startsida"; AlternativeThreeBackground = DefaultColor; AlternativeThreeField = ""; var index = 1; foreach (var person in handler.GetHighscores()) { HighScoreList.Add("Plats " + index + ":" + "\t" + person.ToString() + " av " + scoreList.Count() + " möjliga."); index++; } }); }
//adds the name of the players and their score to a list in sorted order public static void AddNameAndScore(string name, int score) { HighScore newHS = new HighScore(name, score); if (IsHighScore(score)) { if (HighScoreList.Count >= 5) { HighScoreList.RemoveAt(HighScoreList.Count - 1); } HighScoreList.Add(newHS); HighScoreList.Sort(); } }
private void LoadHighScore() { HighScoreList = ReadWrite.ReadJson <List <HighScoreObj> > (PathSettings, @"\highscore", ".json"); //High Score if (HighScoreList == null) { HighScoreList = new List <HighScoreObj>(); } if (HighScoreList.Count < 6) { int addToFive = 5 - HighScoreList.Count; for (int i = 0; i < addToFive; i++) { HighScoreList.Add(new HighScoreObj { DateTime = DateTime.Now, Handle = "Empty", TimeSpan = new TimeSpan(7, 23, 59, 59) }); } } HighScoreList = HighScoreList.OrderBy(x => x.TimeSpan).ThenBy(y => y.DateTime).ToList(); }
public void PutOnHighScore(HighScoreObj HSO) { HighScoreList.Add(HSO); HighScoreList = HighScoreList.OrderBy(x => x.TimeSpan).ThenBy(y => y.DateTime).Take(5).ToList(); }
public HighScoreWindow(List <DatabaseEntry> list) { InitializeComponent(); list.ForEach(x => HighScoreList.Add(x)); }