日期:2014-05-17 浏览次数:20765 次
private List<Model> models = new List<Model>(); public void updateModel(model) { models.Add(model); if (isOpen) { Thread thread = new Thread(UpdateModels); thread.Start(); isOpen = false; } } private void UpdateModels() { while (flag) { if (models != null) { if (models.Count > 50) { UpdateModelsStatus(models); models.RemoveRange(0, 49); isUpdate = true; } else { if (isUpdate && models.Count > 0) { UpdateModelsStatus(models); models.RemoveRange(0, models.Count - 1); isUpdate = false; } } } } }
public void updateModel(Model model) { models.Add(model); if (isOpen) { if (models.Count > 50) { Thread thread = new Thread(mds => { UpdateModelsStatus(mds as List<Model>); }); thread.Start(new List<Model>(models)); models.Clear(); } isOpen = false; } }