コード例 #1
0
        private async void SendButtonOnClick(object sender, EventArgs e)
        {
            if (_messageText.Text == "")
            {
                await AlertDialogHelper.ShowAsync(Activity, "Atención", "Para enviar el mensaje con éxito, es necesario llenar todos los campos.", "OK", "");

                return;
            }

            _sendButton.Activated = false;
            IInboxProxy inboxProxy = BasicProxiesFactory.GetInboxProxy();

            Tuple <int, string> truckInfo = GetTruckId();

            Common.ReportTypesEnum reportType = GetReportType();

            DTO.InboxDTO inboxDTO = GenerateInboxMessage(truckInfo, reportType);

            try
            {
                _lottieAnimation.Visibility = ViewStates.Visible;
                _commentView.Visibility     = ViewStates.Gone;

                var response = await inboxProxy.Create(inboxDTO);
            }
            catch (Exception ex)
            {
                _sendButton.Activated = true;
                Toast.MakeText(Activity, "¡Lo sentimos! El envío de comentarios no se encuentra disponible.", ToastLength.Long).Show();
            }

            FragmentManager.BeginTransaction().Replace(Resource.Id.fragments_container, new Fragments.MessageSend()).Commit();
        }
コード例 #2
0
ファイル: InboxFragment.cs プロジェクト: angelnmara/LumoTrack
        private async Task LoadData()
        {
            try
            {
                IInboxProxy inboxProxy = BasicProxiesFactory.GetInboxProxy();

                var deviceManager = new DeviceManager();

                if (!deviceManager.IsDeviceRegister())
                {
                    await deviceManager.UpsertDeviceAsync(0.0, 0.0);
                }

                var response = await inboxProxy.GetNotification(deviceManager.GetDeviceID());

                _inboxList = response.Data.OrderByDescending(x => x.Id).ToList();
            }
            catch (Exception e)
            {
                Activity.RunOnUiThread(() =>
                                       Toast.MakeText(Activity, "¡Lo sentimos! Los comentarios no se encuentra disponibles.", ToastLength.Long).Show()
                                       );
            }
        }