Beispiel #1
0
        public void LoadHistorySummary(string CureSN, int Limit)
        {
            int item_cnt = 0;

            _realtime_temper_collection.Clear();
            _history_collection.Clear();

            new Thread(() =>
            {
                DataTable dt = null;
                // 加载History列表
                using (CDatabase db = new CDatabase())
                {
                    if (!db.GetCureHistoryList(CureSN, out dt))
                    {
                        // 如果错误,通知View弹出错误对话框
                        Messenger.Default.Send <NotificationMessage <string> >(new NotificationMessage <string>(db.LastError, "获取历史列表时发生错误"), "DBError");
                    }
                    else
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                            {
                                _history_collection.Add(
                                    new CCureHistory(
                                        dr["cure_sn"].ToString(),
                                        dr["patient_name"].ToString(),
                                        Convert.ToInt16(dr["cure_channel"]),
                                        Convert.ToDateTime(dr["created_time"]),
                                        Convert.ToDateTime(dr["updated_time"]),
                                        (byte[])dr["seq_snapshot"]));
                            }));

                            item_cnt++;
                            if (Limit > 0)
                            {
                                if (item_cnt > Limit)
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
            }).Start();
        }