public static void AddTask(tagTask task) { //int nID = 0; //for (int i = Appinfo.listTask.Count-1; i >= 0; i--) //{ // nID = Appinfo.listTask[i].nID + 1; // break; //} //task.nID = nID; Appinfo.listTask.Add(task); using (var db = new TaskDB(Appinfo.dbPath)) { try { int count = db.Insert(task); Logger.Info($"{DateTime.Now}, 插入{count}条记录"); } catch (Exception e) { throw; } } Appinfo.LoadTask(); task.tagtempleTime.nID = Appinfo.listTask[Appinfo.listTask.Count - 1].nID; using (var db = new TempleTimeDB(Appinfo.dbPath)) { try { int count = db.Insert(task.tagtempleTime); } catch (Exception e) { throw; } } Appinfo.LoadTask(); task = Appinfo.listTask[Appinfo.listTask.Count - 1]; }
public static void Init() { Appinfo.dbPath = $"{Environment.CurrentDirectory}\\Tasks.db"; Appinfo.LoadTask(); }