예제 #1
0
 private void Work_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     try
     {
         sweep.Refreshing = false;
         ManageOrderActivity content      = new ManageOrderActivity();
         FragmentTransaction transaction1 = this.FragmentManager.BeginTransaction();
         transaction1.Replace(Resource.Id.framelayout, content);
         transaction1.Commit();
     }
     catch (System.Exception ex)
     {
         Toast.MakeText(Activity, ex.Message, ToastLength.Long).Show();
     }
 }
예제 #2
0
        private async void MakeUnLock()
        {
            try
            {
                using (var client = ClientHelper.GetClient(CrossSettings.Current.GetValueOrDefault("token", "")))
                {
                    ManageOrderService.InitializeClient(client);
                    var o_data = new ServiceResponseObject <SuccessResponse>();
                    o_data = await ManageOrderService.UnLockRollete(StaticOrder.Order_id);

                    if (o_data.Status == HttpStatusCode.OK)
                    {
                        Android.App.AlertDialog.Builder alert1 = new Android.App.AlertDialog.Builder(Activity);
                        alert1.SetTitle("Открытие контейнера");
                        alert1.SetMessage(o_data.Message);
                        alert1.SetPositiveButton("Закрыть", (senderAlert1, args1) =>
                        {
                        });
                        Dialog dialog1 = alert1.Create();
                        dialog1.Show();

                        btn_Lock.Text = "Опустить";
                        Lock.Text     = "Поднята";

                        FragmentTransaction transaction1 = this.FragmentManager.BeginTransaction();
                        ManageOrderActivity content2     = new ManageOrderActivity();
                        transaction1.Replace(Resource.Id.framelayout, content2);
                        transaction1.Commit();
                    }
                    else
                    {
                        Toast.MakeText(Activity, o_data.Message, ToastLength.Long).Show();
                    }
                }
            }
            catch (System.Exception ex)
            {
                Toast.MakeText(Activity, ex.Message, ToastLength.Long).Show();
            }
        }
예제 #3
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            GetOrderParameters();
            var view = inflater.Inflate(Resource.Layout.activity_order_management, container, false);

            #region Иннициализация переменных
            Id           = view.FindViewById <TextView>(Resource.Id.OrderManagementTextIdValue);
            Weight       = view.FindViewById <TextView>(Resource.Id.OrderManagementTexWeight);
            Temperature  = view.FindViewById <TextView>(Resource.Id.OrderManagementTextTemperature);
            Battery      = view.FindViewById <TextView>(Resource.Id.OrderManagementTexBattery);
            Illumination = view.FindViewById <TextView>(Resource.Id.OrderManagementTextIllumination);
            Humidity     = view.FindViewById <TextView>(Resource.Id.OrderManagementTextHumidity);
            //Gate = view.FindViewById<TextView>(Resource.Id.OrderManagementTextGate);
            Lock = view.FindViewById <TextView>(Resource.Id.OrderManagementTextLock);
            //Fold = view.FindViewById<TextView>(Resource.Id.OrderManagementTextFold);
            Events      = view.FindViewById <TextView>(Resource.Id.OrderManagementTextEvents);
            progressBar = view.FindViewById <ProgressBar>(Resource.Id.OrderManagementProgressBar);
            Status      = view.FindViewById <TextView>(Resource.Id.OrderManagementTextStatus);
            Cost        = view.FindViewById <TextView>(Resource.Id.OrderManagementTextCost);
            Payment     = view.FindViewById <TextView>(Resource.Id.OrderManagementTextPayment);
            btn_Pay     = view.FindViewById <Button>(Resource.Id.OrderManagementButtonPay);
            btn_Photo   = view.FindViewById <Button>(Resource.Id.OrderManagementButtonPhoto);
            btn_Video   = view.FindViewById <Button>(Resource.Id.OrderManagementButtonVideo);
            btn_Lock    = view.FindViewById <Button>(Resource.Id.OrderManagementButtonLock);
            #endregion

            Id.Click     += Id_Click;
            Events.Click += Events_Click;

            sweep = view.FindViewById <SwipeRefreshLayout>(Resource.Id.SwipeRefreshLayout);
            sweep.SetColorSchemeColors(Color.Red, Color.Green, Color.Blue, Color.Yellow);
            sweep.Refresh += RefreshLayout_Refresh;

            btn_Lock.Click += delegate
            {
                AlertDialog.Builder alert = new AlertDialog.Builder(Activity);
                if (btn_Lock.Text == "Поднять")
                {
                    alert.SetTitle("Подтверждение действия");
                    alert.SetMessage("Вы действительно хотите поднять роллету контейнера?");
                    alert.SetPositiveButton("Поднять", (senderAlert, args) =>
                    {
                        MakeUnLock();
                    });
                    alert.SetNegativeButton("Отмена", (senderAlert, args) =>
                    {
                    });
                }
                else if (btn_Lock.Text == "Опустить")
                {
                    alert.SetTitle("Подтверждение действия");
                    if (StaticOrder.Order_Stage_Id == "3")
                    {
                        LayoutInflater layoutInflater = LayoutInflater.From(Activity);
                        View           dialogView     = layoutInflater.Inflate(Resource.Layout.modal_transmit_order, null);
                        alert.SetView(dialogView);

                        checkBox = dialogView.FindViewById <CheckBox>(Resource.Id.ManageOrderCheckBox);

                        Date = dialogView.FindViewById <Spinner>(Resource.Id.ManageOrderSpinnerTime);
                        CreateTimeArray();
                        ArrayAdapter <string> adapter = new ArrayAdapter <string>(Activity, Android.Resource.Layout.SimpleSpinnerItem, Time);
                        adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                        Date.Adapter       = adapter;
                        Date.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(SpinnerClass_ItemSelected);
                        Date.Visibility    = ViewStates.Invisible;

                        checkBox.Text   = "Погрузка завершена. Контейнер готов к отправке.";
                        checkBox.Click += delegate
                        {
                            check           = checkBox.Checked;
                            Date.Visibility = ViewStates.Visible;
                            Date.Focusable  = false;
                            Date.Clickable  = false;
                        };
                    }
                    else if (StaticOrder.Order_Stage_Id == "6")
                    {
                        LayoutInflater layoutInflater = LayoutInflater.From(Activity);
                        View           dialogView     = layoutInflater.Inflate(Resource.Layout.modal_transmit_order, null);
                        alert.SetView(dialogView);

                        checkBox = dialogView.FindViewById <CheckBox>(Resource.Id.ManageOrderCheckBox);
                        Date     = dialogView.FindViewById <Spinner>(Resource.Id.ManageOrderSpinnerTime);
                        CreateTimeArray();
                        ArrayAdapter <string> adapter = new ArrayAdapter <string>(Activity, Android.Resource.Layout.SimpleSpinnerItem, Time);
                        adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                        Date.Adapter       = adapter;
                        Date.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(SpinnerClass_ItemSelected);
                        Date.Visibility    = ViewStates.Invisible;

                        checkBox.Text   = "Разгрузка завершена. Контейнер готов к отправке.";
                        checkBox.Click += delegate
                        {
                            check           = checkBox.Checked;
                            Date.Visibility = ViewStates.Visible;
                            Date.Focusable  = false;
                            Date.Clickable  = false;
                        };
                    }
                    alert.SetMessage("Вы действительно хотите опустить роллету контейнера?");
                    alert.SetPositiveButton("Опустить", (senderAlert, args) =>
                    {
                        MakeLock(check);
                        if (check == true)
                        {
                            Transmitt();
                        }

                        FragmentTransaction transaction1 = this.FragmentManager.BeginTransaction();
                        ManageOrderActivity content2     = new ManageOrderActivity();
                        transaction1.Replace(Resource.Id.framelayout, content2).AddToBackStack(null).Commit();
                    });
                }
                Dialog dialog = alert.Create();
                dialog.Show();


                // }
            };

            btn_Pay.Click += delegate
            {
                if (Payment.Text == "неизвестно")
                {
                    Toast.MakeText(Activity, "В настоящий момент невозможно использовать эту кнопку!\nПричина: Неизвестно состояние об оплате.", ToastLength.Long).Show();
                }
                else
                {
                    AlertDialogCreation("Внесение оплаты", "Вы действительно хотите оплатить заказ?");
                }
            };
            btn_Photo.Click += delegate
            {
                AlertDialogCreation("Сделать фотографию", "Вы действительно хотите сделать фотографию с камеры контейнера?");
            };
            btn_Video.Click += delegate
            {
                AlertDialogCreation("Сделать видео", "Вы действительно хотите сделать видео с камеры контейнера?");
            };

            return(view);
        }