private async void HandleSettingsUpdate(SettingsUpdatedMessage msg) { try { if (msg.IsSettingsValid && msg.SettingsPersisted) { Frame.BackStack.Clear(); Frame.Navigate(typeof(MainPage)); return; } else if (!msg.IsSettingsValid) { string message = AppResources.Values.GetString("MessageSettingsConnectionConfigInvalid"); await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { SettingsNotification.Show(message); }); } else { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { SettingsNotification.Dismiss(); }); } } catch (Exception ex) { _logger.LogError(ex, "Show info message failed."); } }
/// <summary> /// <see cref="IModelViewMediator"/> /// </summary> public void UpdateSettings(SettingsNotification settingsNotification) { this.AppSettings = settingsNotification; this.LogicModel.ParseSettings(settingsNotification); this.ModelViewCollection.ForEach(mv => mv.NotifySettingsChanged()); }
/// <summary> /// Constructor of class to hold window interaction of application settings /// </summary> /// <param name="settingsNotification"></param> public SettingsModelView(SettingsNotification settingsNotification) { this.ShowCoordinate = settingsNotification.ShowCoordinates; this.NumOfPointToFilter = settingsNotification.PointsToFilter; this.UseVoiceCommands = settingsNotification.UseVoiceCommands; this.SelectedRenderMode = settingsNotification.DefaultRenderMode; }
private XElement CreateSettingsElement(SettingsNotification settings) { XElement settingsElement = new XElement(SETTING_ROOT, new XElement(SettingsNotification.RENDER_MODE, settings.DefaultRenderMode.ToString()), new XElement(SettingsNotification.NUM_TO_FILTER, settings.PointsToFilter), new XElement(SettingsNotification.SHOW_COORDINATES, settings.ShowCoordinates), new XElement(SettingsNotification.USE_VOICE_COMMANDS, settings.UseVoiceCommands)); return(settingsElement); }
/// <summary> /// Create settings directory in case doesn't exists yet /// </summary> private void PrepareSettings() { string settingDir = Path.Combine(Environment.CurrentDirectory, SETTINGS_DIR); this.CreateDirIfNeeded(settingDir); SettingsNotification settingsNotification = this.RetriveSettingsFromDisk(); this.MenuModelView.Mediator.UpdateSettings(settingsNotification); }
private void RaiseSettings() { SettingsNotification notification = new SettingsNotification() { Title = "Settings" }; this.SettingsRequest.Raise( notification, returned => { if (returned != null && returned.Confirmed) { Properties.Settings.Default.Save(); RegisterHotkeys(); Main.ToggleClipboardMonitor(); Main.CreateSFTPConnectionInfo(); } }); }
/// <summary> /// Parse settings packet from UI /// </summary> /// <param name="settings">current settings to parse</param> public void ParseSettings(SettingsNotification settings) { this.NoiseFilter.NumberOfPointsToFilter = settings.PointsToFilter; this.Media.UseVoiceCommand = settings.UseVoiceCommands; }
/// <summary> /// Save settings to the disk /// </summary> /// <param name="settingsNotification">settings data</param> internal void SaveSettingsToDisk(SettingsNotification settingsNotification) { XElement settingsElement = this.CreateSettingsElement(settingsNotification); this.SaveElement(settingsElement, this.SettingsUrl); }
public void SetNotifications(SettingsNotification propertyChangedCallback, SettingsNotification propertiesSavedCallback) { PropertiesSavedCallback = propertiesSavedCallback; PropertyChangedCallback = propertyChangedCallback; CallbacksSet = true; }