private void InitUI() { txtMonth.Text = date.Month.ToString() + "月"; txtDay.Text = date.Day.ToString(); txtWeek.Text = DateTool.DayOfWeek(date); if (date.Date == DateTime.Today) { DateSP.Background = ColorTool.HexColorToBrush("#c5f3ff"); RoomGrid.Background = ColorTool.HexColorToBrush("#53a9ba"); } Task.Factory.StartNew(() => { //改成用DispatcherPriority,因為如果快速換月份 //一直跑UI,馬上又丟棄太浪費資源 //改成有空閒再跑會議房間就好 this.Dispatcher.BeginInvoke(DispatcherPriority.SystemIdle, new Action(() => //this.Dispatcher.BeginInvoke(new Action(() => { //meetingList.ForEach(item => foreach (UserMeeting item in meetingList) { var room = new MeetingRoom(UserID, UserPWD, item, this.Home_Change2MeetingDataCT_Event, NewAddMeetingID); MeetingRoomWP.Children.Add(room); } //); })); }); }
private void InitUI() { txtMonth.Text = date.Month + "月"; txtDay.Text = date.Day.ToString(); txtWeek.Text = DateTool.DayOfWeek(date); if (date.Date == DateTime.Today) { DateSP.Background = ColorTool.HexColorToBrush("#c5f3ff"); RoomGrid.Background = ColorTool.HexColorToBrush("#53a9ba"); } Task.Factory.StartNew(new Action(_003CInitUI_003Eb__3)); }