|
@@ -22,14 +22,41 @@ namespace Task1
|
|
|
DateTime today = DateTime.Today;
|
|
|
string date = DatePick.SelectedDate.ToString();
|
|
|
DateTime dateUsed = Convert.ToDateTime(date);
|
|
|
- var dateModified = today - dateUsed;
|
|
|
+ var separateYear = today.Year - dateUsed.Year;
|
|
|
+ var separateMonth = today.Month - dateUsed.Month;
|
|
|
+ var separateDay = today.Day - dateUsed.Day;
|
|
|
+ if (separateDay < 0)
|
|
|
+ {
|
|
|
+ separateMonth--;
|
|
|
+ separateDay = DateTime.DaysInMonth(dateUsed.Year, dateUsed.Month)+ (today.Day - dateUsed.Day);
|
|
|
+ }
|
|
|
+ InfoYear.Text = Convert.ToString(separateYear) + " ëåò " + Convert.ToString(separateMonth) + " ìåñÿöåâ " + Convert.ToString(separateDay) + " äíåé.";
|
|
|
+ InfoDay.Text = Convert.ToString((today - dateUsed).TotalDays) + " äíåé ";
|
|
|
+
|
|
|
+ WeekDay.Text = Convert.ToString(dateUsed.DayOfWeek);
|
|
|
+ DateTime buffer = dateUsed;
|
|
|
+ while (buffer <= today)
|
|
|
+ {
|
|
|
+ buffer = buffer.AddYears(1);
|
|
|
+ if (buffer.DayOfWeek == dateUsed.DayOfWeek)
|
|
|
+ {
|
|
|
+ TextBlock BDate = new TextBlock();
|
|
|
+ {
|
|
|
+ BDate.Text = buffer.ToString();
|
|
|
+ }
|
|
|
+
|
|
|
+ BirthDates.Children.Add(BDate);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
catch(Exception ex) {
|
|
|
-
|
|
|
+ Info.Text = ex.Message;
|
|
|
}
|
|
|
- ShowPanelDate.IsVisible = true;
|
|
|
|
|
|
+ ShowPanelDate.IsVisible = true;
|
|
|
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|