Example #1
0
        public IDisposable WatchForChanges(int version, OnSettingsChanged onSettingsChanged, CancellationToken ct)
        {
            IStreamSubscription subscription = null;


            async Task StreamMessageReceived(IStreamSubscription _, StreamMessage streamMessage,
                                             CancellationToken cancellationToken)
            {
                var settings = await StreamStoreConfigRepository.BuildConfigurationSettingsFromMessage(streamMessage, _messageHooks, ct);

                await onSettingsChanged(settings, ct);
            };

            void SubscriptionDropped(IStreamSubscription _, SubscriptionDroppedReason reason,
                                     Exception exception = null)
            {
                if (reason != SubscriptionDroppedReason.Disposed)
                {
                    SetupSubscription();
                }
            };

            void SetupSubscription()
            {
                subscription = _streamStore.SubscribeToStream(
                    streamId: _streamId,
                    continueAfterVersion: version,
                    streamMessageReceived: StreamMessageReceived,
                    subscriptionDropped: SubscriptionDropped);
            }

            SetupSubscription();

            return(subscription);
        }
Example #2
0
        public SettingsManager <T> RestoreDefaults()
        {
            Logger.Debug("Restoring defaults...");

            Settings.RestoreDefaults();
            OnSettingsChanged?.Invoke(this, Settings);
            return(this);
        }
Example #3
0
        private void fNonAlpha_SelectedIndexChanged(object sender, EventArgs e)
        {
            Common.PasswordSuggestNonAlpha = fNonAlpha.SelectedIndex + 1;

            OnSettingsChanged?.Invoke(sender, e);

            SetStatus("Number of Non-Alphanumeric Chracters in suggested password is limited to " + (fNonAlpha.SelectedIndex + 1) + " characters.");
        }
Example #4
0
    public void SetSettings(bool isInverted, float sensitivity)
    {
        PlayerPrefs.SetInt(PPREF_KEY_INVERT_MOUSE, isInverted ? 1 : 0);
        PlayerPrefs.SetFloat(PPREF_KEY_MOUSE_SENSITIVITY, sensitivity);

        OnSettingsChanged?.Invoke(new SettingsInfo {
            isMouseInverted = isInverted, mouseSensitivity = sensitivity
        });
    }
Example #5
0
 /// <summary>
 /// Open a prompt to select a color
 /// </summary>
 /// <param name="color">Color the prompt shows by default</param>
 /// <returns></returns>
 Color SelectColor(Color color)
 {
     ColorDialog.Color = color;
     ColorDialog.ShowDialog();
     color = ColorDialog.Color;
     Configuration.Color = color.ToArgb();
     OnSettingsChanged?.Invoke(this, new EventArgs());
     return(color);
 }
Example #6
0
 /// <summary>
 /// Opens a prompt to select a font and sets the font
 /// </summary>
 void SelectFont()
 {
     FontDialog.ShowDialog();
     _font = FontDialog.Font;
     Configuration.Name  = _font.Name;
     Configuration.Style = (int)_font.Style;
     Configuration.Size  = _font.Size;
     FontLabel.Text      = String.Format("{0} {2}pt {1}", _font.Name, _font.Style, _font.Size);
     OnSettingsChanged?.Invoke(this, new EventArgs());
 }
    // Start is called before the first frame update
    void Start()
    {
        volumetricLight = Camera.main.GetComponent <VolumetricLightScatteringEffect>();

        onSettingsChanged += delegate()
        {
            UpdateSettings();
        };

        Load();
    }
Example #8
0
        private void fPwordMask_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (fPasswordMask.SelectedIndex != -1)
            {
                Common.PasswordChar = passwordCharItems[fPasswordMask.SelectedIndex];

                OnSettingsChanged?.Invoke(sender, e);

                SetStatus("Password mask character is set to '" + passwordCharItems[fPasswordMask.SelectedIndex] + "'.");
            }
        }
Example #9
0
        private void fPasswordShowMode_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (fPasswordShowMode.SelectedIndex != -1)
            {
                Common.PasswordShowMode = passwordShowModeItems[fPasswordShowMode.SelectedIndex];

                OnSettingsChanged?.Invoke(sender, e);

                SetStatus("Password show duration is set to \"" + passwordShowModeItems[fPasswordShowMode.SelectedIndex] + "\".");
            }
        }
Example #10
0
        /// <summary>
        /// Fires event after setting was changed.
        /// </summary>
        protected void fireOnSettingsChanged()
        {
            OnSettingsChanged?.Invoke();

            InvalidateVisual();
            var workspace = Parent as MillingWorkspacePanel;

            if (workspace != null)
            {
                workspace.InvalidateArrange();
            }
        }
Example #11
0
    public void SetSettings(LCLocalizationSettings settings)
    {
        if (_core.GetSettings() != settings)
        {
            _core.SetSettings(settings);

            if (OnSettingsChanged != null)
            {
                OnSettingsChanged.Invoke();
            }
        }
    }
Example #12
0
        /// <summary>
        /// Reverts Settings to the last marked point. Warning: This replaces the object. Databinding will break after calling this method.
        /// </summary>
        public SettingsManager <T> Revert()
        {
            if (settingsSnapshot != null)
            {
                Settings = JsonConvert.DeserializeObject <T>(settingsSnapshot);
            }
            settingsSnapshot = null;

            OnSettingsChanged?.Invoke(this, Settings);

            return(this);
        }
 public void ApplyModify()
 {
     if (_updating)
     {
         return;
     }
     _modified = null;
     if (_original != null && _palette != null)
     {
         _modified = ImportImageIntoFalloutFormat(_original);
     }
     OnSettingsChanged?.Invoke(this, this);
 }
        internal void Save()
        {
            ApplicationData.Current.LocalSettings.Values["DARKSKY_API_KEY"]      = this.DARKSKY_API_KEY;
            ApplicationData.Current.LocalSettings.Values["RAIL_API_KEY"]         = this.RAIL_API_KEY;
            ApplicationData.Current.LocalSettings.Values["STATION_CRS"]          = this.STATION_CRS;
            ApplicationData.Current.LocalSettings.Values["LOCATION_LAT"]         = this.LOCATION_LAT;
            ApplicationData.Current.LocalSettings.Values["LOCATION_LNG"]         = this.LOCATION_LNG;
            ApplicationData.Current.LocalSettings.Values["GET_DRINK_TIME"]       = this.GET_DRINK_TIME;
            ApplicationData.Current.LocalSettings.Values["DRINK_UP_TIME"]        = this.DRINK_UP_TIME;
            ApplicationData.Current.LocalSettings.Values["WALK_TIME_TO_STATION"] = this.WALK_TIME_TO_STATION;
            ApplicationData.Current.LocalSettings.Values["FONT_SIZE"]            = this.FONT_SIZE;

            OnSettingsChanged?.Invoke();
        }
Example #15
0
        /// <summary>
        /// Applies the specified settings to this window.
        /// </summary>
        public void Apply(WindowSettings settings)
        {
            CheckIfNotDisposed();
            settings.Apply(Handle);
            Settings = settings.Clone() as WindowSettings;
            if (settings.WindowMode == WindowMode.Fullscreen)
            {
                settings.FullscreenDisplayMode = this.Display.CurrentMode;
            }
            var h = SDL_GetHint(SDL_HINT_RENDER_VSYNC);

            Settings.VSync = SDL_GetHint(SDL_HINT_RENDER_VSYNC) == "1";
            Title          = settings.Title;
            OnSettingsChanged?.Invoke(this, settings);
        }
Example #16
0
        public void SetupControls()
        {
            LoadSounds();

            cmbDifficulty.DataSource = new BindingSource(Enum.GetNames(typeof(GameDifficultyTypes)), null);

            btnClearScores.Click += (o, args) =>
            {
                if (MessageBox.Show(this, "Are you sure you want to clear all high scores?", "Clear High Scores", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
                {
                    ClearHighScores();
                }
            };

            btnSave.Click += (o, args) =>
            {
                SaveSettings();
                Close();
            };

            btnCancel.Click += (o, args) => Close();

            cmbDifficulty.SelectedValueChanged += (o, e) => { OnSettingsChanged?.Invoke(cmbDifficulty); };

            txtPlayerName.TextChanged += (o, e) => OnSettingsChanged?.Invoke(txtPlayerName);

            tbBGMVolume.ValueChanged += (o, e) =>
            {
                OnSettingsChanged?.Invoke(tbBGMVolume);
                MusicManager.BGMVolume = tbBGMVolume.Value / 100f;
            };

            tbSFXVolume.ValueChanged += (o, e) =>
            {
                OnSettingsChanged?.Invoke(tbSFXVolume);
                MusicManager.SFXVolume = tbSFXVolume.Value / 100f;
            };

            tbSFXVolume.MouseUp += (o, e) => {
                var rndSound = _sounds.ElementAt(_rnd.Next(_sounds.Count()));
                MusicManager.GetSound(rndSound).Play();
            };

            lnkLoadDefaults.Click += (o, e) => LoadFromSettings(new AppSettings());

            // Always make sure we apply the latest changes when leaving settings
            FormClosing += (o, e) => LoadFromSettings(AppSettings.Load());
        }
Example #17
0
        public void EndEdit()
        {
            var container = plugin.settingsView.SourceSettingsStack;

            foreach (CheckBox checkBox in container.Children)
            {
                SourceOptions[checkBox.Tag as string] = (bool)checkBox.IsChecked;
            }
            container = plugin.settingsView.PlayActionSettingsStack;
            foreach (CheckBox checkBox in container.Children)
            {
                EnabledPlayActions[checkBox.Tag as string] = (bool)checkBox.IsChecked;
            }
            // Code executed when user decides to confirm changes made since BeginEdit was called.
            plugin.SavePluginSettings(this);
            OnSettingsChanged?.Invoke();
        }
Example #18
0
        /// <summary>
        /// Passes the settings in order to apply
        /// </summary>
        public void ApplySettings()
        {
            #region Set values for settings
            SettingsEventArgs settings = new SettingsEventArgs()
            {
                BackColor          = selectedBackColor,
                SuggestedTileColor = selectedSugTileColor,
                PossibleTilesColor = selectedPosTilesColor,
                ForeColor          = selectedForeColor,
                SecForeColor       = selectedSecForeColor,
                Font = selectedFont
            };
            #endregion

            // Invoke the custom event
            OnSettingsChanged.Invoke(this, settings);
        }
        /// <summary>
        /// Edit settings in underlying controller
        /// </summary>
        /// <param name="isEditing"></param>
        /// <param name="isInFrame"></param>
        /// <param name="isAutoDeselecting"></param>
        /// <param name="overridePrompt"></param>
        public void UpdateSettings(bool isEditing, bool isInFrame, bool isFrameBottom,
                                   bool isAutoDeselecting, bool isInIconModeAuto,
                                   bool overridePrompt = false)
        {
            _inEditMode         = isEditing;
            _inFramedMode       = isInFrame;
            _inFramedModeBottom = isFrameBottom;
            _requireDeselect    = isAutoDeselecting;
            _iconModeAuto       = isInIconModeAuto;

            if (overridePrompt)
            {
                return;
            }

            OnSettingsChanged?.Invoke(this, EventArgs.Empty);
        }
    private void OnSave()
    {
        SettingsMessageData data = null;

        switch (actionsDropdown.value)
        {
        case 0:
            data = new SettingsMessageData();
            break;

        case 1:
            data = ravenActionSettings.GetData();
            break;

        case 2:
            data = spawnCreatureSettings.GetData();
            break;

        case 3:
            data = hudMessageSettings.GetData();
            break;

        case 4:
            data = randomEventSettings.GetData();
            break;

        case 5:
            data = environmentSettings.GetData();
            break;

        case 6:
            data = playerSettings.GetData();
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }

        OnSettingsChanged?.Invoke(this, new SettingsChangedArgs {
            Data = data
        });

        OnClose();
    }
Example #21
0
        private void ButtonAnnuleren_Click(object sender, EventArgs e)
        {
            var changes = new SettingsChangedEventArgs
            {
                AdressenFile       = section.Invoer.AdressenFile,
                AdressenSeparator  = section.Invoer.AdressenSeparator,
                ContainerFile      = section.Invoer.ContainersFile,
                ContainerSeparator = section.Invoer.ContainersSeparator,
                Landscape          = section.Printer.Landscape,
                AlwaysShowDialog   = section.Printer.AlwaysShowPrintDialog,
                Printer            = section.Printer.Printer,
                Paper      = section.Printer.Paper,
                FontFamily = section.Label.Font.Name,
                FontSize   = section.Label.Font.Size
            };

            Close();
            OnSettingsChanged?.Invoke(changes);
        }
Example #22
0
        public bool Save()
        {
            while (_recentConnections.Count > MaxRecentConnections)
            {
                _recentConnections.RemoveAt(MaxRecentConnections);
            }

            try
            {
                Provider?.WriteUserSettings(this);
                OnSettingsChanged?.Invoke(this, EventArgs.Empty);
                return(true);
            }
            catch (Exception ex)
            {
                ex.Log();
                return(false);
            }
        }
Example #23
0
        private void fPasswordLength_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (fNonAlpha.SelectedIndex + 1 > fPasswordLength.SelectedIndex + 1)
            {
                fNonAlpha.Items.Clear();

                for (var a = 1; a <= fPasswordLength.Items.Count; a++)
                {
                    fNonAlpha.Items.Add(a);
                }

                fNonAlpha.SelectedIndex = fPasswordLength.SelectedIndex;
            }

            Common.PasswordSuggestLength = fPasswordLength.SelectedIndex + 1;

            OnSettingsChanged?.Invoke(sender, e);

            SetStatus("Suggested Password Length is set " + (fPasswordLength.SelectedIndex + 1) + ".");
        }
Example #24
0
        public bool Load(bool saveIfNotExists)
        {
            if (!File.Exists(Filepath))
            {
                if (saveIfNotExists)
                {
                    Save();
                }
                return(false);
            }

            Logger.Info("Loading from {0}", Filepath);


            string json = File.ReadAllText(Filepath, Encoding);

            Settings = JsonConvert.DeserializeObject <T>(json);

            OnSettingsChanged?.Invoke(this, Settings);

            return(true);
        }
 internal static void InstallEvents()
 {
     SteamParentalSettingsChanged_t.Install(x => OnSettingsChanged?.Invoke());
 }
Example #26
0
 private void fireOnSettingsChanged()
 {
     OnSettingsChanged?.Invoke();
 }
 public static void SettingsChanged()
 {
     OnSettingsChanged?.Invoke();
 }
Example #28
0
 internal void _OnSettingsChanged()
 {
     OnSettingsChanged?.Invoke(this);
     Utils.Call("self.EventStarted = False");
 }
 internal static void InstallEvents(bool server)
 {
     Dispatch.Install <SteamParentalSettingsChanged_t>(x => OnSettingsChanged?.Invoke(), server);
 }
Example #30
0
 protected void InvokeOnSettingsChanged(AbstractSettingScriptableObject caller = null)
 {
     OnSettingsChanged?.Invoke(caller);
 }