Esempio n. 1
0
        public async void Refresh()
        {
            if (IsRefreshing)
            {
                return;
            }

            await Task.Run(() =>
            {
                IsRefreshing = true;

                // There's no other form right now to scan for new wifi access points
                _manager.StartScan();
                Thread.Sleep(7000);

                IsRefreshing = false;
            });

            RefreshDone?.Invoke(this, EventArgs.Empty);
        }
Esempio n. 2
0
        private static async Task AutomaticUpdater([NotNull] IThreatModel model)
        {
            if (_intervalMins > 0 && _intervalMins <= 120)
            {
                do
                {
                    var connector = GetConnector(model);
                    if (connector != null)
                    {
                        var changes = await UpdateAsync(model);

                        if (_notificationType == NotificationType.Full ||
                            (_notificationType == NotificationType.SuccessOnly && changes > 0))
                        {
                            RefreshDone?.Invoke(model, changes);
                        }
                    }

                    await Task.Delay(_intervalMins * 60000);
                } while (!_stopUpdater);

                _updater = null;
            }
        }