public void FillListOfPossibleYears() { for (int i = 2000; i <= 2100; i++) { ListOfPossibleYears.Add(i); } }
private void YearShownTextBox_OnTextChanged(object sender, TextChangedEventArgs e) { if (YearShownTextBox.Text != String.Empty) { if (Int32.Parse(YearShownTextBox.Text) >= 2000 && Int32.Parse(YearShownTextBox.Text) <= 2100) { if (ListOfPossibleYears.Contains(Int32.Parse(YearShownTextBox.Text))) { ShownMonth = ShownMonth.AddYears(-ShownMonth.Year + 1); ShownMonth = ShownMonth.AddYears(Int32.Parse(YearShownTextBox.Text) - 1); datesInMonth(); MonthYearError.Text = ""; } } else { MonthYearError.Text = "Året er ikke inden for Kalenders rækkevidde"; } } }