From cd8cdf7eb281af3b7a5f2b61bd21f1aa0adf7524 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期一, 17 十月 2022 11:51:29 +0800 Subject: [PATCH] 2022年10月17日11:51:16 --- HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs | 180 +++++++++++++++++++++++++++-- HDL_ON/UI/UI2/3-Intelligence/Automation/ChooseIocate.cs | 114 +++++++++++++++++++ HDL-ON_Android/SplashActivity.cs | 1 HDL_ON/DAL/Server/HttpUtil.cs | 4 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs | 2 HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs | 3 HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs | 1 HDL_ON/DAL/Server/HttpServerRequest.cs | 3 HDL_ON/Entity/ResponseEntity/CityInfo.cs | 9 + HDL_ON/HDL_ON.projitems | 1 HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs | 3 11 files changed, 303 insertions(+), 18 deletions(-) diff --git a/HDL-ON_Android/SplashActivity.cs b/HDL-ON_Android/SplashActivity.cs index 1a8e648..fcddc59 100644 --- a/HDL-ON_Android/SplashActivity.cs +++ b/HDL-ON_Android/SplashActivity.cs @@ -229,6 +229,7 @@ { try { + if (isfirst) { //鍙Е鍙戜竴娆� diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs index 1bf4aaf..d8ad0ee 100644 --- a/HDL_ON/DAL/Server/HttpServerRequest.cs +++ b/HDL_ON/DAL/Server/HttpServerRequest.cs @@ -1373,6 +1373,9 @@ /// </summary> public void GetCityWeatherInfo(string lon, string lat) { + MainPage.cityInfo.lon = lon; + MainPage.cityInfo.lat = lat; + System.Threading.Tasks.Task.Run(() => { while (true) diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs index 1c3250c..4a01eef 100644 --- a/HDL_ON/DAL/Server/HttpUtil.cs +++ b/HDL_ON/DAL/Server/HttpUtil.cs @@ -18,8 +18,8 @@ /// 鍏叡鍩熷悕灏辫繎瑙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/Entity/ResponseEntity/CityInfo.cs b/HDL_ON/Entity/ResponseEntity/CityInfo.cs index d5abdca..1db681a 100644 --- a/HDL_ON/Entity/ResponseEntity/CityInfo.cs +++ b/HDL_ON/Entity/ResponseEntity/CityInfo.cs @@ -7,6 +7,15 @@ { } /// <summary> + /// 鎵嬫満GPS缁忓害 + /// </summary> + public string lon="0"; + /// <summary> + /// 鎵嬫満GPS绾害 + /// </summary> + public string lat="0"; + + /// <summary> /// 鍩庡競id /// </summary> public string cid = string.Empty; diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems index ef69777..12659be 100644 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -515,6 +515,7 @@ <Compile Include="$(MSBuildThisFileDirectory)DAL\DriverLayer\Control_Tcp.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Entity\Function\InverterInfo.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\H5Page.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\ChooseIocate.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" /> diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs index 5de45b6..3545a8c 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs @@ -1,6 +1,7 @@ 锘縰sing System; using System.Collections.Generic; using Shared; + namespace HDL_ON.UI.UI2.Intelligence.Automation { public class AddInputType : FrameLayout @@ -64,14 +65,14 @@ likiadaodaView.btnIcon.UnSelectedImagePath = "LogicIcon/location.png"; int count = 3;//杈撳叆绫诲瀷涓暟 //2022骞�05鏈�24鏃�15:08:22 闅愯棌鎺夊湴鐞嗗洿鏍� - //if (MainView.IsGatewayType) - //{ - // count = 4; - // viewLayout.AddChidren(likiadaodaView.FLayoutView()); - //} + if (MainView.IsGatewayType) + { + count = 4; + viewLayout.AddChidren(likiadaodaView.FLayoutView()); + } ////鍔熻兘 ///浜у搧缁忕悊鍚涚剷瑕佹眰锛岃澶囧姛鑳界Щ鍒拌繖閲屻��<2022-3-7> - new FunTpye(LogicMethod.condition_if).FunTypeView(viewLayout, shiwaiView.frameLayout.Bottom, count); + new FunTpye(LogicMethod.condition_if).FunTypeView(viewLayout, likiadaodaView.frameLayout.Bottom, count); #endregion @@ -80,13 +81,13 @@ timeView.btnClick.MouseUpEventHandler += (sen, e) => { - TimeTpye timeTpye = new TimeTpye(); - MainPage.BasePageView.AddChidren(timeTpye); - timeTpye.Show(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + TimeTpye timeTpye = new TimeTpye(); + MainPage.BasePageView.AddChidren(timeTpye); + timeTpye.Show(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; - + //鍦烘櫙鐐瑰嚮浜嬩欢 sceneView.btnClick.MouseUpEventHandler += (sen, e) => { @@ -113,6 +114,7 @@ #endregion } + /// <summary> /// 娣诲姞鍦烘櫙 /// </summary> @@ -153,11 +155,14 @@ /// <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.Current.WGS84_to_GCJ02(Entity.DB_ResidenceData.Instance.CurrentRegion.longitude, Entity.DB_ResidenceData.Instance.CurrentRegion.latitude, out longitude, out latitude); + //double latitude = Entity.DB_ResidenceData.Instance.CurrentRegion.latitude;//绾害 + //double longitude = Entity.DB_ResidenceData.Instance.CurrentRegion.longitude;//缁忓害 + /////濡傛灉鏄敤褰撳墠鎵嬫満浣嶇疆浣滀负涓績鐨勮瘽锛涘啀娆$紪杈憉i鐣岄潰鏄剧ず鏄綋鍓嶆墜鏈轰綅缃紝杩樻槸涔嬪墠鐨勭粡绾憿锛� + double latitude = Convert.ToDouble(MainPage.cityInfo.lat);//绾害 + double longitude = Convert.ToDouble(MainPage.cityInfo.lon);//缁忓害 int r = 500;//榛樿鍗婂緞 if (edit) { @@ -253,6 +258,151 @@ //鎸夐亾鐞嗚涓嶄細鍑虹幇 r = 500; } + ChooseIocate chooseIocate = new ChooseIocate(); + MainPage.BasePageView.AddChidren(chooseIocate); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + chooseIocate.Show(latitude, longitude, r, (value) => + { + if (value.Contains("km")) + { + value = value.Replace("km", ""); + } + else { + value = value.Replace("m", ""); + } + Input input = new Input(); + input.sid = LogicMethod.Current.NewSid(); + input.condition_type = "8"; + Dictionary<string, string> dic = new Dictionary<string, string>(); + LogicMethod.Current.dictionary(dic, "key", "direction"); + LogicMethod.Current.dictionary(dic, "comparator", "="); + LogicMethod.Current.dictionary(dic, "data_type", "string"); + LogicMethod.Current.dictionary(dic, "value", valueStr); + input.condition.Add(dic); + //绾害 + input.geo_fence.latitude = latitude.ToString(); + //缁忓害 + input.geo_fence.longitude = longitude.ToString(); + //鍗婂緞<鍗曚綅绫�> + input.geo_fence.radius = value; + AddCondition(input); + LogicMethod.Current.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 LocationView1(FrameLayout flMain, bool edit) + { + string strname = ""; + ///閫氳繃璋冭瘯瀹濈粰鐨勭粡绾害<鏍囧噯GPS> + double latitude = Entity.DB_ResidenceData.Instance.CurrentRegion.latitude;//绾害 + double longitude = Entity.DB_ResidenceData.Instance.CurrentRegion.longitude;//缁忓害 + LogicMethod.Current.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; } + + //鐢宠鍏佽绋嬪簭鍐欏叆澶栭儴瀛樺偍锛屽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"); + }); +#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 Location1(string valueStr, string strname, double latitude, double longitude, int r) + { + if (r == 0) + { + //鎸夐亾鐞嗚涓嶄細鍑虹幇 + r = 500; + } //璋冪敤鏂规硶锛岃烦杞〉闈� GDMapKit.Show((mLatitude, mLongitude, mRadius, name) => { @@ -314,6 +464,6 @@ Logic.currlogic.input.Add(input); } } - + } } diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs index 5b00d80..28be7fe 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs @@ -14,6 +14,9 @@ public void Show() { + + + #region 鐣岄潰甯冨眬 this.BackgroundColor = CSS.CSS_Color.viewMiddle; LogicView.TopView topView = new LogicView.TopView(); diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ChooseIocate.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ChooseIocate.cs new file mode 100644 index 0000000..a37e8e9 --- /dev/null +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ChooseIocate.cs @@ -0,0 +1,114 @@ +锘縰sing System; +using System.Collections.Generic; +using Shared; +namespace HDL_ON.UI.UI2.Intelligence.Automation +{ + public class ChooseIocate : FrameLayout + { + public ChooseIocate() + { + Tag = "Logic"; + } + /// <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> + public void Show(double latitude, double longitude, int r, Action<string> action) + { + LogicView.TopView topView = new LogicView.TopView(); + this.AddChidren(topView.FLayoutView()); + topView.clickBackBtn.MouseUpEventHandler += (e, sen) => + { + RemoveFromParent(); + }; + topView.topNameBtn.Text = "閫夋嫨瀹氫綅浣嶇疆"; + + 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); + + //褰撳墠鐨勭粡绾害 + LogicView.SelectTypeView lonlatView = new LogicView.SelectTypeView(); + lonlatView.btnIcon.Visible = false; + lonlatView.btnNextIcon.Visible = false; + lonlatView.btnText.X = Application.GetRealWidth(16); + lonlatView.btnLine.X = Application.GetRealWidth(16); + lonlatView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16); + lonlatView.btnText.Text = "褰撳墠鐨勭粡绾害"; + lonlatView.btnState.Visible = true; + lonlatView.btnState.IsMoreLines = true; + lonlatView.btnState.Height = Application.GetRealHeight(25); + lonlatView.btnState.Text =latitude.ToString() +"\r\n"+ longitude.ToString(); + viewLayout.AddChidren(lonlatView.FLayoutView()); + + + //鍦ㄨ浣嶇疆鑼冨洿鏃� + LogicView.SelectTypeView locateView = new LogicView.SelectTypeView(); + locateView.frameLayout.Y = lonlatView.frameLayout.Bottom; + locateView.btnIcon.Visible = false; + lonlatView.btnNextIcon.Visible = false; + locateView.btnText.X = Application.GetRealWidth(16); + locateView.btnLine.X = Application.GetRealWidth(16); + locateView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16); + locateView.btnText.Text = "鍦ㄨ浣嶇疆鑼冨洿鏃�"; + locateView.btnState.Visible = true; + locateView.btnState.Text = this.queryItem(r.ToString()); + viewLayout.AddChidren(locateView.FLayoutView()); + + ///淇濆瓨View + LogicView.SaveView saveView = new LogicView.SaveView(); + saveView.frameLayout.Y = locateView.frameLayout.Bottom + Application.GetRealHeight(100); + saveView.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); + viewLayout.AddChidren(saveView.FLayoutView()); + locateView.btnClick.MouseUpEventHandler += (sen, e) => + { + + PublicInterface weekView = new PublicInterface(); + weekView.SingleSelectionShow(this, this.getList(), Language.StringByID(StringId.cyclic), locateView.btnState.Text + , (value) => + { + //鏄剧ず閫変腑鏁版嵁 + locateView.btnState.Text = value; + + }); + + }; + saveView.btnClick.MouseUpEventHandler += (sender, e) => + { + action(locateView.btnState.Text); + }; + } + + private string queryItem(string value) + { + + var item = this.getList().Find((o) => o.Contains(value)); + if (item == null) + { + return ""; + } + return item; + } + private List<string> getList() + { + return new List<string> { + "100m", + "200m", + "500m", + "1000m", + "2000m", + "5000m", + }; + + } + } +} diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs index ab8885b..e17db27 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs @@ -1044,7 +1044,7 @@ //瀹氫箟涓�涓眬閮ㄥ彉閲� string direction = string.Empty; //涓ょ偣璺濈灏忎簬閰嶇疆璺濈<鏃㈣嚜鍔ㄥ寲閰嶇疆杈撳叆鏉′欢鍦扮悊鍥存爮鍗婂緞>,璇存槑杩涘叆鍖哄煙 - if (r < radius) + if (r*1000< radius) { //鍒拌揪鏌愬湴 direction = "arrive"; diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs index 5a95e83..33ced02 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs @@ -197,6 +197,7 @@ logicIfon.Add("pushConfigs", pushConfigsArray); logicjArray.Add(logicIfon); var jObject = new JObject { { "homeId", LogicMethod.Current.HomeId }, { "logics", logicjArray } }; + string str = jObject.ToString(); responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Add, "娣诲姞鑷姩鍖�", 5); //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs index b861d56..0a5c9a5 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs @@ -79,6 +79,7 @@ public void Show() { + #region 鐣岄潰甯冨眬 this.BackgroundColor = MusicColor.ViewColor; var topView = new TopView(); @@ -429,6 +430,8 @@ catch { } }); } + + } } -- Gitblit v1.8.0