示例#1
0
        public void AlertDeleteLightRuleDialog(LightRule item)
        {
            try
            {
                builder     = new AlertDialog.Builder(this);
                alertDialog = builder
                              .SetTitle("温馨提示")
                              .SetMessage("请确认是否需要删除灯光模拟项目:" + item.ItemName + "?")
                              .SetNegativeButton("取消", (s, e) =>
                {
                })
                              .SetPositiveButton("删除灯光模拟项目", (s, e) =>
                {
                    dataService.DeleteLightRule(item);
                    InitLightRule();
                })

                              .Create(); //创建alertDialog对象  
                alertDialog.Show();
            }
            catch (Exception ex)
            {
                Toast.MakeText(this, "系统异常" + ex.Message, ToastLength.Short).Show();
                Logger.Error("Map", ex.Message);
            }
        }
示例#2
0
        private void EditLightRule(LightRule lightRule)
        {
            View     view     = View.Inflate(this, Resource.Layout.Dialog_Input_editlightrule, null);
            EditText editText = (EditText)view.FindViewById(Resource.Id.dialog_input_value);

            //进行一个数据绑定
            editText.Text = lightRule.VoiceFile;

            builder     = new AlertDialog.Builder(this);
            alertDialog = builder
                          .SetTitle("编辑灯光模拟项目")
                          .SetView(view)
                          .SetNegativeButton("取消", (s, e) =>
            {
            })
                          .SetPositiveButton("确定", (s, e) =>
            {
                //保存地图记录地图
                string LightRuleName = editText.Text;
                if (!string.IsNullOrEmpty(LightRuleName))
                {
                    lightRule.VoiceText = LightRuleName;
                    lightRule.VoiceFile = LightRuleName;
                    dataService.EditLightRule(lightRule);
                    InitLightRule();
                }
                else
                {
                    //开始
                }
            })
                          .Create(); //创建alertDialog对象  

            alertDialog.Show();
        }
示例#3
0
        //todo:根据李松林要求添加灯光模拟编辑功能

        private void EditLightRuleNew(LightRule lightRule)
        {
            View     view     = View.Inflate(this, Resource.Layout.Dialog_Input_lightrule, null);
            EditText editText = (EditText)view.FindViewById(Resource.Id.dialog_input_value);
            //进行一个数据绑定
            Spinner lightruleSpinner = (Spinner)view.FindViewById(Resource.Id.LightRulespinner);

            BindSpinner(lstLightRule.Select(s => s.Key).ToList <string>(), lightruleSpinner);
            editText.Text = lightRule.ItemName;
            builder       = new AlertDialog.Builder(this);
            alertDialog   = builder
                            .SetTitle("编辑灯光模拟项目")
                            .SetView(view)
                            .SetNegativeButton("取消", (s, e) =>
            {
            })
                            .SetPositiveButton("确定", (s, e) =>
            {
                //保存地图记录地图
                string LightRuleName = editText.Text;
                if (!string.IsNullOrEmpty(LightRuleName))
                {
                    //spinnerHighBeamAddress.SelectedItemPosition
                    int position = lightruleSpinner.SelectedItemPosition;

                    lightRule.ItemCode      = lstItemCode[position];
                    lightRule.ItemName      = LightRuleName;
                    lightRule.LightRuleType = string.Format("TwoPole.Chameleon3.Business.Rules.{0},TwoPole.Chameleon3.Business", lstLightRule[position].Value);
                    lightRule.OperDes       = lstLightRule[position].Key;
                    lightRule.VoiceText     = LightRuleName;
                    lightRule.VoiceFile     = LightRuleName;

                    dataService.EditLightRule(lightRule);

                    InitLightRule();
                }
                else
                {
                    //开始
                }
            })
                            .Create(); //创建alertDialog对象  

            alertDialog.Show();
        }
示例#4
0
 private ILightRule CreateLightRule(LightRule rule, IEnumerable <Setting> settings = null)
 {
     try
     {
         var type = Type.GetType(rule.LightRuleType);
         //如果是一个
         var v = (ILightRule)Activator.CreateInstance(type, true);
         v.Id        = rule.Id;
         v.VoiceFile = rule.VoiceFile;
         v.VoiceText = rule.VoiceText;
         v.RuleCode  = rule.ItemCode;
         var provider   = v as IProvider;
         var nameValues = settings.ToValues();
         provider.Init(nameValues);
         return(v);
     }
     catch (Exception exp)
     {
         Logger.ErrorFormat("创建 ILightRule {0}发生异常,原因:{1}", rule.LightRuleType, exp, exp);
         return(null);
     }
 }
示例#5
0
        private void AddLightRule()
        {
            View     view            = View.Inflate(this, Resource.Layout.Dialog_Input_lightrule, null);
            EditText editText        = (EditText)view.FindViewById(Resource.Id.dialog_input_value);
            CheckBox chkEnableCustom = view.FindViewById <CheckBox>(Resource.Id.chkEnableCustom);

            #region 允许灯光
            CheckBox chkAllowLowBeam        = view.FindViewById <CheckBox>(Resource.Id.chkAllowLowBeamLight);
            CheckBox chkAllowHighBeam       = view.FindViewById <CheckBox>(Resource.Id.chkAllowHighBeamLight);
            CheckBox chkAllowOutlineLight   = view.FindViewById <CheckBox>(Resource.Id.chkAllowOutlineLight);
            CheckBox chkAllowFogLight       = view.FindViewById <CheckBox>(Resource.Id.chkAllowFogLight);
            CheckBox chkAllowTurnLeftLight  = view.FindViewById <CheckBox>(Resource.Id.chkAllowTurnLeftLight);
            CheckBox chkAllowTurnRightLight = view.FindViewById <CheckBox>(Resource.Id.chkAllowTurnRightLight);
            CheckBox chkAllowCautionLight   = view.FindViewById <CheckBox>(Resource.Id.chkAllowCautionLight);
            #endregion
            #region 禁止灯光
            CheckBox chkForbidLowBeam        = view.FindViewById <CheckBox>(Resource.Id.chkForbidLowBeamLight);
            CheckBox chkForbidHighBeam       = view.FindViewById <CheckBox>(Resource.Id.chkForbidHighBeamLight);
            CheckBox chkForbidOutlineLight   = view.FindViewById <CheckBox>(Resource.Id.chkForbidOutlineLight);
            CheckBox chkForbidFogLight       = view.FindViewById <CheckBox>(Resource.Id.chkForbidFogLight);
            CheckBox chkForbidTurnLeftLight  = view.FindViewById <CheckBox>(Resource.Id.chkForbidTurnLeftLight);
            CheckBox chkForbidTurnRightLight = view.FindViewById <CheckBox>(Resource.Id.chkForbidTurnRightLight);
            CheckBox chkForbidCautionLight   = view.FindViewById <CheckBox>(Resource.Id.chkForbidCautionLight);
            #endregion
            #region 交替灯光
            CheckBox chkAlternateLightOne   = view.FindViewById <CheckBox>(Resource.Id.chkAlternateLightOne);
            CheckBox chkAlternateLightTwo   = view.FindViewById <CheckBox>(Resource.Id.chkAlternateLightTwo);
            CheckBox chkAlternateLightThree = view.FindViewById <CheckBox>(Resource.Id.chkAlternateLightThree);
            CheckBox chkAlternateLightFour  = view.FindViewById <CheckBox>(Resource.Id.chkAlternateLightFour);
            #endregion

            //进行一个数据绑定
            Spinner lightruleSpinner = (Spinner)view.FindViewById(Resource.Id.LightRulespinner);
            BindSpinner(lstLightRule.Select(s => s.Key).ToList <string>(), lightruleSpinner);
            builder     = new AlertDialog.Builder(this);
            alertDialog = builder
                          .SetTitle("新增灯光模拟项目")
                          .SetView(view)
                          .SetNegativeButton("取消", (s, e) =>
            {
            })
                          .SetPositiveButton("确定", (s, e) =>
            {
                //保存地图记录地图
                string LightRuleName = editText.Text;
                if (!string.IsNullOrEmpty(LightRuleName))
                {
                    if (!chkEnableCustom.Checked)
                    {
                        int position            = lightruleSpinner.SelectedItemPosition;
                        LightRule lightRule     = new LightRule();
                        lightRule.ItemCode      = lstItemCode[position];
                        lightRule.ItemName      = LightRuleName;
                        lightRule.LightRuleType = string.Format("TwoPole.Chameleon3.Business.Rules.{0},TwoPole.Chameleon3.Business", lstLightRule[position].Value);
                        lightRule.OperDes       = lstLightRule[position].Key;
                        lightRule.VoiceText     = LightRuleName;
                        lightRule.VoiceFile     = LightRuleName;

                        dataService.SaveLightRule(lightRule);

                        InitLightRule();
                    }
                    else //表示的是自选组合
                    {
                        CustomLight customLight = new CustomLight();

                        if (chkAllowLowBeam.Checked)
                        {
                            customLight.Allowlights += "LowBeam,";
                        }
                        if (chkAllowHighBeam.Checked)
                        {
                            customLight.Allowlights += "HighBeam,";
                        }
                        if (chkAllowFogLight.Checked)
                        {
                            customLight.Allowlights += "FogLight,";
                        }
                        if (chkAllowCautionLight.Checked)
                        {
                            customLight.Allowlights += "CautionLight,";
                        }
                        if (chkAllowOutlineLight.Checked)
                        {
                            customLight.Allowlights += "OutlineLight,";
                        }
                        if (chkAllowTurnLeftLight.Checked)
                        {
                            customLight.Allowlights += "LeftIndicatorLight,";
                        }
                        if (chkAllowTurnRightLight.Checked)
                        {
                            customLight.Allowlights += "RightIndicatorLight,";
                        }
                        if (string.IsNullOrEmpty(customLight.Allowlights))
                        {
                            return;
                        }
                        customLight.Allowlights = customLight.Allowlights.Substring(0, customLight.Allowlights.Length - 1);

                        if (chkForbidLowBeam.Checked)
                        {
                            customLight.Fobbidlights += "LowBeam,";
                        }
                        if (chkForbidHighBeam.Checked)
                        {
                            customLight.Fobbidlights += "HighBeam,";
                        }
                        if (chkForbidFogLight.Checked)
                        {
                            customLight.Fobbidlights += "FogLight,";
                        }
                        if (chkForbidCautionLight.Checked)
                        {
                            customLight.Fobbidlights += "CautionLight,";
                        }
                        if (chkForbidOutlineLight.Checked)
                        {
                            customLight.Fobbidlights += "OutlineLight,";
                        }
                        if (chkForbidTurnLeftLight.Checked)
                        {
                            customLight.Fobbidlights += "LeftIndicatorLight,";
                        }
                        if (chkForbidTurnRightLight.Checked)
                        {
                            customLight.Fobbidlights += "RightIndicatorLight,";
                        }
                        if (string.IsNullOrEmpty(customLight.Fobbidlights))
                        {
                            return;
                        }
                        customLight.Fobbidlights = customLight.Fobbidlights.Substring(0, customLight.Fobbidlights.Length - 1);

                        if (chkAlternateLightOne.Checked)
                        {
                            customLight.AlternateCount = 1;
                        }
                        if (chkAlternateLightTwo.Checked)
                        {
                            customLight.AlternateCount = 2;
                        }
                        if (chkAlternateLightThree.Checked)
                        {
                            customLight.AlternateCount = 3;
                        }
                        if (chkAlternateLightFour.Checked)
                        {
                            customLight.AlternateCount = 4;
                        }
                        LightRule lightRule     = new LightRule();
                        lightRule.ItemCode      = "41601";
                        lightRule.ItemName      = LightRuleName;
                        lightRule.LightRuleType = string.Format("TwoPole.Chameleon3.Business.Rules.CustomLightRule,TwoPole.Chameleon3.Business");
                        lightRule.OperDes       = customLight.ToJson();
                        lightRule.VoiceText     = LightRuleName;
                        lightRule.VoiceFile     = LightRuleName;
                    }
                }
                else
                {
                    //开始
                }
            })
                          .Create(); //创建alertDialog对象  

            alertDialog.Show();
        }