예제 #1
0
        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.");
            }
        }
예제 #2
0
        /// <summary>
        /// <see cref="IModelViewMediator"/>
        /// </summary>
        public void UpdateSettings(SettingsNotification settingsNotification)
        {
            this.AppSettings = settingsNotification;

            this.LogicModel.ParseSettings(settingsNotification);
            this.ModelViewCollection.ForEach(mv => mv.NotifySettingsChanged());
        }
예제 #3
0
        /// <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;
        }
예제 #4
0
        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);
        }
예제 #5
0
        /// <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);
        }
예제 #6
0
        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();
                }
            });
        }
예제 #7
0
 /// <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;
 }
예제 #8
0
        /// <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;
 }