protected virtual void Initialization() { OnInitialStateChanged.Subscribe(state => { History.Clear(); Dispatch((TAction)(object)new InitialAction()); }); Dispatcher.AsObservable().Where(t => t.GetType() == typeof(InitialAction)).Subscribe(action => { StateChanged(action); }); this.InitialState = this._state = new TState(); }
/// <summary> /// The selected item in the combo box has changed. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="args">Event data.</param> private void OnComboBox1SelectedValueChanged(object sender, EventArgs args) { try { if (combobox1.GetActiveIter(out TreeIter iter)) { string selectedText = (string)combobox1.Model.GetValue(iter, 0); OnInitialStateChanged?.Invoke(sender, new InitialStateEventArgs() { initialState = selectedText }); } } catch (Exception err) { ShowError(err); } }