private void GoToPreviousDateTime_Click(object sender, RoutedEventArgs e) { if (semanticzoomDate.IsZoomedInViewActive) { if (MonthTitle == 1) { MonthTitle = 13; } MonthTitle--; DateTime datetime = DateTime.Now; if (MonthTitle == 12) { datetime = new DateTime(SelectedDateTime.Year - 1, 12, datetime.Day); YearTitle--; } else { if (SelectedDateTime.Month == 1) { SelectedDateTime = new DateTime(SelectedDateTime.Year, 12, SelectedDateTime.Day, SelectedDateTime.Hour, SelectedDateTime.Minute, SelectedDateTime.Second); } int count = SelectedDateTime.Month - MonthTitle; datetime = new DateTime(SelectedDateTime.Year, MonthTitle, SelectedDateTime.AddMonths(-count).Day); } UpdateDays(datetime); } else { YearTitle--; CurrentDateTime = new DateTime(SelectedDateTime.Year - 1, MonthTitle, SelectedDateTime.AddMonths(MonthTitle).Day); } }
private void BtnAddMonth_Click(object sender, RoutedEventArgs e) { if (MaxDateTime == null || SelectedDateTime.AddMonths(1) <= MaxDateTime) { SelectedDateTime = SelectedDateTime.AddMonths(1); } else { SelectedDateTime = (DateTime)MaxDateTime; } }
private void BtnDecMonth_Click(object sender, RoutedEventArgs e) { if (MinDateTime == null || SelectedDateTime.AddMonths(-1) >= MinDateTime) { SelectedDateTime = SelectedDateTime.AddMonths(-1); } else { SelectedDateTime = (DateTime)MinDateTime; } }