/// <summary> /// set entire enable or not status /// </summary> /// <param name="sts"></param> private void setEntireEnabledStatus(bool sts) { TraverseChildrenControls tchildrens = new TraverseChildrenControls(); foreach (object o in tchildrens.GetChildren(eqGrid, 1)) { if (o.GetType() == typeof(SpinnerControl)) { SpinnerControl spinControl = (SpinnerControl)o; spinControl.IsEnabled = sts; } if (o.GetType() == typeof(CheckBox)) //bypass or nots { var cbx = (CheckBox)o; cbx.IsEnabled = sts; } if (o.GetType() == typeof(TComboBox)) //combobox filter { var cbox = (TComboBox)o; cbox.IsEnabled = sts; } } //xover highfilter pass and low filter pass spinFreq_8.IsEnabled = sts; spinFreq_9.IsEnabled = sts; // cbxeqType8.IsEnabled = sts; cbxeqType9.IsEnabled = sts; bypasAllBtn.IsSelected = !sts; }
/// <summary> /// Render NumberBox control. /// Return true if failed. /// </summary> /// <param name="r.Canvas">Parent r.Canvas</param> /// <param name="r.MasterScale">Master Scale Factor</param> /// <param name="uiCmd">UICommand</param> /// <returns>Success = false, Failure = true</returns> public static void RenderNumberBox(RenderInfo r, UICommand uiCmd) { Debug.Assert(uiCmd.Info.GetType() == typeof(UIInfo_NumberBox)); UIInfo_NumberBox info = uiCmd.Info as UIInfo_NumberBox; SpinnerControl spinner = new SpinnerControl() { Value = info.Value, FontSize = CalcFontPointScale(), Minimum = info.Min, Maximum = info.Max, DecimalPlaces = 0, Change = info.Interval, VerticalContentAlignment = VerticalAlignment.Center, }; spinner.ValueChanged += (object sender, RoutedPropertyChangedEventArgs <decimal> e) => { info.Value = (int)e.NewValue; uiCmd.Update(); }; SetToolTip(spinner, info.ToolTip); DrawToCanvas(r, spinner, uiCmd.Rect); }
private void initializeParameter() { if (m_eqEdit == null) { m_eqEdit = new EQEdit[CFinal.NormalEQMax]; } for (int i = 0; i < CFinal.NormalEQMax; i++) { m_eqEdit[i] = new EQEdit(); } setEQFlat();//reset EQ parameters // strHL_FILTER cbxeqType8.ItemsSource = CFinal.strHL_FILTER; cbxeqType8.setSelectindex(0); //spinFreq_8 cbxeqType9.ItemsSource = CFinal.strHL_FILTER; cbxeqType9.setSelectindex(0); //set and initialize controls below TraverseChildrenControls tchildrens = new TraverseChildrenControls(); foreach (object o in tchildrens.GetChildren(eqGrid, 1)) { if (o.GetType() == typeof(SpinnerControl)) { SpinnerControl spinControl = (SpinnerControl)o; spinControl.onSpinValueClickChangeEvent += new SpinnerControl.spinValueClickChange(onSpinChangeHandle); } if (o.GetType() == typeof(CheckBox)) //bypass or nots { var cbx = (CheckBox)o; cbx.Click += checkBypas_Click; } if (o.GetType() == typeof(TComboBox)) //combobox filter { var cbox = (TComboBox)o; cbox.SelectionChanging += new SelectionChangingEventHandler(eqcombox_SelectionChanging); } } //xover highfilter pass and low filter pass spinFreq_8.onSpinValueClickChangeEvent += new SpinnerControl.spinValueClickChange(onSpinChangeHandle); spinFreq_9.onSpinValueClickChangeEvent += new SpinnerControl.spinValueClickChange(onSpinChangeHandle); // cbxeqType8.SelectionChanging += eqcombox_SelectionChanging; cbxeqType9.SelectionChanging += eqcombox_SelectionChanging; }
public static IObservable <decimal> ValueChanges(this SpinnerControl combo) => Observable .FromEventPattern <RoutedPropertyChangedEventHandler <decimal>, RoutedPropertyChangedEventArgs <decimal> > (a => combo.ValueChanged += a, a => combo.ValueChanged -= a) .Select(a => a.EventArgs.NewValue);