public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate(Resource.Layout.driver_box_management, container, false); Id = view.FindViewById <TextView>(Resource.Id.TaskManagementTextIdValue1); Weight = view.FindViewById <TextView>(Resource.Id.OrderManagementTexWeight1); Temperature = view.FindViewById <TextView>(Resource.Id.OrderManagementTextTemperature1); Battery = view.FindViewById <TextView>(Resource.Id.OrderManagementTexBattery1); Illumination = view.FindViewById <TextView>(Resource.Id.OrderManagementTextIllumination1); Humidity = view.FindViewById <TextView>(Resource.Id.OrderManagementTextHumidity1); Gate = view.FindViewById <TextView>(Resource.Id.OrderManagementTextState1); Lock = view.FindViewById <TextView>(Resource.Id.OrderManagementTextCastle1); Fold = view.FindViewById <TextView>(Resource.Id.OrderManagementTextRoleta1); Events = view.FindViewById <TextView>(Resource.Id.OrderManagementTextEvents1); var btn_order = view.FindViewById <Button>(Resource.Id.btn_about_order); btn_order.Click += delegate { try { FragmentTransaction transaction = this.FragmentManager.BeginTransaction(); MainOrderStatusActivity content = new MainOrderStatusActivity(); transaction.Replace(Resource.Id.frameDriverlayout, content).AddToBackStack(null).Commit(); } catch (Exception ex) { Toast.MakeText(Application.Context, ex.Message, ToastLength.Long); } }; var result = GetTasks(); if (result.Result == TaskStatus.OK) { GetOrderParameters(); } else if (result.Result == TaskStatus.OrderNotImplemented) { StaticUser.NamePadeAbsenceSomething = "OrderNotFoundForDriver"; Android.App.FragmentTransaction transaction1 = this.FragmentManager.BeginTransaction(); NotFoundOrdersActivity content = new NotFoundOrdersActivity(); transaction1.Replace(Resource.Id.frameDriverlayout, content); transaction1.Commit(); } else { FragmentTransaction ft = this.FragmentManager.BeginTransaction(); TaskNotFoundActivity act = new TaskNotFoundActivity(); ft.Replace(Resource.Id.frameDriverlayout, act); ft.Commit(); } return(view); }
public override View GetView(int position, View convertView, ViewGroup parent) { View view = convertView; try { IViewItemType viewItem = tasks[position]; if (viewItem.GetViewType() == ViewType.Header) { CurrentTaskModel taskViewContent = (CurrentTaskModel)viewItem; view = inflater.Inflate(Resource.Layout.driver_header_task, null); #region Объявление переменных в заголовке var txt_order_id = view.FindViewById <TextView>(Resource.Id.btn_about_order); var txt_title = view.FindViewById <TextView>(Resource.Id.txtTaskName); btn_perform = view.FindViewById <Button>(Resource.Id.btn_prime2); btn_interrupt = view.FindViewById <Button>(Resource.Id.btn_prime); #endregion txt_order_id.Text = StaticTask.order_id; txt_title.Text = StaticTask.title; //btn_about_order.Click += async delegate //{ // OrderActivity content = new OrderActivity(); // transaction1.Replace(Resource.Id.frameDriverlayout, content).AddToBackStack(null).Commit(); //}; btn_perform.Click += async delegate { LayoutInflater layoutInflater = LayoutInflater.From(context); View view = layoutInflater.Inflate(Resource.Layout.driver_choice_box, null); AlertDialog.Builder alert = new AlertDialog.Builder(context); alert.SetView(view); #region Объявление переменных в диалоговом окне var RadioGroupBoxDriver = view.FindViewById <RadioGroup>(Resource.Id.RadioGroupBoxDriver); var txt_choice_box = view.FindViewById <TextView>(Resource.Id.txt_choice_box); #endregion if (StaticTask.containers_id == null) { txt_choice_box.Visibility = ViewStates.Invisible; } else if (StaticTask.containers_id.Count != 0) { txt_choice_box.Visibility = ViewStates.Visible; // Create Radio Group //var rg = new RadioGroup(this); //layout.AddView(rg); var rb = new RadioButton(context) { Text = StaticTask.containers_id[0], Focusable = true }; RadioGroupBoxDriver.AddView(rb); StaticTask.box_id = StaticTask.containers_id[0]; rb.Checked = true; for (int i = 1; i < StaticTask.containers_id.Count; i++) { var rb1 = new RadioButton(context) { Text = StaticTask.containers_id[i] }; RadioGroupBoxDriver.AddView(rb1); } #region Обработка событий кнопок // Show Radio Button Selected RadioGroupBoxDriver.CheckedChange += (s, e) => { try { StaticTask.box_id = StaticTask.containers_id[e.CheckedId - 1]; } catch (Exception ex) { Toast.MakeText(context, ex.Message, ToastLength.Long); } }; #endregion } alert.SetCancelable(false) .SetPositiveButton("Выполнил", delegate { PerformTask(); }) .SetNegativeButton("Отмена", delegate { alert.Dispose(); }); Dialog dialog = alert.Create(); dialog.Show(); }; btn_interrupt.Click += async delegate { LayoutInflater layoutInflater = LayoutInflater.From(context); View view = layoutInflater.Inflate(Resource.Layout.driver_confirm_task, null); AlertDialog.Builder alert = new AlertDialog.Builder(context); alert.SetView(view); #region Объявление переменных в диалоговом окне var edit_text_other_task = view.FindViewById <EditText>(Resource.Id.edit_text_other_task); var rbnt_malfunction_task = view.FindViewById <RadioButton>(Resource.Id.rbnt_malfunction_task); var rbnt_relaxation_task = view.FindViewById <RadioButton>(Resource.Id.rbnt_relaxation_task); var rbnt_finished_shift_task = view.FindViewById <RadioButton>(Resource.Id.rbnt_finished_shift_task); var rbnt_other_task = view.FindViewById <RadioButton>(Resource.Id.rbnt_other_task); edit_text_other_task.Enabled = false; #endregion #region Обработка событий кнопок rbnt_other_task.Click += delegate { edit_text_other_task.Enabled = true; StaticTask.comment = edit_text_other_task.Text; }; rbnt_finished_shift_task.Click += delegate { edit_text_other_task.Enabled = false; StaticTask.comment = "Закончил смену"; }; rbnt_relaxation_task.Click += delegate { edit_text_other_task.Enabled = false; StaticTask.comment = "Отдых"; }; rbnt_malfunction_task.Click += delegate { edit_text_other_task.Enabled = false; StaticTask.comment = "Неисправность"; }; #endregion alert.SetCancelable(false) .SetPositiveButton("Прервать", delegate { if (rbnt_other_task.Checked) { StaticTask.comment = edit_text_other_task.Text; } AbortTask(); }) .SetNegativeButton("Отмена", delegate { alert.Dispose(); }); Dialog dialog = alert.Create(); dialog.Show(); }; } else if (viewItem.GetViewType() == ViewType.List) { TaskBookModel listViewContent = (TaskBookModel)viewItem; view = inflater.Inflate(Resource.Layout.task_book_parameter, null); view.FindViewById <TextView>(Resource.Id.txtTaskName).Text = "Заказ: " + listViewContent.order_id; view.FindViewById <TextView>(Resource.Id.txtComment).Text = listViewContent.title; var btn = view.FindViewById <Button>(Resource.Id.btn_info_order); btn.Click += async delegate { try { MainOrderStatusActivity content = new MainOrderStatusActivity(); manager.Replace(Resource.Id.frameDriverlayout, content).AddToBackStack(null).Commit(); } catch (Exception ex) { Toast.MakeText(Application.Context, ex.Message, ToastLength.Long); } }; } } catch { } return(view); }
public override View GetView(int position, View convertView, ViewGroup parent) { View view = convertView; if (view == null) { view = LayoutInflater.From(_context).Inflate(Resource.Layout.box_book_parameters, null); } view.FindViewById <TextView>(Resource.Id.txtBoxName).Text = _boxes[position].BoxId; var txt_order_id = view.FindViewById <TextView>(Resource.Id.txt123); txt_order_id.Text = _boxes[position].OrderId; if (_boxes[position].OrderId == "нет заказа") { txt_order_id.SetTextColor(Color.Gray); txt_order_id.Clickable = false; } else { txt_order_id.SetTextColor(Color.SkyBlue); txt_order_id.Clickable = true; txt_order_id.Click += delegate { try { StaticOrder.Order_id = _boxes[position].OrderId; MainOrderStatusActivity content2 = new MainOrderStatusActivity(); _manager.Replace(Resource.Id.frameDriverlayout, content2); _manager.Commit(); } catch (Exception ex) { Toast.MakeText(_context, ex.Message, ToastLength.Long).Show(); } }; } view.FindViewById <ImageView>(Resource.Id.img_box).SetImageResource(_boxes[position].ImageView); view.FindViewById <TextView>(Resource.Id.txt_alarm).Text = _boxes[position].AlarmDescription; var btn_info_box = view.FindViewById <Button>(Resource.Id.btn_info_box); btn_info_box.Click += delegate { StaticBox.id = _boxes[position].Id; StaticOrder.Order_id = _boxes[position].OrderId; try { BoxActivity content2 = new BoxActivity(); _manager.Replace(Resource.Id.frameDriverlayout, content2); _manager.Commit(); } catch (Exception ex) { Toast.MakeText(_context, ex.Message, ToastLength.Long).Show(); } }; //var listView = view.FindViewById<ExpandableListView>(Resource.Id.expandableListView2); //SensorData.SampleChildData(view); //listView.SetAdapter(new ExpandableSensorDataAdapter(_context, SensorData.listDataHeader, SensorData.listDataChild)); //listView.SetOnGroupClickListener(new Activity.Order.OnExpandedListenerService()); return(view); }
public override View GetView(int position, View convertView, ViewGroup parent) { try { View view = convertView; if (view == null) { view = LayoutInflater.From(context).Inflate(Resource.Layout.activity_user_CardView, null); } txtFrom = view.FindViewById <TextView>(Resource.Id.UserCardViewTxtFrom); txtTo = view.FindViewById <TextView>(Resource.Id.UserCardViewTxtTo); NameContainer = view.FindViewById <TextView>(Resource.Id.container_name); Statusview = view.FindViewById <TextView>(Resource.Id.status_view); Cost = view.FindViewById <TextView>(Resource.Id.s_cost); Payment = view.FindViewById <TextView>(Resource.Id.s_payment); Payment.Text = orders[position].payment_status; Cost.Text = orders[position].payment_amount; NameContainer.Text = orders[position].id; Statusview.Text = orders[position].order_stage_id + ". " + orders[position].order_stage_name; //StaticOrder.Order_id = orders[position].id; btn_pay = view.FindViewById <Button>(Resource.Id.btn_pay); progress = view.FindViewById <ProgressBar>(Resource.Id.progressBar); btn_pass_delivery_service = view.FindViewById <Button>(Resource.Id.btn_pass_delivery_service); btn_make_photo = view.FindViewById <Button>(Resource.Id.btn_make_photo); btn_make_video = view.FindViewById <Button>(Resource.Id.btn_make_video); btn_order_management = view.FindViewById <Button>(Resource.Id.btn_order_management); txtFrom.Text = orders[position].inception_address; txtTo.Text = orders[position].destination_address; if (Payment.Text == "1") { Payment.Text = "Оплачено"; Payment.SetTextColor(Color.ParseColor("#8EF892")); } else { Payment.Text = "Не оплачено"; Payment.SetTextColor(Color.ParseColor("#EC8F9B")); } btn_pass_delivery_service.Click += delegate { try { MainOrderStatusActivity content = new MainOrderStatusActivity(); StaticOrder.Order_id = orders[position].id; StaticOrder.Payment_Amount = orders[position].payment_amount; StaticOrder.Payment_Status = orders[position].payment_status; StaticOrder.Event_Count = orders[position].event_count; manager.Replace(Resource.Id.framelayout, content).AddToBackStack(null); manager.Commit(); } catch (Exception ex) { Toast.MakeText(Application.Context, ex.Message, ToastLength.Long); } }; btn_pay.Enabled = (orders[position].order_stage_id == "5") ? true : false; btn_make_photo.Enabled = (orders[position].order_stage_id == "7" || orders[position].order_stage_id == "8" || orders[position].order_stage_id == "1") ? false : true; btn_make_video.Enabled = (orders[position].order_stage_id == "7" || orders[position].order_stage_id == "8" || orders[position].order_stage_id == "1") ? false : true; btn_pay.Click += delegate { try { listPosition.Add(position); if (_Clicked == false) { _Clicked = true; AlertDialog.Builder alert = new AlertDialog.Builder(context); alert.SetTitle("Внесение оплаты"); alert.SetMessage("Вы действительно хотите оплатить заказ?"); alert.SetPositiveButton("Продолжить", (senderAlert, args) => { _Clicked = false; MaxElement = listPosition.Max(); StaticOrder.Order_id = orders[MaxElement].id; MakePayment(alert); listPosition.Clear(); }); alert.SetNegativeButton("Отмена", (senderAlert, args) => { _Clicked = false; listPosition.Clear(); }); Dialog dialog = alert.Create(); dialog.Show(); } //if (Payment.Text == "неизвестно") //{ // Toast.MakeText(context, "В настоящий момент невозможно использовать эту кнопку!\nПричина: Неизвестно состояние об оплате.", ToastLength.Long).Show(); //} //else //{ // AlertDialog.Builder alert = new AlertDialog.Builder(context); // alert.SetTitle("Внесение оплаты"); // alert.SetMessage("Вы действительно хотите оплатить заказ?"); // alert.SetPositiveButton("Продолжить", (senderAlert, args) => // { // StaticOrder.Order_id = orders[position].id; // MakePayment(alert); // }); // alert.SetNegativeButton("Отмена", (senderAlert, args) => // { // }); // Dialog dialog = alert.Create(); // dialog.Show(); //} } catch (Exception ex) { Toast.MakeText(Application.Context, ex.Message, ToastLength.Long); } }; //btn_make_photo.Click += MakePhotoClick; btn_make_photo.Click += delegate { try { listPosition.Add(position); if (_Clicked == false) { _Clicked = true; LayoutInflater layoutInflater = LayoutInflater.From(context); View view = layoutInflater.Inflate(Resource.Layout.qqqqqqww, null); var txtTitle = view.FindViewById <TextView>(Resource.Id.TextTitle); var txtInfo = view.FindViewById <TextView>(Resource.Id.TextInfo); var btn_Negative = view.FindViewById <Button>(Resource.Id.BtnNegative); var btn_Positive = view.FindViewById <Button>(Resource.Id.BtnPositive); txtTitle.Text = "Сделать фотографию"; txtInfo.Text = "Вы действительно хотите сделать фотографию с камеры контейнера?"; Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(context); alert.SetView(view); alert.SetCancelable(false); Dialog dialog = alert.Create(); btn_Positive.Click += delegate { if (btn_Positive.Text == "Открыть") { if (StaticOrder.MessageResult == "1") { dialog.Dismiss(); _Clicked = false; SetPhoto(); } else { Toast.MakeText(context, "Фото ещё не загруженно.", ToastLength.Long).Show(); } } else { btn_Positive.Text = "Открыть"; MaxElement = listPosition.Max(); GetPhoto(orders[MaxElement].id, alert); listPosition.Clear(); } }; btn_Negative.Click += delegate { _Clicked = false; listPosition.Clear(); dialog.Dismiss(); }; dialog.Show(); } //AlertDialog.Builder alert = new AlertDialog.Builder(context); //alert.SetTitle("Сделать фотографию"); //alert.SetMessage("Вы действительно хотите сделать фотографию с камеры контейнера?"); //alert.SetPositiveButton("Сделать", (senderAlert, args) => //{ // GetPhoto(orders[position].id, alert); //}); //alert.SetNegativeButton("Отмена", (senderAlert, args) => //{ //}); //Dialog dialog = alert.Create(); //dialog.Show(); } catch (Exception ex) { Toast.MakeText(Application.Context, ex.Message, ToastLength.Long); } }; btn_make_video.Click += delegate { try { listPosition.Add(position); if (_Clicked == false) { _Clicked = true; LayoutInflater layoutInflater = LayoutInflater.From(context); View view = layoutInflater.Inflate(Resource.Layout.qqqqqqww, null); var txtTitle = view.FindViewById <TextView>(Resource.Id.TextTitle); var txtInfo = view.FindViewById <TextView>(Resource.Id.TextInfo); var btn_Positive = view.FindViewById <Button>(Resource.Id.BtnPositive); var btn_Negative = view.FindViewById <Button>(Resource.Id.BtnNegative); txtTitle.Text = "Сделать видео"; txtInfo.Text = "Вы действительно хотите сделать видео с камеры контейнера?"; Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(context); alert.SetView(view); alert.SetCancelable(false); Dialog dialog = alert.Create(); btn_Positive.Text = "Да"; btn_Positive.Click += delegate { if (btn_Positive.Text == "Открыть") { if (StaticOrder.MessageResult == "1") { dialog.Dismiss(); _Clicked = false; VideoFromServerActivity content = new VideoFromServerActivity(); listPosition.Clear(); manager.Replace(Resource.Id.framelayout, content).AddToBackStack(null); manager.Commit(); } else { Toast.MakeText(context, "Видео ещё не загруженно. Дождитесь оповещения.", ToastLength.Long).Show(); } } else { btn_Positive.Text = "Открыть"; MaxElement = listPosition.Max(); GetVideo(orders[MaxElement].id); } }; btn_Negative.Click += delegate { _Clicked = false; listPosition.Clear(); dialog.Dismiss(); }; dialog.Show(); } } catch (Exception ex) { Toast.MakeText(Application.Context, ex.Message, ToastLength.Long); } }; btn_order_management.Click += delegate { try { ManageOrderActivity content = new ManageOrderActivity(); StaticOrder.Order_id = orders[position].id; StaticOrder.Payment_Amount = orders[position].payment_amount; StaticOrder.Payment_Status = orders[position].payment_status; StaticOrder.Event_Count = orders[position].event_count; manager.Replace(Resource.Id.framelayout, content).AddToBackStack(null).Commit(); } catch (Exception ex) { Toast.MakeText(Application.Context, ex.Message, ToastLength.Long); } }; int order_stage; var result = int.TryParse(orders[position].order_stage_id, out order_stage); if (result == true) { progress.Progress = order_stage; } else { progress.Progress = 0; } //btn.Click += async delegate //{ // OrderActivity content = new OrderActivity(); // manager.Replace(Resource.Id.framelayout, content).AddToBackStack(null).Commit(); //}; return(view); } catch (Exception ex) { var view = convertView; var TextOfError = view.FindViewById <TextView>(Resource.Id.TextOfError); TextOfError.Text += "\n(Ошибка: " + ex.Message + ")"; return(view); } }