public BackgroundAppViewModel() { ClearFileCommand = new RelayCommand(() => { fileController.ClearCacheAsync(); Clear(); }, () => { return(true); }); Load(); _isTaskRegistered = BackgroundDemoTask.IsTaskRegistered(); attachTask(); if (Windows.ApplicationModel.DesignMode.DesignModeEnabled) { return; } this.dispatcher = CoreWindow.GetForCurrentThread().Dispatcher; }
private async void setRegisteredTask(bool register) { if (_isTaskRegistered != register) { if (_isTaskRegistered) { dettachTask(); BackgroundDemoTask.UnregisterTask(); _isTaskRegistered = false; } else { await BackgroundDemoTask.RegisterTaskAsync(); attachTask(); _isTaskRegistered = BackgroundDemoTask.IsTaskRegistered(); OnPropertyChanged("IsTaskRegistered"); } } }