Beispiel #1
0
        private async static void Timer_Tick(object sender, EventArgs e)
        {
            Settings settings = SettingsController.GetSettings();

            if (!await ConnectionController.Update(settings.Domain, settings.Token))
            {
                LoggerController.LogEvent("No connection when trying to update");
            }
            else
            {
                LoggerController.LogEvent("Automatic update");
            }
        }
Beispiel #2
0
        public async static Task <bool> StartUpdater()
        {
            Settings settings = SettingsController.GetSettings();

            if (settings.Domain != "" && settings.Token != "" && settings.Interval != 0)
            {
                Timer.Interval = TimeSpan.FromMinutes(settings.Interval);
                Timer.Tick    += Timer_Tick;
                Timer.Start();
                LoggerController.LogEvent("Updater started");
                if (!await ConnectionController.Update(settings.Domain, settings.Token))
                {
                    LoggerController.LogEvent("No connection or invalid input data when trying to update");
                    return(false);
                }
                return(true);
            }
            else
            {
                LoggerController.LogEvent("Can't start updater, invalid input");
                return(false);
            }
        }