public async Task Save() { await RankingSettings.Save(); await PlayerSettings.Save(); await NGSettings.Save(); await CacheSettings.Save(); await PlaylistSettings.Save(); await AppearanceSettings.Save(); }
private void SetupSaveWithPropertyChanged() { RankingSettings.PropertyChangedAsObservable() .Throttle(TimeSpan.FromSeconds(1)) .Subscribe(e => _ = RankingSettings.Save()); PlayerSettings.PropertyChangedAsObservable() .Throttle(TimeSpan.FromSeconds(1)) .Subscribe(e => _ = PlayerSettings.Save()); NGSettings.PropertyChangedAsObservable() .Throttle(TimeSpan.FromSeconds(1)) .Subscribe(e => _ = NGSettings.Save()); CacheSettings.PropertyChangedAsObservable() .Throttle(TimeSpan.FromSeconds(1)) .Subscribe(e => _ = CacheSettings.Save()); PlaylistSettings.PropertyChangedAsObservable() .Throttle(TimeSpan.FromSeconds(1)) .Subscribe(e => _ = PlaylistSettings.Save()); AppearanceSettings.PropertyChangedAsObservable() .Throttle(TimeSpan.FromSeconds(1)) .Subscribe(e => _ = AppearanceSettings.Save()); ActivityFeedSettings.PropertyChangedAsObservable() .Throttle(TimeSpan.FromSeconds(1)) .Subscribe(e => _ = ActivityFeedSettings.Save()); new[] { PinSettings.PropertyChangedAsObservable().ToUnit(), PinSettings.Pins.CollectionChangedAsObservable().ToUnit(), PinSettings.Pins.ObserveElementPropertyChanged().ToUnit() } .Merge() .Throttle(TimeSpan.FromSeconds(1)) .Subscribe(pair => _ = PinSettings.Save()); }