public SlideSelector() { InitializeComponent(); this._InputMethod = WillowTree.InputMode.UseGlobalSetting; this.SetInputMethod(GlobalSettings.InputMode, GlobalSettings.UseHexInAdvancedMode); GlobalSettings.InputMethodChanged += new GlobalSettings.InputMethodChangedEventHandler(SetInputMethod); }
public void SetInputMethod(WillowTree.InputMode method, bool UseHex) { this.UpDown.Hexadecimal = UseHex; if (method == InputMode.UseGlobalSetting) { method = GlobalSettings.InputMode; } if (method == _InputMethod) { // When the input method has not changed its still necessary // to signal the appropriate ValueChanged method because that // controls the updating of the caption which will change if // there is a change from decimal to hexadecimal. if (method == InputMode.Standard) { Slider_ValueChanged(this, EventArgs.Empty); } else if (method == InputMode.Advanced) { UpDown_ValueChanged(this, EventArgs.Empty); } return; } _InputMethod = method; if (method == WillowTree.InputMode.Standard) { int SValue = (int)this.UpDown.Value; if (SValue > this.Slider.Maximum) { this.Slider.Value = this.Slider.Maximum; } else if (SValue < Slider.Minimum) { this.Slider.Value = this.Slider.Minimum; } else { this.Slider.Value = SValue; } // TODO: I think this is called twice in a row, once by the property setter for // this.Slider.Value and once here. Check on it and remove one if so. Slider_ValueChanged(this, EventArgs.Empty); this.UpDown.Hide(); this.Slider.Show(); } else { this.UpDown.Value = this.Slider.Value; UpDown_ValueChanged(this, EventArgs.Empty); this.Slider.Hide(); this.UpDown.Show(); } this._InputMethod = method; Invalidate(); }