private void LoadData() { sp = MainPage.Current.SelectedPage; if (sp == true) { DetailsPickedDate.Text = App.AllItem.Str3; DetailsEvent.Text = App.AllItem.Str1; DetailsDate.Text = App.AllItem.Str2; LunarDate.Text = LunarCalendar.GetChineseDateTime(Convert.ToDateTime(App.AllItem.Str3)); DetailsGrid.Background = App.AllItem.Str4; DetailsDate.Foreground = new SolidColorBrush(App.AllItem.BackGroundColor); if (localSettings.Values[App.AllItem.Str1 + App.AllItem.Str3] != null) { TipText.Text = localSettings.Values[App.AllItem.Str1 + App.AllItem.Str3].ToString(); } } else { EditButton.IsEnabled = false; DetailsEvent.Text = App.FestivalItem.Str1; DetailsDate.Text = App.FestivalItem.Str2; DetailsPickedDate.Text = App.FestivalItem.Str3; LunarDate.Text = LunarCalendar.GetChineseDateTime(Convert.ToDateTime(App.FestivalItem.Str3)); DetailsGrid.Background = ColorfulBrush(App.FestivalItem.Str4); DetailsDate.Foreground = new SolidColorBrush(App.FestivalItem.Str4); TipText.Text = "节日"; } if (localSettings.Values["Lunar"] != null) { if (localSettings.Values["Lunar"].ToString() == "1") { LunarDate.Visibility = Visibility.Visible; } else { LunarDate.Visibility = Visibility.Collapsed; } } else { LunarDate.Visibility = Visibility.Visible; } dEvent.Text = DetailsEvent.Text; dCalDate.Text = DetailsDate.Text; dDate.Text = DetailsPickedDate.Text; RenderPicture.ProfilePicture = All.Current.AllPicture.ProfilePicture; }
private async void TermCalendarView_SelectedDatesChanged(CalendarView sender, CalendarViewSelectedDatesChangedEventArgs args) { try { var dateOffset = TermCalendarView.SelectedDates[0]; var date = dateOffset.ToString("yyyy-MM-dd"); TermTextBlock.Text = "阳历:\n" + date + "\n\n阴历:\n" + LunarCalendar.GetChineseDateTime(Convert.ToDateTime(date)); } catch (System.Runtime.InteropServices.COMException e0) { } catch (Exception e) { MessageDialog Dialog = new MessageDialog("日期选择发生错误。\n异常类型:" + e.GetType(), "发生异常"); await Dialog.ShowAsync(); } //var date = Convert.ToDateTime(dateOffset); // }
private void InitCalendarView() { TermTextBlock.Text = "阳历:\n" + DateTime.Now.ToString("yyyy-MM-dd") + "\n\n阴历:\n" + LunarCalendar.GetChineseDateTime(DateTime.Now); }