/// <summary> /// 添加到报警温度队列 /// </summary> /// <param name="tm"></param> public void Push(TempMessage tm) { foreach (var item in this.temp_list) { if (item.id == tm.id) { this.temp_list.Remove(item); break; } } if (this.temp_list.Count() >= this.length) { Pop(); } this.temp_list.Add(tm); if (addedWarningInfo != null) { addedWarningInfo(tm); } // 用线程储存头像文件 Thread t = new Thread(SaveImage); t.Start(tm); }
private static void SaveImage(object obj) { TempMessage tm = (TempMessage)obj; //LogHelper.WriteLog("Method {0}!", obj.ToString()); FileStream fs = new FileStream(tm.photo_path, FileMode.Create); fs.Write(tm.bytes, 0, tm.bytes.Length); fs.Close(); fs.Dispose(); }