Exemplo n.º 1
0
        public static async Task DisplayMessage(this Page page, IAlertMessage messageToDisplay)
        {
            if (!string.IsNullOrEmpty(messageToDisplay.Accept) && messageToDisplay.AcceptCommand != null)
            {
                var response = await page.DisplayAlert(
                    messageToDisplay.Title,
                    messageToDisplay.Message,
                    messageToDisplay.Accept,
                    messageToDisplay.Cancel);

                if (response)
                {
                    messageToDisplay.AcceptCommand.Execute();
                }
                else
                {
                    messageToDisplay.CancelCommand?.Execute();
                }
            }
            else
            {
                await page.DisplayAlert(
                    messageToDisplay.Title,
                    messageToDisplay.Message,
                    messageToDisplay.Cancel);

                messageToDisplay.CancelCommand?.Execute();
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Generate Alerts
 /// </summary>
 /// <param name="alertMessage"></param>
 public void PostMessage(IAlertMessage alertMessage)
 {
     if (TempData["AlertMessage"] == null)
     {
         TempData["AlertMessage"] = new List <IAlertMessage>();
     }
     TempData.ToValue <List <IAlertMessage> >("AlertMessage").Add(alertMessage);
 }
Exemplo n.º 3
0
        protected async Task DisplayAlert(IAlertMessage alertMessage)
        {
            bool result = true;

            if (alertMessage.AlertType == AlertType.Confirmation)
            {
                result = await DisplayAlert("Confirm", alertMessage.Message, "Yes", "No");
            }
            else
            {
                await DisplayAlert(alertMessage.AlertType.ToString(), alertMessage.Message, "OK");
            }
        }
Exemplo n.º 4
0
    public MainViewModel(BluetoothController bluetoothController, IAlertMessage message)
    {
        _bluetoothController = bluetoothController;

        _message = message;

        _selectDeviceInteraction = new Interaction <IDevice[], IDevice>();

        IncreaseSpeedCommand = ReactiveCommand.Create(() =>
        {
            if (Speed == 100)
            {
                return(100);
            }

            return(Speed += 10f);
        });

        DecreaseSpeedCommand = ReactiveCommand.Create(() =>
        {
            if (Speed == 0)
            {
                return(0);
            }

            return(Speed -= 10f);
        });

        _bluetoothController.IsEnabled.ToPropertyEx(this, x => x.IsEnabled);

        _bluetoothController.IsConnected.ToPropertyEx(this, x => x.IsConnected);

        _bluetoothController.SensorValue.ToPropertyEx(this, x => x.SensorValue);



        ScanCommand = ReactiveCommand.CreateFromTask <bool>(OnScanAsync);

        DigitalMoveCommand = ReactiveCommand.CreateFromTask <JoystickDirection>(OnDigitalMoveAsync);
    }
Exemplo n.º 5
0
 void IAlertService5.BeginSend(IAlertMessage message)
 {
     message.BeginSend();
 }
Exemplo n.º 6
0
 void IAlertService5.BeginSend(IAlertMessage message)
 {
     message.BeginSend();
 }
Exemplo n.º 7
0
 /// <summary>
 /// Genera Mensaje de Alerta Html Boostrap Dimissable
 /// </summary>
 /// <param name="html"></param>
 /// <param name="alertMessage"></param>
 /// <param name="hasIcon"></param>
 /// <returns></returns>
 public static IHtmlString Alert(this HtmlHelper html, IAlertMessage alertMessage, bool hasIcon = false) => Alert(html, alertMessage.MessageType, alertMessage.Title, alertMessage.Body, hasIcon);