一个线程知识点, 一个MongoDB的知识点
1 2 //WINForm窗体中切换前后台线程执行任务: 3 protected void RunOnUI(Action action) 4 { 5 Invoke(action); 6 } 7 8 protected void RunOnBg(Action action) 9 { 10 Task.Factory.StartNew(action); 11 } 12 13 //MongoDB创建索引 14 if (idx.Count == 1) 15 { 16 tbPoints.Indexes.CreateOne(Builders<GpsPoint>.IndexKeys.Descending(it => it.Sn)); 17 tms = Convert.ToInt32((DateTime.Now - dtStart).TotalSeconds); 18 LogHelper.Show($"压缩轨迹 ~~ 创建索引 用时 {tms} 秒"); 19 }