Example #1
0
        public void AlertDeleteDialog(LightExamItem item)
        {
            try
            {
                builder     = new AlertDialog.Builder(this);
                alertDialog = builder
                              .SetTitle("提示")
                              .SetMessage("请确认是否需要删除灯光模拟分组:" + item.GroupName + "?")
                              .SetNegativeButton("取消", (s, e) =>
                {
                })
                              .SetPositiveButton("删除灯光分组", (s, e) =>
                {
                    dataService.DeleteLightExamItem(item);
                    InitLightGroup();
                })

                              .Create(); //创建alertDialog对象  
                alertDialog.Show();
            }
            catch (Exception ex)
            {
                Toast.MakeText(this, "系统异常" + ex.Message, ToastLength.Short).Show();
                Logger.Error("Map", ex.Message);
            }
        }
Example #2
0
        public override async Task StopAsync(bool close = false)
        {
            Speaker.CancelAllAsync();
            if (LightExamItem != null)
            {
                await LightExamItem.StopAsync();

                Speaker.CancelAllAsync();
            }
        }
Example #3
0
        public override async Task StartAsync(ExamContext context)
        {
            var signalSet = Singleton.GetCarSignalSet;

            signalSet.Clear();
            var executionContext = new ExamItemExecutionContext(context);

            executionContext.ItemCode = ExamItemCodes.Light;
            Speaker.CancelAllAsync();
            TokenSource = new CancellationTokenSource();
            if (LightExamItem == null)
            {
                LightExamItem = (ILightExamItem)Singleton.GetProviderFactory.CreateExamItem(ExamItemCodes.Light);
            }
            await LightExamItem.StartAsync(executionContext, TokenSource.Token);
        }
        private void OnCarSignalReceived(CarSignalReceivedMessage message)
        {
            if (message.CarSignal == null || message.CarSignal.Gps == null)
            {
                return;
            }
            carSignal = message.CarSignal;

            tempMessage = message;
            //更新界面UI 需要在UI线程操作
            if (LightExamItem != null && LightExamItem.State == ExamItemState.Progressing)
            {
                LightExamItem.Execute(message.CarSignal);
            }
            RunOnUiThread(UpdateCarSensorState);
        }
Example #5
0
        protected override void OnCarSignalReceived(CarSignalReceivedMessage message)
        {
            if (message.CarSignal == null || message.CarSignal.Gps == null)
            {
                return;
            }

            //正常考试应该不会进去
            //点击开始考试LightExamItem
            //多测试多观察
            if (LightExamItem != null && LightExamItem.State == ExamItemState.Progressing)
            {
                LightExamItem.Execute(message.CarSignal);
            }


            tempMessage = message;
            carSignal   = message.CarSignal;

            //更新界面地图更改名字
            MapSecledOption();

            RunOnUiThread(() => { UpdateCarSensorState(); });
        }
Example #6
0
        private void AddLightGroup()
        {
            View     view         = View.Inflate(this, Resource.Layout.Dialog_LightRuleGroup_Input, null);
            EditText edtGroupName = (EditText)view.FindViewById(Resource.Id.InputValueGroupName);
            EditText edt1         = (EditText)view.FindViewById(Resource.Id.InputValue1);
            EditText edt2         = (EditText)view.FindViewById(Resource.Id.InputValue2);
            EditText edt3         = (EditText)view.FindViewById(Resource.Id.InputValue3);
            EditText edt4         = (EditText)view.FindViewById(Resource.Id.InputValue4);
            EditText edt5         = (EditText)view.FindViewById(Resource.Id.InputValue5);
            EditText edt6         = (EditText)view.FindViewById(Resource.Id.InputValue6);
            EditText edt7         = (EditText)view.FindViewById(Resource.Id.InputValue7);
            EditText edt8         = (EditText)view.FindViewById(Resource.Id.InputValue8);
            EditText edt9         = (EditText)view.FindViewById(Resource.Id.InputValue9);
            EditText edt10        = (EditText)view.FindViewById(Resource.Id.InputValue10);

            builder     = new AlertDialog.Builder(this);
            alertDialog = builder
                          .SetTitle("新增灯光模拟分组")
                          .SetView(view)
                          .SetNegativeButton("取消", (s, e) =>
            {
            })
                          .SetPositiveButton("确定", (s, e) =>
            {
                //保存地图记录地图
                string LightRuleGroupName = edtGroupName.Text;
                if (string.IsNullOrEmpty(LightRuleGroupName))
                {
                    return;
                }
                else
                {
                    //一组,1,2,3,4,5
                    LightExamItem Item = new LightExamItem();
                    Item.GroupName     = LightRuleGroupName;
                    string LightRules  = string.Empty;
                    if (!string.IsNullOrEmpty(edt1.Text))
                    {
                        LightRules = edt1.Text + ",";
                    }
                    if (!string.IsNullOrEmpty(edt2.Text))
                    {
                        LightRules = LightRules + edt2.Text + ",";
                    }
                    if (!string.IsNullOrEmpty(edt3.Text))
                    {
                        LightRules = LightRules + edt3.Text + ",";
                    }
                    if (!string.IsNullOrEmpty(edt4.Text))
                    {
                        LightRules = LightRules + edt4.Text + ",";
                    }
                    if (!string.IsNullOrEmpty(edt5.Text))
                    {
                        LightRules = LightRules + edt5.Text + ",";
                    }
                    if (!string.IsNullOrEmpty(edt6.Text))
                    {
                        LightRules = LightRules + edt6.Text + ",";
                    }
                    if (!string.IsNullOrEmpty(edt7.Text))
                    {
                        LightRules = LightRules + edt7.Text + ",";
                    }
                    if (!string.IsNullOrEmpty(edt8.Text))
                    {
                        LightRules = LightRules + edt8.Text + ",";
                    }
                    if (!string.IsNullOrEmpty(edt9.Text))
                    {
                        LightRules = LightRules + edt9.Text + ",";
                    }
                    if (!string.IsNullOrEmpty(edt10.Text))
                    {
                        LightRules = LightRules + edt10.Text + ",";
                    }
                    Logger.Error(LightRules);
                    LightRules = LightRules.Substring(0, LightRules.Length - 1);

                    Item.LightRules = LightRules;
                    dataService.SaveLightExamItem(Item);
                    InitLightGroup();
                }
            })
                          .Create(); //创建alertDialog对象  

            alertDialog.Show();
        }
Example #7
0
        /// <summary>
        /// 编辑灯光模拟分组
        /// </summary>
        private void EditLightGroup(LightExamItem Item)
        {
            View     view         = View.Inflate(this, Resource.Layout.Dialog_LightRuleGroup_Input, null);
            EditText edtGroupName = (EditText)view.FindViewById(Resource.Id.InputValueGroupName);
            EditText edt1         = (EditText)view.FindViewById(Resource.Id.InputValue1);
            EditText edt2         = (EditText)view.FindViewById(Resource.Id.InputValue2);
            EditText edt3         = (EditText)view.FindViewById(Resource.Id.InputValue3);
            EditText edt4         = (EditText)view.FindViewById(Resource.Id.InputValue4);
            EditText edt5         = (EditText)view.FindViewById(Resource.Id.InputValue5);
            EditText edt6         = (EditText)view.FindViewById(Resource.Id.InputValue6);
            EditText edt7         = (EditText)view.FindViewById(Resource.Id.InputValue7);
            EditText edt8         = (EditText)view.FindViewById(Resource.Id.InputValue8);
            EditText edt9         = (EditText)view.FindViewById(Resource.Id.InputValue9);
            EditText edt10        = (EditText)view.FindViewById(Resource.Id.InputValue10);

            edtGroupName.Text    = Item.GroupName;
            edtGroupName.Enabled = false;

            var Lights = Item.LightRules.Split(',');

            SetLightGroupText(Lights, 0, edt1);
            SetLightGroupText(Lights, 1, edt2);
            SetLightGroupText(Lights, 2, edt3);
            SetLightGroupText(Lights, 3, edt4);
            SetLightGroupText(Lights, 4, edt5);
            SetLightGroupText(Lights, 5, edt6);
            SetLightGroupText(Lights, 6, edt7);
            SetLightGroupText(Lights, 7, edt8);
            SetLightGroupText(Lights, 8, edt9);
            SetLightGroupText(Lights, 9, edt10);
            //然后进行赋值



            builder     = new AlertDialog.Builder(this);
            alertDialog = builder
                          .SetTitle("编辑灯光模拟分组")
                          .SetView(view)
                          .SetNegativeButton("取消", (s, e) =>
            {
            })
                          .SetPositiveButton("确定", (s, e) =>
            {
                //保存地图记录地图
                string LightRuleGroupName = edtGroupName.Text;
                if (string.IsNullOrEmpty(LightRuleGroupName))
                {
                    return;
                }
                else
                {
                    string LightRules = string.Empty;
                    if (!string.IsNullOrEmpty(edt1.Text))
                    {
                        LightRules = edt1.Text + ",";
                    }
                    if (!string.IsNullOrEmpty(edt2.Text))
                    {
                        LightRules = LightRules + edt2.Text + ",";
                    }
                    if (!string.IsNullOrEmpty(edt3.Text))
                    {
                        LightRules = LightRules + edt3.Text + ",";
                    }
                    if (!string.IsNullOrEmpty(edt4.Text))
                    {
                        LightRules = LightRules + edt4.Text + ",";
                    }
                    if (!string.IsNullOrEmpty(edt5.Text))
                    {
                        LightRules = LightRules + edt5.Text + ",";
                    }
                    if (!string.IsNullOrEmpty(edt6.Text))
                    {
                        LightRules = LightRules + edt6.Text + ",";
                    }
                    if (!string.IsNullOrEmpty(edt7.Text))
                    {
                        LightRules = LightRules + edt7.Text + ",";
                    }
                    if (!string.IsNullOrEmpty(edt8.Text))
                    {
                        LightRules = LightRules + edt8.Text + ",";
                    }
                    if (!string.IsNullOrEmpty(edt9.Text))
                    {
                        LightRules = LightRules + edt9.Text + ",";
                    }
                    if (!string.IsNullOrEmpty(edt10.Text))
                    {
                        LightRules = LightRules + edt10.Text + ",";
                    }
                    LightRules = LightRules.Substring(0, LightRules.Length - 1);

                    Item.LightRules = LightRules;
                    dataService.UpdateLightExamItem(Item);
                    InitLightGroup();
                }
            })
                          .Create(); //创建alertDialog对象  

            alertDialog.Show();
        }