static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MainForm mainForm = new MainForm(); DataDatabase.InitializeDatabase(mainForm, mainForm.SyncIntervalBox); SyncInfoGiver.Initialization(mainForm); Synchronization.RunAutoSync(); Synchronization.SyncNow(); Application.Run(mainForm); DataDatabase.SaveChanges(); }
/// <summary> /// Automatic synchronisation /// </summary> public static void RunAutoSync() { if (SyncTimer != null) { SyncTimer.Stop(); SyncTimer.Dispose(); } lock (DataDatabase.IntervalInMinutesLocker) SyncTimer = new System.Timers.Timer((double)(DataDatabase.IntervalInMinutes * 60 * 1000)); SyncTimer.Elapsed += Sync; SyncTimer.AutoReset = true; SyncTimer.Enabled = true; SyncInfoGiver.RunTimerForUser(); }
/// <summary> /// Start automatic synchronisation after its stop /// </summary> public static void ContinueAutoSync() { SyncTimer.Enabled = true; SyncInfoGiver.ContinueTimerForUser(); }
/// <summary> /// Stop automatic synchronisation /// </summary> public static void StopAutoSync() { SyncTimer.Stop(); SyncInfoGiver.StopTimerForUser(); }