private async void ServiceLink_StateChanged(object sender, EventArgs e) { if (!ServiceLink.IsConnected) { return; } if (Settings.Default.UpdateBackgroundSettings > 0) { await UpdateBackgroundService(); } else { Settings.Default.BackgroundEnabled = await ServiceLink.GetEnabledAsync(); Settings.Default.BackgroundMailCheckInterval = await ServiceLink.GetIntervalDelayAsync(); Settings.Default.InitialBackgroundMailCheckInterval = await ServiceLink.GetInitialDelayAsync(); Settings.Default.Save(); } }