public void executionThread() { try { while (TaskEnabled) { messageLabel.visible(false); resetOkFailPanelColors(); 100.sleep(); // to have a small blink on the Gui if (TaskFunction()) { onOk(); } else { onFail(); } if (ExecuteOnlyOnce) { break; } groupBox.set_Text("{0}: waiting {1}s ({2})".format(TaskType, SleepPeriod / 1000, TaskCount++)); messageLabel.visible(true); SleepPeriod.sleep(); } "executionThread completed".debug(); stop(); } catch (Exception ex) { ex.log("in ascx_SimpleTaskGui.executionThread"); } }
public static bool AddSleepPeriod(SleepPeriod period) { using (SQLiteConnection connection = new SQLiteConnection(PermDBCS)) { int ret = connection.InsertOrReplace(period); } return(true); }
public static void UpdateSleepPeriod(SleepPeriod period) { using (SQLiteConnection connection = new SQLiteConnection(PermDBCS)) { SleepPeriod periodUpdated = connection.Table <SleepPeriod>().Where(pe => pe.ID.Equals(period.ID)).FirstOrDefault(); periodUpdated.Start = period.Start; periodUpdated.End = period.End; periodUpdated.AwakeAt = period.AwakeAt; periodUpdated.DeepLength = period.DeepLength; periodUpdated.LightLength = period.LightLength; periodUpdated.TotalLength = period.TotalLength; connection.Update(periodUpdated); } }
public static void DeleteSleepPeriod(int id) { using (SQLiteConnection connection = new SQLiteConnection(PermDBCS)) { SleepPeriod period = connection.Table <SleepPeriod>().Where(pe => pe.ID.Equals(id)).FirstOrDefault(); if (period != null) { connection.BeginTransaction(); var blocks = connection.Table <SleepBlock>().Where(b => b.Period.Equals(id)).ToList <SleepBlock>(); foreach (var block in blocks) { connection.Delete(block); } connection.Delete(period); connection.Commit(); } } }