private void _ChangeStepperCommand(string stepperDefinitionName) { if (stepperDefinitionName == null) { return; } if (StepperDefinitions == null || StepperDefinitions.Count == 0) { return; } SelectedStepperDefinition = StepperDefinitions.FirstOrDefault(x => x.Name == stepperDefinitionName); }
protected void _Initialize() { FileOpenCommand = new TRelayCommand(() => _FileOpenCommand(), _ => { return(true); }); HelpContactCommand = new TRelayCommand(() => _HelpContactCommand(), _ => { return(true); }); HelpAboutCommand = new TRelayCommand(() => _HelpAboutCommand(), _ => { return(true); }); MicroSteps.Clear(); MicroSteps.Add(new TComboBoxItem() { Value = 200, Description = "200 (1)" }); MicroSteps.Add(new TComboBoxItem() { Value = 400, Description = "400 (1/2)" }); MicroSteps.Add(new TComboBoxItem() { Value = 800, Description = "800 (1/4)" }); MicroSteps.Add(new TComboBoxItem() { Value = 1600, Description = "1600 (1/8)" }); MicroSteps.Add(new TComboBoxItem() { Value = 3200, Description = "3200 (1/16)" }); MicroSteps.Add(new TComboBoxItem() { Value = 6400, Description = "6400 (1/32)" }); SelectedMicroStep = MicroSteps.First(); ThreadedShafts.Clear(); ThreadedShafts.Add(new TComboBoxItem() { Value = 0.8f, Description = "M5 (0.80)" }); ThreadedShafts.Add(new TComboBoxItem() { Value = 1, Description = "M6 (1.00)" }); ThreadedShafts.Add(new TComboBoxItem() { Value = 1.25f, Description = "M8 (1.25)" }); ThreadedShafts.Add(new TComboBoxItem() { Value = 1.5f, Description = "M10 (1.50)" }); ThreadedShafts.Add(new TComboBoxItem() { Value = 1.75f, Description = "M12 (1.75)" }); SelectedThreadedShaft = ThreadedShafts.FirstOrDefault(x => x.Value == 1.25f); ChangeDirectionCommand = new TRelayCommand(() => _ChangeDirectionCommand(), _ => { return(true); }); AddToListCommand = new TRelayCommand(() => _AddToListCommand(), _ => { return(IsMovementValid); }); RemoveMovementCommand = new TRelayCommand <int>((x) => _RemoveMovementCommand(x), _ => { return(Sequence.Count > 0); }); MovementUpCommand = new TRelayCommand <int>((x) => _MovementUpCommand(x), _ => { return(Sequence.Count > 1); }); MovementDownCommand = new TRelayCommand <int>((x) => _MovementDownCommand(x), _ => { return(Sequence.Count > 1); }); Speed = 50; Iterations = 1; Sequence.Clear(); rbMoveAsSteps = false; rbMoveAsDistance = true; StepperDefinitions.Clear(); StepperDefinitions.Add(new StepperDefinition("Nema 17", 1, 1407) { ChangeCommand = ChangeStepperCommand }); StepperDefinitions.Add(new StepperDefinition("Nema 23", 1, 1340) { ChangeCommand = ChangeStepperCommand }); ChangeStepperCommand = new TRelayCommand <string>((x) => _ChangeStepperCommand(x), _ => { return(true); }); }