private void IntervalBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { var selectedItem = (ComboBoxItem)e.AddedItems.First(); uint timeInterval = 0; switch (selectedItem.Name) { case "IntervalNever": timeInterval = 0; break; case "Interval30": timeInterval = 30; break; case "Interval60": timeInterval = 60; break; case "Interval90": timeInterval = 90; break; case "Interval2h": timeInterval = 120; break; case "Interval6h": timeInterval = 360; break; case "IntervalOnce": timeInterval = 720; break; } BackgroundHelper.RegisterBackgroundTask(timeInterval); ApplicationData.Current.LocalSettings.Values["currentInterval"] = timeInterval; }
public MainPage() { // Initialize page this.InitializeComponent(); App.SetColors(); // Register background task var currentInterval = ApplicationData.Current.LocalSettings.Values["currentInterval"]; if (currentInterval != null) { BackgroundHelper.RegisterBackgroundTask(Convert.ToUInt32(currentInterval)); } else { BackgroundHelper.RegisterBackgroundTask(360); } // Clear notifications NotificationHelper.DeleteAllNotifications(); }