Пример #1
0
        private void MotorSettingClicked(object sender, RoutedEventArgs routedEventArgs)
        {
            var control = sender as MotorControl;

            if (control != null)
            {
                MotorSettings.SaveSettings += MotorSettings_SaveSettings;

                _selectedMotorControl = control;

                MotorSettings.Show(
                    control.BrickInputPort,
                    _brick.Ports[control.BrickInputPort].Type,
                    control.MotorMovementType,
                    control.DegreeMovement,
                    control.PowerRatingMovement,
                    control.TimeToMoveInSeconds);
            }
        }
Пример #2
0
        void MotorSettings_SaveSettings(object sender, MotorSettingsEventArgs e)
        {
            if (_selectedMotorControl == null)
                return;

            MotorSettings.SaveSettings -= MotorSettings_SaveSettings;

            _selectedMotorControl.MotorMovementType = e.MotorMovementType;
            _selectedMotorControl.DegreeMovement = e.DegreeMovement;
            _selectedMotorControl.PowerRatingMovement = e.PowerRatingMovement;
            _selectedMotorControl.TimeToMoveInSeconds = e.TimeToMoveInSeconds;

            _selectedMotorControl.UpdateUx();

            _selectedMotorControl = null;
        }