Beispiel #1
0
        private async Task SaveControllerActionAsync()
        {
            if (SelectedDevice == null)
            {
                await _dialogService.ShowMessageBoxAsync("Warning", "Select a device before saving.", "Ok", _disappearingTokenSource.Token);

                return;
            }

            await _dialogService.ShowProgressDialogAsync(
                false,
                async (progressDialog, token) =>
            {
                if (ControllerAction != null)
                {
                    await _creationManager.UpdateControllerActionAsync(ControllerAction, SelectedDevice.Id, Channel, IsInvert, ButtonType, AxisCharacteristic, MaxOutputPercent, AxisDeadZonePercent);
                }
                else
                {
                    await _creationManager.AddOrUpdateControllerActionAsync(ControllerEvent, SelectedDevice.Id, Channel, IsInvert, ButtonType, AxisCharacteristic, MaxOutputPercent, AxisDeadZonePercent);
                }
            },
                "Saving...");

            await NavigationService.NavigateBackAsync();
        }
        private async Task SaveControllerActionAsync()
        {
            if (SelectedDevice == null)
            {
                await _dialogService.ShowMessageBoxAsync(
                    Translate("Warning"),
                    Translate("SelectDeviceBeforeSaving"),
                    Translate("Ok"),
                    _disappearingTokenSource.Token);

                return;
            }

            await _dialogService.ShowProgressDialogAsync(
                false,
                async (progressDialog, token) =>
            {
                if (ControllerAction != null)
                {
                    await _creationManager.UpdateControllerActionAsync(
                        ControllerAction,
                        Action.DeviceId,
                        Action.Channel,
                        Action.IsInvert,
                        Action.ButtonType,
                        Action.AxisType,
                        Action.AxisCharacteristic,
                        Action.MaxOutputPercent,
                        Action.AxisDeadZonePercent,
                        Action.ChannelOutputType,
                        Action.MaxServoAngle,
                        Action.ServoBaseAngle,
                        Action.StepperAngle,
                        Action.SequenceName);
                }
                else
                {
                    await _creationManager.AddOrUpdateControllerActionAsync(
                        ControllerEvent,
                        Action.DeviceId,
                        Action.Channel,
                        Action.IsInvert,
                        Action.ButtonType,
                        Action.AxisType,
                        Action.AxisCharacteristic,
                        Action.MaxOutputPercent,
                        Action.AxisDeadZonePercent,
                        Action.ChannelOutputType,
                        Action.MaxServoAngle,
                        Action.ServoBaseAngle,
                        Action.StepperAngle,
                        Action.SequenceName);
                }
            },
                Translate("Saving"));

            await NavigationService.NavigateBackAsync();
        }