From e2678b7bb1b68160778609e23a5eea7a809c775b Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期一, 07 三月 2022 17:16:38 +0800 Subject: [PATCH] 2022-3-7-01 --- HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs | 605 ++++++++++++++++++++++++------------------------- HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs | 83 +++--- HDL_ON/DAL/Server/HttpUtil.cs | 4 HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs | 20 - 4 files changed, 351 insertions(+), 361 deletions(-) diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs index 4917487..72fa068 100644 --- a/HDL_ON/DAL/Server/HttpUtil.cs +++ b/HDL_ON/DAL/Server/HttpUtil.cs @@ -17,8 +17,8 @@ /// 鍥哄畾鍩熷悕,姝e紡鐜 /// 鍏叡鍩熷悕灏辫繎瑙f瀽 /// </summary> - public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; - //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm + //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; + public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm /// <summary> /// RegionMark /// </summary> diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs index ea0ee18..845f1de 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs @@ -3,328 +3,319 @@ using Shared; namespace HDL_ON.UI.UI2.Intelligence.Automation { - public class AddInputType : FrameLayout - { - public AddInputType() + public class AddInputType : FrameLayout { - Tag = "Logic"; - } - public void Show() - { - LogicView.TopView topView = new LogicView.TopView(); - this.AddChidren(topView.FLayoutView()); - topView.clickBackBtn.MouseUpEventHandler += (e, sen) => - { - RemoveFromParent(); - }; - topView.topNameBtn.TextID = StringId.selectionCondition; - - FrameLayout viewLayout = new FrameLayout - { - Y = Application.GetRealHeight(64), - Width = Application.GetRealWidth(LogicView.TextSize.view375), - Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64), - BackgroundColor = CSS.CSS_Color.viewMiddle, - }; - this.AddChidren(viewLayout); - #region 鏃堕棿 鍔熻兘 瀹ゅ鍙樺寲 - //鏃堕棿 - LogicView.SelectTypeView timeView = new LogicView.SelectTypeView(); - timeView.btnText.TextID = StringId.time; - timeView.btnIcon.UnSelectedImagePath = "LogicIcon/time.png"; - if (MainView.IsGatewayType) - { - viewLayout.AddChidren(timeView.FLayoutView()); - } - - //鍔熻兘 - LogicView.SelectTypeView functionView = new LogicView.SelectTypeView(); - functionView.frameLayout.Y = timeView.frameLayout.Bottom; - functionView.btnText.TextID = StringId.funLogic; - functionView.btnIcon.UnSelectedImagePath = "LogicIcon/functionicon.png"; - viewLayout.AddChidren(functionView.FLayoutView()); - if (!MainView.IsGatewayType) - { - functionView.frameLayout.Y = Application.GetRealHeight(0); - } - - //鍦烘櫙 - LogicView.SelectTypeView sceneView = new LogicView.SelectTypeView(); - sceneView.frameLayout.Y = functionView.frameLayout.Bottom; - sceneView.btnText.TextID = StringId.Scenes; - sceneView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png"; - viewLayout.AddChidren(sceneView.FLayoutView()); - - //瀹ゅ鍙樺寲 - LogicView.SelectTypeView shiwaiView = new LogicView.SelectTypeView(); - shiwaiView.frameLayout.Y = sceneView.frameLayout.Bottom; - shiwaiView.btnText.TextID = StringId.shiwaibainhua; - shiwaiView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png"; - - if (MainView.IsGatewayType) - { - viewLayout.AddChidren(shiwaiView.FLayoutView()); - } - - //鍦扮悊鍥存爮 - LogicView.SelectTypeView likiadaodaView = new LogicView.SelectTypeView(); - likiadaodaView.frameLayout.Y = shiwaiView.frameLayout.Bottom; - likiadaodaView.btnText.TextID = StringId.likiadaoda; - likiadaodaView.btnIcon.UnSelectedImagePath = "LogicIcon/location.png"; - - if (MainView.IsGatewayType) - { - viewLayout.AddChidren(likiadaodaView.FLayoutView()); - } - - #endregion - - #region 鎵�鏈夌偣鍑讳簨浠� - //鏃堕棿 - timeView.btnClick.MouseUpEventHandler += (sen, e) => - { - TimeTpye timeTpye = new TimeTpye(); - MainPage.BasePageView.AddChidren(timeTpye); - timeTpye.Show(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - - }; - //鍔熻兘 - functionView.btnClick.MouseUpEventHandler += (sen, e) => - { - FunTpye funTpye = new FunTpye(); - MainPage.BasePageView.AddChidren(funTpye); - funTpye.Show(LogicMethod.condition_if); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - }; - //鍦烘櫙鐐瑰嚮浜嬩欢 - sceneView.btnClick.MouseUpEventHandler += (sen, e) => - { - SceneMethod(); - }; - //瀹ゅ鍙樺寲 - shiwaiView.btnClick.MouseUpEventHandler += (sen, e) => - { - //if (string.IsNullOrEmpty(Entity.DB_ResidenceData.Instance.CurrentRegion.homeAddress))//.longitude == 0 && Entity.DB_ResidenceData.Instance.CurrentRegion.latitude == 0) - //{ - // new PublicAssmebly().TipMsg(StringId.tip, StringId.GatewayLocationInformationIsNotConfigured); - // return; - //} - Weather weather = new Weather(); - MainPage.BasePageView.AddChidren(weather); - weather.Show(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - }; - - //鍦扮悊鍥存爮 - likiadaodaView.btnClick.MouseUpEventHandler += (sen, e) => - { - LocationView(this, false); - }; - #endregion - - } - - /// <summary> - /// 娣诲姞鍦烘櫙 - /// </summary> - public void SceneMethod() - { - var sceneList = LogicMethod.CurrLogicMethod.GetSceneList(); - List<string> nameList = new List<string>(); - for (int i = 0; i < sceneList.Count; i++) - { - var scene = sceneList[i]; - nameList.Add(scene.name); - } - PublicInterface publicInterface = new PublicInterface(); - publicInterface.FrameOrVv(this, nameList, new List<string> { }, StringId.addSceneLogic, (index) => - { - var sceneSelecetd = sceneList[index]; - Input input = new Input(); - input.sid = sceneSelecetd.sid; - input.condition_type = "10"; - Dictionary<string, string> dic = new Dictionary<string, string>(); - LogicMethod.CurrLogicMethod.dictionary(dic, "key", "scene"); - LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "="); - LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string"); - LogicMethod.CurrLogicMethod.dictionary(dic, "value", "on"); - input.condition.Add(dic); - AddCondition(input); - LogicMethod.CurrLogicMethod.RemoveAllView(); - AddLogic addLogic = new AddLogic(); - MainPage.BasePageView.AddChidren(addLogic); - addLogic.Show(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - }); - } - /// <summary> - /// 娣诲姞鍦扮悊鍥存爮 - /// </summary> - /// <param name="flMain">Fl main.</param> - /// <param name="edit">If set to <c>true</c> edit.</param> - public void LocationView(FrameLayout flMain, bool edit) - { - string strname = ""; - ///閫氳繃璋冭瘯瀹濈粰鐨勭粡绾害<鏍囧噯GPS> - double latitude = Entity.DB_ResidenceData.Instance.CurrentRegion.latitude;//绾害 - double longitude = Entity.DB_ResidenceData.Instance.CurrentRegion.longitude;//缁忓害 - LogicMethod.CurrLogicMethod.WGS84_to_GCJ02(Entity.DB_ResidenceData.Instance.CurrentRegion.longitude, Entity.DB_ResidenceData.Instance.CurrentRegion.latitude, out longitude, out latitude); - int r = 500;//榛樿鍗婂緞 - if (edit) - { - for (var i = 0; i < Logic.currlogic.input.Count; i++) + public AddInputType() { - var input = Logic.currlogic.input[i]; - if (input.condition_type != "8") - { - continue; - } - if (input.condition[0]["value"] == "arrive") - { - //鍒拌揪鏌愬湴 - strname = Language.StringByID(StringId.daoda); - } - else - { - //绂诲紑鍦扮偣 - strname = Language.StringByID(StringId.likai); - } - //鍐嶄竴娆$紪杈戝湴鐞嗗洿鏍� <鎺т欢鏆傛椂涓嶆敮鎸佹樉绀鸿褰曚笂涓�娆$殑鐘舵��> - if (!string.IsNullOrEmpty(input.geo_fence.latitude) && !string.IsNullOrEmpty(input.geo_fence.longitude)) - { - ////绾害 - //var latitude1 = Convert.ToDouble(input.geo_fence.latitude); - ////缁忓害 - //var longitude1 = Convert.ToDouble(input.geo_fence.longitude); - //鍗婂緞 - r = int.Parse(input.geo_fence.radius); - //WGS84鍧愭爣杞珮寰峰潗鏍� - //LogicMethod.CurrLogicMethod.WGS84_to_GCJ02(longitude1, latitude1, out longitude, out latitude); - } + Tag = "Logic"; } - } - PublicInterface publicInterface = new PublicInterface(); - var list = publicInterface.GetViewList("鍦扮悊鍥存爮"); - publicInterface.SingleSelectionShow(flMain, list, Language.StringByID(StringId.likiadaoda), strname, (str) => - { + /// <summary> + /// 榛樿閫変腑鏄埧闂存椂锛氬叏閮ㄥ尯鍩� + /// </summary> + private Entity.Room selectedRoom = new Entity.Room { roomId = "6688" }; + /// <summary> + /// 琛ㄧず鏄�(鏉′欢/鐩爣) + /// </summary> + private string if_type = LogicMethod.condition_if; + public void Show() + { + LogicView.TopView topView = new LogicView.TopView(); + this.AddChidren(topView.FLayoutView()); + topView.clickBackBtn.MouseUpEventHandler += (e, sen) => + { + RemoveFromParent(); + }; + topView.topNameBtn.TextID = StringId.selectionCondition; - string valueStr = "arrive"; - if (str == Language.StringByID(StringId.daoda)) - { - //鍒拌揪鏌愬湴 - valueStr = "arrive"; - } - else - { - //绂诲紑 - valueStr = "leave"; - } + FrameLayout viewLayout = new FrameLayout + { + Y = Application.GetRealHeight(64), + Width = Application.GetRealWidth(LogicView.TextSize.view375), + Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64), + BackgroundColor = CSS.CSS_Color.viewMiddle, + }; + this.AddChidren(viewLayout); + #region 鏃堕棿 鍔熻兘 瀹ゅ鍙樺寲 + //鏃堕棿 + LogicView.SelectTypeView timeView = new LogicView.SelectTypeView(); + timeView.btnText.TextID = StringId.time; + timeView.btnIcon.UnSelectedImagePath = "LogicIcon/time.png"; + if (MainView.IsGatewayType) + { + viewLayout.AddChidren(timeView.FLayoutView()); + } + //鍦烘櫙 + LogicView.SelectTypeView sceneView = new LogicView.SelectTypeView(); + sceneView.frameLayout.Y = timeView.frameLayout.Bottom; + sceneView.btnText.TextID = StringId.Scenes; + sceneView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png"; + viewLayout.AddChidren(sceneView.FLayoutView()); + + //瀹ゅ鍙樺寲 + LogicView.SelectTypeView shiwaiView = new LogicView.SelectTypeView(); + shiwaiView.frameLayout.Y = sceneView.frameLayout.Bottom; + shiwaiView.btnText.TextID = StringId.shiwaibainhua; + shiwaiView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png"; + + if (MainView.IsGatewayType) + { + viewLayout.AddChidren(shiwaiView.FLayoutView()); + } + + //鍦扮悊鍥存爮 + LogicView.SelectTypeView likiadaodaView = new LogicView.SelectTypeView(); + likiadaodaView.frameLayout.Y = shiwaiView.frameLayout.Bottom; + likiadaodaView.btnText.TextID = StringId.likiadaoda; + likiadaodaView.btnIcon.UnSelectedImagePath = "LogicIcon/location.png"; + + if (MainView.IsGatewayType) + { + viewLayout.AddChidren(likiadaodaView.FLayoutView()); + } + ////鍔熻兘 + ///浜у搧缁忕悊鍚涚剷瑕佹眰锛岃澶囧姛鑳界Щ鍒拌繖閲屻��<2022-3-7> + new FunTpye(LogicMethod.condition_if).FunTypeView(viewLayout, likiadaodaView.frameLayout.Bottom,4); + + #endregion + + #region 鎵�鏈夌偣鍑讳簨浠� + //鏃堕棿 + timeView.btnClick.MouseUpEventHandler += (sen, e) => + { + TimeTpye timeTpye = new TimeTpye(); + MainPage.BasePageView.AddChidren(timeTpye); + timeTpye.Show(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + + }; + + //鍦烘櫙鐐瑰嚮浜嬩欢 + sceneView.btnClick.MouseUpEventHandler += (sen, e) => + { + SceneMethod(); + }; + //瀹ゅ鍙樺寲 + shiwaiView.btnClick.MouseUpEventHandler += (sen, e) => + { + //if (string.IsNullOrEmpty(Entity.DB_ResidenceData.Instance.CurrentRegion.homeAddress))//.longitude == 0 && Entity.DB_ResidenceData.Instance.CurrentRegion.latitude == 0) + //{ + // new PublicAssmebly().TipMsg(StringId.tip, StringId.GatewayLocationInformationIsNotConfigured); + // return; + //} + Weather weather = new Weather(); + MainPage.BasePageView.AddChidren(weather); + weather.Show(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + //鍦扮悊鍥存爮 + likiadaodaView.btnClick.MouseUpEventHandler += (sen, e) => + { + LocationView(this, false); + }; + #endregion + + } + /// <summary> + /// 娣诲姞鍦烘櫙 + /// </summary> + public void SceneMethod() + { + var sceneList = LogicMethod.CurrLogicMethod.GetSceneList(); + List<string> nameList = new List<string>(); + for (int i = 0; i < sceneList.Count; i++) + { + var scene = sceneList[i]; + nameList.Add(scene.name); + } + PublicInterface publicInterface = new PublicInterface(); + publicInterface.FrameOrVv(this, nameList, new List<string> { }, StringId.addSceneLogic, (index) => + { + var sceneSelecetd = sceneList[index]; + Input input = new Input(); + input.sid = sceneSelecetd.sid; + input.condition_type = "10"; + Dictionary<string, string> dic = new Dictionary<string, string>(); + LogicMethod.CurrLogicMethod.dictionary(dic, "key", "scene"); + LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "="); + LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string"); + LogicMethod.CurrLogicMethod.dictionary(dic, "value", "on"); + input.condition.Add(dic); + AddCondition(input); + LogicMethod.CurrLogicMethod.RemoveAllView(); + AddLogic addLogic = new AddLogic(); + MainPage.BasePageView.AddChidren(addLogic); + addLogic.Show(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }); + } + /// <summary> + /// 娣诲姞鍦扮悊鍥存爮 + /// </summary> + /// <param name="flMain">Fl main.</param> + /// <param name="edit">If set to <c>true</c> edit.</param> + public void LocationView(FrameLayout flMain, bool edit) + { + string strname = ""; + ///閫氳繃璋冭瘯瀹濈粰鐨勭粡绾害<鏍囧噯GPS> + double latitude = Entity.DB_ResidenceData.Instance.CurrentRegion.latitude;//绾害 + double longitude = Entity.DB_ResidenceData.Instance.CurrentRegion.longitude;//缁忓害 + LogicMethod.CurrLogicMethod.WGS84_to_GCJ02(Entity.DB_ResidenceData.Instance.CurrentRegion.longitude, Entity.DB_ResidenceData.Instance.CurrentRegion.latitude, out longitude, out latitude); + int r = 500;//榛樿鍗婂緞 + if (edit) + { + for (var i = 0; i < Logic.currlogic.input.Count; i++) + { + var input = Logic.currlogic.input[i]; + if (input.condition_type != "8") + { + continue; + } + if (input.condition[0]["value"] == "arrive") + { + //鍒拌揪鏌愬湴 + strname = Language.StringByID(StringId.daoda); + } + else + { + //绂诲紑鍦扮偣 + strname = Language.StringByID(StringId.likai); + } + //鍐嶄竴娆$紪杈戝湴鐞嗗洿鏍� <鎺т欢鏆傛椂涓嶆敮鎸佹樉绀鸿褰曚笂涓�娆$殑鐘舵��> + if (!string.IsNullOrEmpty(input.geo_fence.latitude) && !string.IsNullOrEmpty(input.geo_fence.longitude)) + { + ////绾害 + //var latitude1 = Convert.ToDouble(input.geo_fence.latitude); + ////缁忓害 + //var longitude1 = Convert.ToDouble(input.geo_fence.longitude); + //鍗婂緞 + r = int.Parse(input.geo_fence.radius); + //WGS84鍧愭爣杞珮寰峰潗鏍� + //LogicMethod.CurrLogicMethod.WGS84_to_GCJ02(longitude1, latitude1, out longitude, out latitude); + } + } + } + PublicInterface publicInterface = new PublicInterface(); + var list = publicInterface.GetViewList("鍦扮悊鍥存爮"); + publicInterface.SingleSelectionShow(flMain, list, Language.StringByID(StringId.likiadaoda), strname, (str) => + { + + string valueStr = "arrive"; + if (str == Language.StringByID(StringId.daoda)) + { + //鍒拌揪鏌愬湴 + valueStr = "arrive"; + } + else + { + //绂诲紑 + valueStr = "leave"; + } #if __Android__ - //鐢宠瀹氫綅鏉冮檺 - ((BaseActivity)Application.Activity).SetGPSLocationPermission((result1) => - { - if (result1 == false) { return; } + //鐢宠瀹氫綅鏉冮檺 + ((BaseActivity)Application.Activity).SetGPSLocationPermission((result1) => + { + if (result1 == false) { return; } - //鐢宠鍏佽绋嬪簭鍐欏叆澶栭儴瀛樺偍锛屽SD鍗′笂鍐欐枃浠� - ((BaseActivity)Application.Activity).SetPermission((result2) => - { - if (result2 == false) { return; } - //璇诲彇鐢佃瘽鐘舵�佹潈闄� - ((BaseActivity)Application.Activity).SetPermission((result3) => - { - if (result3 == false) { return; } - //璋冪敤鏂规硶锛岃烦杞〉闈� - Location(valueStr, strname, latitude, longitude, r); - }, "android.permission.READ_PHONE_STATE"); + //鐢宠鍏佽绋嬪簭鍐欏叆澶栭儴瀛樺偍锛屽SD鍗′笂鍐欐枃浠� + ((BaseActivity)Application.Activity).SetPermission((result2) => + { + if (result2 == false) { return; } + //璇诲彇鐢佃瘽鐘舵�佹潈闄� + ((BaseActivity)Application.Activity).SetPermission((result3) => + { + if (result3 == false) { return; } + //璋冪敤鏂规硶锛岃烦杞〉闈� + Location(valueStr, strname, latitude, longitude, r); + }, "android.permission.READ_PHONE_STATE"); - }, "android.permission.WRITE_EXTERNAL_STORAGE"); - }); + }, "android.permission.WRITE_EXTERNAL_STORAGE"); + }); #endif #if __IOS__ //璋冪敤鏂规硶锛岃烦杞〉闈� Location(valueStr, strname, latitude, longitude, r); #endif - }); + }); - } - /// <summary> - /// 鍦扮悊鍥存爮View - /// </summary> - /// <param name="valueStr">杩涘叆(arrive)鎴栬�呯寮�(leave)</param> - /// <param name="strname"></param> - /// <param name="latitude">绾害</param> - /// <param name="longitude">缁忓害</param> - /// <param name="r">鍗婂緞(榛樿500绫�)</param> - private void Location(string valueStr, string strname, double latitude, double longitude, int r) - { - if (r == 0) - { - //鎸夐亾鐞嗚涓嶄細鍑虹幇 - r = 500; - } - //璋冪敤鏂规硶锛岃烦杞〉闈� - GDMapKit.Show((mLatitude, mLongitude, mRadius, name) => - { - //楂樺痉鍧愭爣杞琖GS84鍧愭爣(楂樺痉鍦板浘璁剧疆GPS) - double out_lng, out_lat; - LogicMethod.CurrLogicMethod.GCJ02_to_WGS84(mLongitude, mLatitude, out out_lng, out out_lat); - Input input = new Input(); - input.sid = LogicMethod.CurrLogicMethod.NewSid(); - input.condition_type = "8"; - Dictionary<string, string> dic = new Dictionary<string, string>(); - LogicMethod.CurrLogicMethod.dictionary(dic, "key", "direction"); - LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "="); - LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string"); - LogicMethod.CurrLogicMethod.dictionary(dic, "value", valueStr); - input.condition.Add(dic); - //绾害 - input.geo_fence.latitude = out_lat.ToString(); - //缁忓害 - input.geo_fence.longitude = out_lng.ToString(); - //鍗婂緞<鍗曚綅绫�> - input.geo_fence.radius = mRadius.ToString(); - AddCondition(input); - LogicMethod.CurrLogicMethod.RemoveAllView(); - AddLogic addLogic = new AddLogic(); - MainPage.BasePageView.AddChidren(addLogic); - addLogic.Show(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - - }, strname, Language.StringByID(StringId.save), true, latitude, longitude, r); - } - /// <summary> - /// 娣诲姞鏉′欢 - /// </summary> - /// <param name="input"></param> - private void AddCondition(Input input) - { - ///璁板綍绱㈠紩鍊� - int index = -1; - for (var i = 0; i < Logic.currlogic.input.Count; i++) - { - var condition_type = Logic.currlogic.input[i].condition_type; - if (condition_type == "10" || condition_type == "8") - { - //鏀寔鍦烘櫙=10锛屽湴鐞嗗洿鏍�=8 - ///鎵惧埌鏍囪绱㈠紩锛岄��鍑哄惊鐜綋 - index = i; - break; } - } - if (index != -1) - { - //绉婚櫎鏃ф暟鎹� - Logic.currlogic.input.RemoveAt(index); - //鏂版暟鎹彃鍏ユ棫鏁版嵁鐨勪綅缃� - Logic.currlogic.input.Insert(index, input); - } - else - { - Logic.currlogic.input.Add(input); - } + /// <summary> + /// 鍦扮悊鍥存爮View + /// </summary> + /// <param name="valueStr">杩涘叆(arrive)鎴栬�呯寮�(leave)</param> + /// <param name="strname"></param> + /// <param name="latitude">绾害</param> + /// <param name="longitude">缁忓害</param> + /// <param name="r">鍗婂緞(榛樿500绫�)</param> + private void Location(string valueStr, string strname, double latitude, double longitude, int r) + { + if (r == 0) + { + //鎸夐亾鐞嗚涓嶄細鍑虹幇 + r = 500; + } + //璋冪敤鏂规硶锛岃烦杞〉闈� + GDMapKit.Show((mLatitude, mLongitude, mRadius, name) => + { + //楂樺痉鍧愭爣杞琖GS84鍧愭爣(楂樺痉鍦板浘璁剧疆GPS) + double out_lng, out_lat; + LogicMethod.CurrLogicMethod.GCJ02_to_WGS84(mLongitude, mLatitude, out out_lng, out out_lat); + Input input = new Input(); + input.sid = LogicMethod.CurrLogicMethod.NewSid(); + input.condition_type = "8"; + Dictionary<string, string> dic = new Dictionary<string, string>(); + LogicMethod.CurrLogicMethod.dictionary(dic, "key", "direction"); + LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "="); + LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string"); + LogicMethod.CurrLogicMethod.dictionary(dic, "value", valueStr); + input.condition.Add(dic); + //绾害 + input.geo_fence.latitude = out_lat.ToString(); + //缁忓害 + input.geo_fence.longitude = out_lng.ToString(); + //鍗婂緞<鍗曚綅绫�> + input.geo_fence.radius = mRadius.ToString(); + AddCondition(input); + LogicMethod.CurrLogicMethod.RemoveAllView(); + AddLogic addLogic = new AddLogic(); + MainPage.BasePageView.AddChidren(addLogic); + addLogic.Show(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + + }, strname, Language.StringByID(StringId.save), true, latitude, longitude, r); + } + /// <summary> + /// 娣诲姞鏉′欢 + /// </summary> + /// <param name="input"></param> + private void AddCondition(Input input) + { + ///璁板綍绱㈠紩鍊� + int index = -1; + for (var i = 0; i < Logic.currlogic.input.Count; i++) + { + var condition_type = Logic.currlogic.input[i].condition_type; + if (condition_type == "10" || condition_type == "8") + { + //鏀寔鍦烘櫙=10锛屽湴鐞嗗洿鏍�=8 + ///鎵惧埌鏍囪绱㈠紩锛岄��鍑哄惊鐜綋 + index = i; + break; + } + } + if (index != -1) + { + //绉婚櫎鏃ф暟鎹� + Logic.currlogic.input.RemoveAt(index); + //鏂版暟鎹彃鍏ユ棫鏁版嵁鐨勪綅缃� + Logic.currlogic.input.Insert(index, input); + } + else + { + Logic.currlogic.input.Add(input); + } + } + } - } } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs index ba94b4d..839696d 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs @@ -29,15 +29,8 @@ }; this.AddChidren(viewLayout); #region 鍔熻兘 - //鍔熻兘 - LogicView.SelectTypeView functionView = new LogicView.SelectTypeView(); - functionView.btnText.TextID = StringId.funLogic; - functionView.btnIcon.UnSelectedImagePath = "LogicIcon/functionicon.png"; - viewLayout.AddChidren(functionView.FLayoutView()); - //鍦烘櫙 LogicView.SelectTypeView sceneView= new LogicView.SelectTypeView(); - sceneView.frameLayout.Y = functionView.frameLayout.Bottom; sceneView.btnText.TextID = StringId.Scenes; sceneView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png"; viewLayout.AddChidren(sceneView.FLayoutView()); @@ -55,18 +48,13 @@ delayView.btnText.TextID = StringId.delayLogic; delayView.btnIcon.UnSelectedImagePath = "LogicIcon/time.png"; //viewLayout.AddChidren(delayView.FLayoutView()); + + ////鍔熻兘 + ///浜у搧缁忕悊鍚涚剷瑕佹眰锛岃澶囧姛鑳界Щ鍒拌繖閲屻��<2022-3-7> + new FunTpye(LogicMethod.target_if).FunTypeView(viewLayout, securityView.frameLayout.Bottom, 2); #endregion #region 鎵�鏈夌偣鍑讳簨浠� - //鍔熻兘鐐瑰嚮浜嬩欢 - functionView.btnClick.MouseUpEventHandler += (sen, e) => - { - FunTpye funTpye = new FunTpye(); - MainPage.BasePageView.AddChidren(funTpye); - funTpye.Show(LogicMethod.target_if); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - - }; //鍦烘櫙鐐瑰嚮浜嬩欢 sceneView.btnClick.MouseUpEventHandler += (sen, e) => { diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs index addf896..2eeecfc 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs @@ -7,42 +7,45 @@ { public class FunTpye : FrameLayout { - public FunTpye() + public FunTpye(string str) { Tag = "Logic"; + if_type = str; } /// <summary> /// 榛樿閫変腑鏄埧闂存椂锛氬叏閮ㄥ尯鍩� /// </summary> - private Entity.Room selectedRoom = new Entity.Room { roomId ="6688" }; + public static Entity.Room selectedRoom = new Entity.Room { roomId ="6688" }; + + /// <summary> + /// 榛樿閫変腑鏄澶囩被鍨嬫椂锛氬叏閮ㄥ姛鑳� + /// </summary> + //public static Entity.Room selectedRoom = new Entity.Room { roomId = "6688" }; /// <summary> /// 琛ㄧず鏄�(鏉′欢/鐩爣) /// </summary> private string if_type; - public void Show(string str) - { - - if_type = str; - this.BackgroundColor = CSS.CSS_Color.viewMiddle; - LogicView.TopView topView = new LogicView.TopView(); - this.AddChidren(topView.FLayoutView()); - topView.clickBackBtn.MouseUpEventHandler += (e, sen) => - { - RemoveFromParent(); - }; - topView.topNameBtn.TextID = StringId.selectedFunCondition; + /// <summary> + /// 璁惧鍔熻兘ui + /// </summary> + /// <param name="viewLayout">鐖舵帶浠�</param> + /// <param name="bottm"></param> + /// <param name="funCount">鏀寔鍔熻兘绫诲瀷涓暟<琛ㄧず涓婇潰鎵�鍗犻珮搴�></param> + public void FunTypeView(FrameLayout viewLayout,int bottm,int funCount) { LogicView.FunAllAreaView funAllAreaView = new LogicView.FunAllAreaView(); - funAllAreaView.frameLayout.Y = topView.frameLayout.Bottom; - this.AddChidren(funAllAreaView.FLayoutView()); - + funAllAreaView.frameLayout.Y = bottm + Application.GetRealHeight(8); + viewLayout.AddChidren(funAllAreaView.FLayoutView()); VerticalScrolViewLayout vv = new VerticalScrolViewLayout { - Y = Application.GetRealHeight(117), - Height = Application.GetRealHeight(667 - 117), + Y = funAllAreaView.frameLayout.Bottom, + Height = Application.GetRealHeight(667 - 64 - 50 * funCount - 8), }; - this.AddChidren(vv); - + viewLayout.AddChidren(vv); + if (!MainView.IsGatewayType) + { + funAllAreaView.frameLayout.Y = Application.GetRealHeight(0); + } //鎴块棿鐐瑰嚮浜嬩欢 EventHandler<MouseEventArgs> roomClick = (sender, e) => { @@ -51,7 +54,7 @@ { BackgroundColor = CSS.CSS_Color.viewTrans60lucence, }; - this.AddChidren(fLayout); + viewLayout.AddChidren(fLayout); fLayout.MouseUpEventHandler += (sender1, e1) => { fLayout.RemoveFromParent(); @@ -60,7 +63,7 @@ FrameLayout bghFrameLyout = new FrameLayout { X = Application.GetRealWidth(10), - Y = Application.GetRealHeight(103), + Y = Application.GetRealHeight(103 + 50 * funCount + 8-64), Width = Application.GetRealWidth(160), Height = Application.GetRealHeight(21 + 44), //BackgroundImagePath = "LogicIcon/bjicon.png", @@ -82,7 +85,7 @@ Height = Application.GetRealHeight(44 * 5), }; var roomList = LogicMethod.CurrLogicMethod.GetGatewayRoomList(Language.StringByID(StringId.allAreas)); - + if (roomList.Count > 5) { bghFrameLyout.Height = Application.GetRealHeight(21 + 44 * 5); @@ -122,11 +125,12 @@ funAllAreaView.btnText2.Text = Language.StringByID(StringId.allFun); selectedRoom = (areaView.btnClick.Tag as Entity.Room); ///鑾峰彇鏄剧ず璁惧鍒楄〃 - var list = LogicMethod.CurrLogicMethod.GetFunctionDeviceList(areaView.btnClick.Tag as Entity.Room,if_type); + var list = LogicMethod.CurrLogicMethod.GetFunctionDeviceList(areaView.btnClick.Tag as Entity.Room, if_type); DeviceListView(vv, list); }; - if (roomList.Count-1==i) { + if (roomList.Count - 1 == i) + { ///鏀瑰彉鏈�鍚庨偅鏉′竴涓嚎鐨勯鑹�,鐣岄潰鏄剧ず鏁堟灉浣滅敤; areaView.btnLine.BackgroundColor = CSS.CSS_Color.view; } @@ -135,13 +139,15 @@ funAllAreaView.btnText1.MouseUpEventHandler += roomClick; funAllAreaView.btnIcon1.MouseUpEventHandler += roomClick; //鍔熻兘鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> funClick = (sender3, e3) =>{ + EventHandler<MouseEventArgs> funClick = (sender3, e3) => + { //鑾峰彇鏈�缁堟樉绀哄垪琛� var functionList = LogicMethod.CurrLogicMethod.GetFunctionDeviceList(selectedRoom, if_type); //鑾峰彇璁惧鍒楄〃鐨勭被鍨嬶紙渚嬪锛氱伅鍏夌被锛岀獥甯樼被銆傘�傘�傦級 var deviceTypeList = LogicMethod.CurrLogicMethod.GetDeviceTypeList(functionList); - if (deviceTypeList.Count==0) { + if (deviceTypeList.Count == 0) + { //娌℃湁绫诲瀷鐩存帴杩斿洖鍘�; return; } @@ -150,7 +156,7 @@ { BackgroundColor = CSS.CSS_Color.viewTrans60lucence, }; - this.AddChidren(fLayout); + viewLayout.AddChidren(fLayout); fLayout.MouseUpEventHandler += (sender1, e1) => { fLayout.RemoveFromParent(); @@ -159,7 +165,7 @@ FrameLayout bghFrameLyout = new FrameLayout { X = Application.GetRealWidth(118), - Y = Application.GetRealHeight(103), + Y = Application.GetRealHeight(103 + 50 * funCount + 8-64), Width = Application.GetRealWidth(160), Height = Application.GetRealHeight(21 + 44), //BackgroundImagePath = "LogicIcon/bjicon5.png", @@ -181,7 +187,7 @@ Height = Application.GetRealHeight(44 * 5), }; - + if (deviceTypeList.Count > 5) @@ -238,12 +244,14 @@ DeviceListView(vv, deviceList); } + + /// <summary> /// 鏄剧ず璁惧鐨刅iew /// </summary> /// <param name="verticalScrolView">涓婁笅婊戝姩</param> /// <param name="deviceList"></param> - public void DeviceListView(VerticalScrolViewLayout verticalScrolView, List<HDL_ON.Entity.Function> deviceList) + public void DeviceListView(VerticalScrolViewLayout verticalScrolView, List<HDL_ON.Entity.Function> deviceList) { verticalScrolView.RemoveAll(); foreach (var dev in deviceList) @@ -258,19 +266,22 @@ funView.btnIcon.UnSelectedImagePath = LogicMethod.CurrLogicMethod.GetIconPath(dev.spk); funView.btnDeviceName.Text = dev.name; funView.btnRoomName.Text = dev.GetRoomListName(); - funView.btnClick.MouseUpEventHandler += (sen,e) => { - if (if_type == LogicMethod.condition_if) { + funView.btnClick.MouseUpEventHandler += (sen, e) => { + if (if_type == LogicMethod.condition_if) + { ConditionDeviceFunList conditionDeviceFunList = new ConditionDeviceFunList(); MainPage.BasePageView.AddChidren(conditionDeviceFunList); conditionDeviceFunList.Show(dev, 0, false); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - } else { + } + else + { TargetDeviceFunList targetDeviceFunList = new TargetDeviceFunList(); MainPage.BasePageView.AddChidren(targetDeviceFunList); targetDeviceFunList.Show(dev, 0, false); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } - + }; } } -- Gitblit v1.8.0