private void MonthMinusOne(object sender, RoutedEventArgs e) { if (ShownMonth.Year == 1) { ShownMonth.AddYears(-1); } ShownMonth = ShownMonth.AddMonths(-1); datesInMonth(); UserViewModel.SetCurrentShownMonth(); MonthShownTextBox.Text = ShownMonth.Month.ToString(); YearShownTextBox.Text = ShownMonth.Year.ToString(); }
private void MonthShownTextBox_OnTextChanged(object sender, TextChangedEventArgs e) { if (MonthShownTextBox.Text != String.Empty) { if (ListOfPossibleMonths.Contains(Int32.Parse(MonthShownTextBox.Text))) { ShownMonth = ShownMonth.AddMonths(-ShownMonth.Month); ShownMonth = ShownMonth.AddMonths(Int32.Parse(MonthShownTextBox.Text)); FixHubTestAcitivities(sender, e); datesInMonth(); MonthYearError.Text = ""; } else { MonthYearError.Text = "Måneden er ikke inden for Kalenders rækkevidde"; } } }
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"; } } }