private async void DateDialogPrimaryButton_Click(object sender, RoutedEventArgs e) { try { var today = DateTime.Now; var count = Convert.ToInt32(DaysTextBox.Text); if (today.AddDays(count) > Convert.ToDateTime("2120/12/31")) { PopupNotice popupNotice = new PopupNotice("超出了最大范围"); popupNotice.ShowAPopup(); } var res = today.AddDays(count); Add_Picker.Date = Convert.ToDateTime(res); } catch (FormatException e0) { } catch (Exception e1) { MessageDialog message = new MessageDialog("异常类型:" + e1.ToString() + "影响使用的话请及时反馈。", "发生异常!"); await message.ShowAsync(); } DaysTextBox.Text = ""; DateDialog.Hide(); }
private void DateDialogCloseButton_Click(object sender, RoutedEventArgs e) { DaysTextBox.Text = ""; DateDialog.Hide(); }