/// <summary> /// 静态构造函数 /// </summary> static DiaryCache() { var contact = new Diary { HappenTime = DateTime.Now, Weather = "阴", Title = "欢迎", Content = "欢迎下载本程序,如有问题,可发送电子邮件至[email protected]" }; InnerDiaries.Add(contact); }
/// <summary> /// 日期控件双击的处理 /// </summary> /// <param name="e"></param> private void AddNewDiary(DayEventArgs e) { var diary = new Diary { HappenTime = e.DayTime, }; var wnd = new DiaryWindow { Diary = diary, Title="添加日记", Owner = Application.Current.MainWindow }; if (true == wnd.ShowDialog()) { DiaryCache.Diaries.Add(wnd.Diary); } }