/// <summary> /// Invoked when the OK or apply button on the property sheet has been clicked. /// </summary> /// <returns>A task that represents the work queued to execute in the ThreadPool.</returns> /// <remarks>This function is only called if the page has set its IsModified flag to true.</remarks> protected override Task CommitAsync() { if (_origIsCelsius != IsCelsius) { // save the new settings DamlSettings settings = DamlSettings.Default; settings.Celius = IsCelsius; settings.Save(); } return(Task.FromResult(0)); }
/// <summary> /// Called when the backstage tab is selected. /// </summary> protected override Task InitializeAsync() { // get the default settings DamlSettings settings = DamlSettings.Default; // assign to the values binding to the controls _isCelsius = settings.Celius; _isFahrenheit = !_isCelsius; // keep track of the original values (used for comparison when saving) _origIsCelsius = _isCelsius; return(Task.FromResult(0)); }
/// <summary> /// Called when the backstage tab is unselected. /// </summary> protected override Task UninitializeAsync() { if (_origIsCelsius != _isCelsius) { // save the new settings DamlSettings settings = DamlSettings.Default; settings.Celius = IsCelsius; settings.Save(); BtnTemperatureFromSetting.ReloadTemperatureLabel(); } return(base.UninitializeAsync()); }