private void LoadMoncha() { //check path to setting file if (File.Exists(AppSt.Default.cl_moncha_path) == false) { BrowseMoncha(); //select if not } MonchaHub.Disconnect(); //send path to hub class MonchaHub.Load(AppSt.Default.cl_moncha_path); WidthUpDn.DataContext = MonchaHub.Size; WidthUpDn.SetBinding(NumericUpDown.ValueProperty, "X"); HeightUpD.DataContext = MonchaHub.Size; HeightUpD.SetBinding(NumericUpDown.ValueProperty, "Y"); DeepUpDn.DataContext = MonchaHub.Size; DeepUpDn.SetBinding(NumericUpDown.ValueProperty, "Z"); MashMultiplierUpDn.Value = MonchaHub.Size.M.X; CalibrationFormCombo.Items.Clear(); CalibrationFormCombo.Items.Add(CalibrationForm.cl_Dot); CalibrationFormCombo.Items.Add(CalibrationForm.cl_Rect); CalibrationFormCombo.Items.Add(CalibrationForm.cl_miniRect); CalibrationFormCombo.Items.Add(CalibrationForm.cl_Cross); CalibrationFormCombo.Items.Add(CalibrationForm.cl_HLine); CalibrationFormCombo.Items.Add(CalibrationForm.cl_WLine); }
public void DataContextUpdate(CadObject cadObject) { this.IsEnabled = true; XUpDn.Value = cadObject.X; XUpDn.SetBinding(NumericUpDown.ValueProperty, "X"); XUpDn.DataContext = cadObject; YUpDn.Value = cadObject.Y; YUpDn.SetBinding(NumericUpDown.ValueProperty, "Y"); YUpDn.DataContext = cadObject; ZUpDn.Value = cadObject.Z; ZUpDn.SetBinding(NumericUpDown.ValueProperty, "Z"); ZUpDn.DataContext = cadObject; MirrorCheck.DataContext = cadObject; MirrorCheck.IsChecked = cadObject.Mirror; MirrorCheck.SetBinding(CheckBox.IsCheckedProperty, "Mirror"); RenderCheck.IsChecked = cadObject.Render; RenderCheck.SetBinding(CheckBox.IsCheckedProperty, "Render"); RenderCheck.DataContext = cadObject; FixCheck.IsChecked = cadObject.IsFix; FixCheck.SetBinding(CheckBox.IsCheckedProperty, "IsFix"); FixCheck.DataContext = cadObject; AngleZUpDn.Value = cadObject.AngleZ; AngleZUpDn.SetBinding(NumericUpDown.ValueProperty, "AngleZ"); AngleZUpDn.DataContext = cadObject; AngleYUpDn.Value = cadObject.AngleY; AngleYUpDn.SetBinding(NumericUpDown.ValueProperty, "AngleY"); AngleYUpDn.DataContext = cadObject; AngleXUpDn.Value = cadObject.AngleX; AngleXUpDn.SetBinding(NumericUpDown.ValueProperty, "AngleX"); AngleXUpDn.DataContext = cadObject; WidthUpDn.Value = cadObject.ScaleX; WidthUpDn.Interval = MonchaCadViewer.Properties.Settings.Default.stg_scale_percent == true ? 1 : 0.01; Binding bindingScaleX = new Binding("ScaleX"); bindingScaleX.Converter = new ScaleConverter(MonchaCadViewer.Properties.Settings.Default.stg_scale_percent, MonchaCadViewer.Properties.Settings.Default.stg_scale_invert); WidthUpDn.SetBinding(NumericUpDown.ValueProperty, bindingScaleX); WidthUpDn.DataContext = cadObject; HeightUpDn.Value = cadObject.ScaleY; HeightUpDn.Interval = MonchaCadViewer.Properties.Settings.Default.stg_scale_percent == true ? 1 : 0.01; Binding bindingScaleY = new Binding("ScaleY"); bindingScaleY.Converter = new ScaleConverter(MonchaCadViewer.Properties.Settings.Default.stg_scale_percent, MonchaCadViewer.Properties.Settings.Default.stg_scale_invert); HeightUpDn.SetBinding(NumericUpDown.ValueProperty, bindingScaleY); HeightUpDn.DataContext = cadObject; DeepUpDn.Value = cadObject.ScaleZ; DeepUpDn.Interval = MonchaCadViewer.Properties.Settings.Default.stg_scale_percent == true ? 1 : 0.01; Binding bindingScaleZ = new Binding("ScaleZ"); bindingScaleZ.Converter = new ScaleConverter(MonchaCadViewer.Properties.Settings.Default.stg_scale_percent, MonchaCadViewer.Properties.Settings.Default.stg_scale_invert); DeepUpDn.SetBinding(NumericUpDown.ValueProperty, bindingScaleZ); DeepUpDn.DataContext = cadObject; }