Merge branch 'WJC' into newBranch1
| | |
| | | 7149=Manually |
| | | 7150=Smart |
| | | 7151=Good |
| | | 7152=Leave or arrive at a place |
| | | 7153=Leave |
| | | 7154=Arrive |
| | | |
| | | |
| | | |
| | |
| | | 7149=手动 |
| | | 7150=智能 |
| | | 7151=良好 |
| | | 7152=离开或到达某地 |
| | | 7153=离开 |
| | | 7154=到达 |
| | | |
| | | |
| | | |
| | | |
| | |
| | | <meta-data android:name="OPPO_APPID" android:value="OP-30619979" /> |
| | | <meta-data android:name="OPPO_APPSECRET" android:value="OP-11d511c42f654cafac99588322681003" /> |
| | | <!-- 极光推送结束 --> |
| | | <!-- 设置高德地图key --> |
| | | <meta-data android:name="com.amap.api.v2.apikey" android:value="9901dd06e30b229efdd4c5bf5e076224" /> |
| | | </application> |
| | | </manifest> |
| | |
| | | using System;
|
| | | using System; |
| | | using Foundation; |
| | | using HDL_ON; |
| | | using Shared; |
| | |
| | | |
| | | #endregion |
| | | |
| | | //高德key |
| | | GDMapKit.setGDApiKey("f0635ea15c5d579c6e93d9f07a06da69"); |
| | | Console.WriteLine("FinishedLaunching"); |
| | | return true; |
| | | } |
| | |
| | | 7149=Manually |
| | | 7150=Smart |
| | | 7151=Good |
| | | 7152=Leave or arrive at a place |
| | | 7153=Leave |
| | | 7154=Arrive |
| | | |
| | | |
| | | |
| | |
| | | 7149=手动 |
| | | 7150=智能 |
| | | 7151=良好 |
| | | 7152=离开或到达某地 |
| | | 7153=离开 |
| | | 7154=到达 |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | /// 良好 |
| | | /// </summary> |
| | | public const int lianghao = 7151; |
| | | /// <summary> |
| | | /// 离开或到达某地 |
| | | /// </summary> |
| | | public const int likiadaoda = 7152; |
| | | /// <summary> |
| | | /// 离开 |
| | | /// </summary> |
| | | public const int likai = 7153; |
| | | /// <summary> |
| | | /// 到达 |
| | | /// </summary> |
| | | public const int daoda = 7154; |
| | | |
| | | |
| | | |
| | |
| | | /// 启用禁用自动化 |
| | | /// </summary> |
| | | public const string API_POST_Logic_Enable = "/home-wisdom/app/logic/enable"; |
| | | /// <summary> |
| | | /// 自动化地理围栏状态上报 |
| | | /// </summary> |
| | | public const string API_POST_Logic_GeoFenceStateReport = "/home-wisdom/app/logic/geoFenceStateReport"; |
| | | #endregion |
| | | |
| | | #region -- 第三方设备相关接口___________________________ |
| | |
| | | <Compile Include="$(MSBuildThisFileDirectory)DAL\ThirdPartySdk\HDLLinphone.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\EnvironmentalScience\A_EnvironmentalDataCenter.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\2-Classification\SceneControlZone.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\CalculatedDistance.cs" />
|
| | | </ItemGroup>
|
| | | <ItemGroup>
|
| | | <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" />
|
| | |
| | | { |
| | | public static class MainPage |
| | | { |
| | | |
| | | /// <summary> |
| | | /// BaseView |
| | | /// </summary> |
| | |
| | | |
| | | BaseView = Application.MainPage; |
| | | Application.MainPage.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | |
| | | ///监听经纬度 |
| | | HDL_ON.UI.UI2.Intelligence.Automation.LogicMethod.CurrLogicMethod.AppLatAndLonEvent(); |
| | | |
| | | //#region 测试 |
| | | //var ddd = new UI.test.TestDialog(); |
| | |
| | | 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) => { |
| | | timeView.btnClick.MouseUpEventHandler += (sen, e) => |
| | | { |
| | | TimeTpye timeTpye = new TimeTpye(); |
| | | MainPage.BasePageView.AddChidren(timeTpye); |
| | | timeTpye.Show(); |
| | |
| | | |
| | | }; |
| | | //功能 |
| | | functionView.btnClick.MouseUpEventHandler += (sen, e) => { |
| | | functionView.btnClick.MouseUpEventHandler += (sen, e) => |
| | | { |
| | | FunTpye funTpye = new FunTpye(); |
| | | MainPage.BasePageView.AddChidren(funTpye); |
| | | funTpye.Show(LogicMethod.condition_if); |
| | |
| | | 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; |
| | | } |
| | | 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> |
| | | /// 地理围栏View |
| | | /// </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;//经度 |
| | | //WGS84坐标转高德坐标 |
| | | 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); |
| | | } |
| | | //纬度 |
| | | latitude = Convert.ToDouble(input.geo_fence.latitude); |
| | | //经度 |
| | | longitude = Convert.ToDouble(input.geo_fence.longitude); |
| | | //半径 |
| | | r = int.Parse(input.geo_fence.radius); |
| | | } |
| | | } |
| | | 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; } |
| | | |
| | | //调用方法,跳转页面 |
| | | GDMapKit.Show((mLatitude, mLongitude, mRadius, name) => |
| | | { |
| | | //高德坐标转WGS84坐标(高德地图设置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); |
| | | |
| | | }, "android.permission.READ_PHONE_STATE"); |
| | | |
| | | }, "android.permission.WRITE_EXTERNAL_STORAGE"); |
| | | }); |
| | | #endif |
| | | #if __IOS__ |
| | | //调用方法,跳转页面 |
| | | GDMapKit.Show((mLatitude, mLongitude, mRadius, name) => |
| | | { |
| | | //高德坐标转WGS84坐标(高德地图设置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", "arrive"); |
| | | 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); |
| | | #endif |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加条件 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | |
| | | for (var i = 0; i < Logic.currlogic.input.Count; i++) |
| | | { |
| | | var condition_type = Logic.currlogic.input[i].condition_type; |
| | | if (condition_type == "10") |
| | | if (condition_type == "10" || condition_type == "8") |
| | | { |
| | | //支持场景=10,地理围栏=8 |
| | | ///找到标记索引,退出循环体 |
| | | index = i; |
| | | break; |
| | |
| | | if (text == Language.StringByID(StringId.kongqiyou)) |
| | | { |
| | | //优 |
| | | value = "excellent"; |
| | | value = "Excellent"; |
| | | } |
| | | else if (text == Language.StringByID(StringId.kongqiliang)) |
| | | { |
| | | //良 |
| | | value = "good"; |
| | | value = "Good"; |
| | | } |
| | | else if (text == Language.StringByID(StringId.kongqicha)) |
| | | { |
| | | //差 |
| | | value = "poor"; |
| | | value = "Poor"; |
| | | } |
| | | AddDic(value); |
| | | }; |
| | |
| | | { |
| | | Input input = new Input(); |
| | | input.sid = LogicMethod.CurrLogicMethod.NewSid(); |
| | | input.condition_type = "9"; |
| | | input.condition_type = "6"; |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "key", "air_quality"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "key", "airquality"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "="); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "value", value); |
| | | input.condition.Add(dic); |
| | | AddCondition(input); |
| | | AddCondition(input, "airquality" ,"="); |
| | | } |
| | | /// <summary> |
| | | /// 添加条件 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | private void AddCondition(Input input) |
| | | private void AddCondition(Input input, string keyValue, string comparator) |
| | | { |
| | | ///记录索引值 |
| | | 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 == "9") |
| | | if (condition_type == "6") |
| | | { |
| | | ///找到标记索引,退出循环体 |
| | | index = i; |
| | | break; |
| | | var dicList = Logic.currlogic.input[i].condition; |
| | | if (ExistKey(dicList, keyValue, comparator)) |
| | | { |
| | | ///找到标记索引,退出循环体 |
| | | index = i; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if (index != -1) |
| | |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 判断是否存在Key |
| | | /// </summary> |
| | | /// <param name="dicList"></param> |
| | | /// <param name="keyValue"></param> |
| | | /// <param name="comparator">比较关系</param> |
| | | /// <returns></returns> |
| | | private bool ExistKey(List<Dictionary<string, string>> dicList, string keyValue, string comparator) |
| | | { |
| | | for (int i = 0; i < dicList.Count; i++) |
| | | { |
| | | var dic = dicList[i]; |
| | | string key = dic["key"]; |
| | | string comparatorValue = dic["comparator"]; |
| | | if (key == keyValue && comparatorValue == comparator) |
| | | { |
| | | //判断是否存在 |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Linq;
|
| | | using System.Text;
|
| | | using System.Threading.Tasks;
|
| | |
|
| | | namespace Infrastructure.Service.Helper
|
| | | {
|
| | | public class CalculatedDistance
|
| | | {
|
| | | private static double HaverSin(double theta)
|
| | | {
|
| | | var v = Math.Sin(theta / 2);
|
| | | return v * v;
|
| | | }
|
| | |
|
| | | static double EARTH_RADIUS = 6371.0;//km 地球半径 平均值,千米
|
| | |
|
| | | /// <summary>
|
| | | /// 给定的经度1,纬度1;经度2,纬度2. 计算2个经纬度之间的距离。
|
| | | /// </summary>
|
| | | /// <param name="lat1">经度1</param>
|
| | | /// <param name="lon1">纬度1</param>
|
| | | /// <param name="lat2">经度2</param>
|
| | | /// <param name="lon2">纬度2</param>
|
| | | /// <returns>距离(公里、千米)</returns>
|
| | | public static int Distance(double lat1, double lon1, double lat2, double lon2)
|
| | | {
|
| | | //用haversine公式计算球面两点间的距离。
|
| | | //经纬度转换成弧度
|
| | | lat1 = ConvertDegreesToRadians(lat1);
|
| | | lon1 = ConvertDegreesToRadians(lon1);
|
| | | lat2 = ConvertDegreesToRadians(lat2);
|
| | | lon2 = ConvertDegreesToRadians(lon2);
|
| | |
|
| | | //差值
|
| | | var vLon = Math.Abs(lon1 - lon2);
|
| | | var vLat = Math.Abs(lat1 - lat2);
|
| | |
|
| | | //h is the great circle distance in radians, great circle就是一个球体上的切面,它的圆心即是球心的一个周长最大的圆。
|
| | | var h = HaverSin(vLat) + Math.Cos(lat1) * Math.Cos(lat2) * HaverSin(vLon);
|
| | |
|
| | | var distance = (int)((2 * EARTH_RADIUS * Math.Asin(Math.Sqrt(h))) * 1000);
|
| | |
|
| | | return distance;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 将角度换算为弧度。
|
| | | /// </summary>
|
| | | /// <param name="degrees">角度</param>
|
| | | /// <returns>弧度</returns>
|
| | | private static double ConvertDegreesToRadians(double degrees)
|
| | | {
|
| | | return degrees * Math.PI / 180;
|
| | | }
|
| | |
|
| | | private static double ConvertRadiansToDegrees(double radian)
|
| | | {
|
| | | return radian * 180.0 / Math.PI;
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | case SPK.CurtainRoller: |
| | | case SPK.CurtainTrietex: |
| | | //空调 |
| | | case SPK.AcStandard:case SPK.HvacAC: |
| | | case SPK.AcStandard: |
| | | case SPK.HvacAC: |
| | | //地热 |
| | | case SPK.HvacFloorHeat:case SPK.FloorHeatStandard: |
| | | case SPK.HvacFloorHeat: |
| | | case SPK.FloorHeatStandard: |
| | | //新风 |
| | | case SPK.AirFreshStandard: |
| | | case SPK.HvacAirFresh: |
| | |
| | | break; |
| | | case SPK.SensorTemperature: |
| | | { |
| | | |
| | | string str =new InpOrOutLogicMethod { }.GetText(dicList, "temperature"); |
| | | |
| | | string str = new InpOrOutLogicMethod { }.GetText(dicList, "temperature"); |
| | | inputView.btnState.Text = str; |
| | | } |
| | | break; |
| | |
| | | } |
| | | } |
| | | break; |
| | | case "4": |
| | | case "6": |
| | | { |
| | | //inputView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png"; |
| | | inputView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png"; |
| | | string strtext = ""; |
| | | string strvalue = ""; |
| | |
| | | |
| | | switch (key) |
| | | { |
| | | case "outdoor_temp": |
| | | case "temperature": |
| | | { |
| | | //云端天气条件 城市温度触发 |
| | | strvalue = value + "℃"; |
| | | if (comparator == ">") |
| | | { |
| | |
| | | |
| | | } |
| | | break; |
| | | case "outdoor_humity": |
| | | case "humidity": |
| | | { |
| | | //云端天气条件 城市湿度触发 |
| | | strvalue = value + "%"; |
| | | if (comparator == ">") |
| | | { |
| | |
| | | |
| | | } |
| | | break; |
| | | case "pm2.5": |
| | | case "pm25": |
| | | { |
| | | //云端天气条件 城市pm2.5触发 |
| | | strtext = Language.StringByID(StringId.PM25); |
| | | strvalue = new PublicInterface { }.GetString("pm25", value); |
| | | } |
| | | break; |
| | | case "weather": |
| | | { |
| | | //云端天气条件 城市天气触发 |
| | | strtext = Language.StringByID(StringId.tianqibianhua); |
| | | switch (value) |
| | | { |
| | | case "Sunny": |
| | | { |
| | | strtext = Language.StringByID(StringId.clearday); |
| | | |
| | | } |
| | | break; |
| | | case "Cloudy": |
| | | { |
| | | |
| | | strtext = Language.StringByID(StringId.cloudy); |
| | | |
| | | } |
| | | break; |
| | | case "Rain": |
| | | { |
| | | strtext = Language.StringByID(StringId.rain); |
| | | } |
| | | break; |
| | | |
| | | } |
| | | } |
| | | break; |
| | | case "airquality": |
| | | { |
| | | //云端天气条件 城市空气质量 |
| | | strtext = Language.StringByID(StringId.kongqizhiliang); |
| | | switch (value) |
| | | { |
| | | case "Excellent": |
| | | { |
| | | strtext = Language.StringByID(StringId.kongqiyou); |
| | | |
| | | } |
| | | break; |
| | | case "Good": |
| | | { |
| | | |
| | | strtext = Language.StringByID(StringId.kongqiliang); |
| | | |
| | | } |
| | | break; |
| | | case "Poor": |
| | | { |
| | | strtext = Language.StringByID(StringId.kongqicha); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | |
| | | |
| | |
| | | inputView.btnState.Text = strvalue; |
| | | } |
| | | break; |
| | | case "6": |
| | | case "8": |
| | | { |
| | | inputView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png"; |
| | | inputView.btnIcon.UnSelectedImagePath = "LogicIcon/location.png"; |
| | | foreach (var dic in dicList) |
| | | { |
| | | string strtext = ""; |
| | | string value = dic["value"]; |
| | | switch (value) |
| | | { |
| | | case "sunny": |
| | | case "arrive": |
| | | { |
| | | strtext = Language.StringByID(StringId.clearday); |
| | | |
| | | strtext = Language.StringByID(StringId.daoda); |
| | | } |
| | | break; |
| | | case "cloudy": |
| | | case "leave": |
| | | { |
| | | |
| | | strtext = Language.StringByID(StringId.cloudy); |
| | | |
| | | strtext = Language.StringByID(StringId.likai); |
| | | } |
| | | break; |
| | | case "rainy": |
| | | { |
| | | strtext = Language.StringByID(StringId.rain); |
| | | } |
| | | break; |
| | | |
| | | } |
| | | inputView.btnText.TextID = StringId.tianqibianhua; |
| | | inputView.btnState.Text = strtext; |
| | | } |
| | | } |
| | | break; |
| | | case "9": |
| | | { |
| | | inputView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png"; |
| | | foreach (var dic in dicList) |
| | | { |
| | | string strtext = ""; |
| | | string value = dic["value"]; |
| | | switch (value) |
| | | { |
| | | case "excellent": |
| | | { |
| | | strtext = Language.StringByID(StringId.kongqiyou); |
| | | |
| | | } |
| | | break; |
| | | case "good": |
| | | { |
| | | |
| | | strtext = Language.StringByID(StringId.kongqiliang); |
| | | |
| | | } |
| | | break; |
| | | case "poor": |
| | | { |
| | | strtext = Language.StringByID(StringId.kongqicha); |
| | | } |
| | | break; |
| | | |
| | | } |
| | | inputView.btnText.TextID = StringId.kongqizhiliang; |
| | | inputView.btnText.TextID = StringId.likiadaoda; |
| | | inputView.btnState.Text = strtext; |
| | | } |
| | | } |
| | |
| | | else if (device.spk == SPK.SensorTemperature) |
| | | { |
| | | |
| | | new InpOrOutLogicMethod().SensorView(thisView, device, "temperature", indexVulae); |
| | | new InpOrOutLogicMethod().SensorView(thisView, device, "temperature", indexVulae); |
| | | |
| | | } |
| | | else if ( device.spk == SPK.SensorHumidity) |
| | | else if (device.spk == SPK.SensorHumidity) |
| | | { |
| | | |
| | | new InpOrOutLogicMethod().SensorView(thisView, device, "humidity", indexVulae); |
| | |
| | | } |
| | | } |
| | | break; |
| | | case "4": |
| | | case "6": |
| | | { |
| | | ///当前的索引值数据对象 |
| | | Input inputedit = Logic.currlogic.input[indexVulae]; |
| | |
| | | stateValue = dic["value"]; |
| | | switch (key) |
| | | { |
| | | case "outdoor_temp": |
| | | case "temperature": |
| | | { |
| | | if (comparator == ">") |
| | | { |
| | |
| | | |
| | | } |
| | | break; |
| | | case "outdoor_humity": |
| | | case "humidity": |
| | | { |
| | | |
| | | if (comparator == ">") |
| | |
| | | |
| | | } |
| | | break; |
| | | case "pm2.5": |
| | | case "pm25": |
| | | { |
| | | intValue = StringId.PM25; |
| | | } |
| | | break; |
| | | case "weather": |
| | | { |
| | | intValue = StringId.tianqibianhua; |
| | | } |
| | | break; |
| | | case "airquality": |
| | | { |
| | | intValue = StringId.kongqizhiliang; |
| | | } |
| | | break; |
| | | |
| | | } |
| | | } |
| | | OutdoorEnvironment outdoorEnvironment = new OutdoorEnvironment(); |
| | | if (intValue == StringId.PM25) |
| | | if (intValue == StringId.tianqibianhua) |
| | | { |
| | | //城市天气(晴天,下雨) |
| | | WeatherCondition weatherCondition = new WeatherCondition(); |
| | | MainPage.BasePageView.AddChidren(weatherCondition); |
| | | weatherCondition.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | else if (intValue == StringId.PM25) |
| | | { |
| | | //城市天气(pm2.5) |
| | | outdoorEnvironment.PmAction(thisView, stateValue); |
| | | } |
| | | else if (intValue == StringId.kongqizhiliang) |
| | | { |
| | | //城市天气(空气质量) |
| | | AirQuality airQuality = new AirQuality(); |
| | | MainPage.BasePageView.AddChidren(airQuality); |
| | | airQuality.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | else |
| | | { |
| | | //城市天气(温湿度) |
| | | outdoorEnvironment.InputBoxAction(intValue, stateValue); |
| | | } |
| | | |
| | | } |
| | | break; |
| | | case "6": |
| | | case "8": |
| | | { |
| | | |
| | | WeatherCondition weatherCondition = new WeatherCondition(); |
| | | MainPage.BasePageView.AddChidren(weatherCondition); |
| | | weatherCondition.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | break; |
| | | case "9": |
| | | { |
| | | |
| | | AirQuality airQuality = new AirQuality(); |
| | | MainPage.BasePageView.AddChidren(airQuality); |
| | | airQuality.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | AddInputType addInputType = new AddInputType(); |
| | | addInputType.LocationView(thisView, true); |
| | | } |
| | | break; |
| | | |
| | |
| | | /// 时间点条件=1; |
| | | /// 时间段条件=2; |
| | | /// 设备状态变化条件=3; |
| | | /// 环境信息条件=4; |
| | | /// 环境信息条件=4(废弃); |
| | | /// 安防条件=5; |
| | | /// 云端天气条件=6; |
| | | /// 某个逻辑/场景的输出条件=7; |
| | | /// 地理围栏=8; |
| | | /// 空气质量=9; |
| | | /// 空气质量=9(废弃); |
| | | /// 场景=10; |
| | | /// </summary> |
| | | public string condition_type = ""; |
| | |
| | | /// </summary> |
| | | public string latitude = string.Empty; |
| | | /// <summary> |
| | | /// 单位米 |
| | | /// 半径<单位米> |
| | | /// </summary> |
| | | public string radius = string.Empty; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | #region 高德坐标转WGS84坐标 |
| | | /// <summary> |
| | | /// 高德坐标转WGS84坐标 |
| | | /// </summary> |
| | | /// <param name="in_lng"></param> |
| | | /// <param name="in_lat"></param> |
| | | /// <param name="out_lng"></param> |
| | | /// <param name="out_lat"></param> |
| | | public void GCJ02_to_WGS84(double in_lng, double in_lat, out double out_lng, out double out_lat) |
| | | { |
| | | if (OutOfChina(in_lat, in_lng)) |
| | | { |
| | | out_lng = in_lng; |
| | | out_lat = in_lat; |
| | | return; |
| | | } |
| | | |
| | | CalculateDev(in_lng, in_lat, out out_lng, out out_lat); |
| | | out_lng = in_lng - out_lng; |
| | | out_lat = in_lat - out_lat; |
| | | } |
| | | #endregion |
| | | |
| | | #region WGS84坐标转高德坐标 |
| | | /// <summary> |
| | | /// WGS84坐标转高德坐标 |
| | | /// </summary> |
| | | /// <param name="in_lng">经度</param> |
| | | /// <param name="in_lat">纬度</param> |
| | | /// <param name="out_lng"></param> |
| | | /// <param name="out_lat"></param> |
| | | public void WGS84_to_GCJ02(double in_lng, double in_lat, out double out_lng, out double out_lat) |
| | | { |
| | | if (OutOfChina(in_lat, in_lng)) |
| | | { |
| | | out_lng = in_lng; |
| | | out_lat = in_lat; |
| | | return; |
| | | } |
| | | |
| | | CalculateDev(in_lng, in_lat, out out_lng, out out_lat); |
| | | out_lng = in_lng + out_lng; |
| | | out_lat = in_lat + out_lat; |
| | | } |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 坐标是否在中国境内 |
| | | /// </summary> |
| | | /// <param name="lat"></param> |
| | | /// <param name="lng"></param> |
| | | /// <returns></returns> |
| | | public bool OutOfChina(double lat, double lng) |
| | | { |
| | | if (lng < 72.004 || lng > 137.8347) |
| | | return true; |
| | | if (lat < 0.8293 || lat > 55.8271) |
| | | return true; |
| | | return false; |
| | | } |
| | | /// <summary> |
| | | /// 计算偏差 |
| | | /// </summary> |
| | | /// <param name="in_lng"></param> |
| | | /// <param name="in_lat"></param> |
| | | /// <param name="dLng"></param> |
| | | /// <param name="dLat"></param> |
| | | private void CalculateDev(double in_lng, double in_lat, out double dLng, out double dLat) |
| | | { |
| | | dLat = TransformLat(in_lng - 105.0, in_lat - 35.0); |
| | | dLng = TransformLng(in_lng - 105.0, in_lat - 35.0); |
| | | |
| | | double radLat = in_lat / 180.0 * pi; |
| | | double magic = Math.Sin(radLat); |
| | | magic = 1 - ee * magic * magic; |
| | | double sqrtMagic = Math.Sqrt(magic); |
| | | dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi); |
| | | dLng = (dLng * 180.0) / (a / sqrtMagic * Math.Cos(radLat) * pi); |
| | | } |
| | | |
| | | private double TransformLat(double x, double y) |
| | | { |
| | | double ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.Sqrt(Math.Abs(x)); |
| | | ret += (20.0 * Math.Sin(6.0 * x * pi) + 20.0 * Math.Sin(2.0 * x * pi)) * 2.0 / 3.0; |
| | | ret += (20.0 * Math.Sin(y * pi) + 40.0 * Math.Sin(y / 3.0 * pi)) * 2.0 / 3.0; |
| | | ret += (160.0 * Math.Sin(y / 12.0 * pi) + 320 * Math.Sin(y * pi / 30.0)) * 2.0 / 3.0; |
| | | return ret; |
| | | } |
| | | private double TransformLng(double x, double y) |
| | | { |
| | | double ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.Sqrt(Math.Abs(x)); |
| | | ret += (20.0 * Math.Sin(6.0 * x * pi) + 20.0 * Math.Sin(2.0 * x * pi)) * 2.0 / 3.0; |
| | | ret += (20.0 * Math.Sin(x * pi) + 40.0 * Math.Sin(x / 3.0 * pi)) * 2.0 / 3.0; |
| | | ret += (150.0 * Math.Sin(x / 12.0 * pi) + 300.0 * Math.Sin(x / 30.0 * pi)) * 2.0 / 3.0; |
| | | return ret; |
| | | } |
| | | // 椭球参数-圆周率 |
| | | private const double pi = 3.14159265358979324; |
| | | |
| | | // (北京54)椭球长半轴,卫星椭球坐标投影到平面地图坐标系的投影因子 |
| | | private const double a = 6378245.0; |
| | | /* |
| | | * Krasovsky 1940 (北京54)椭球长半轴第一偏心率平方 |
| | | * 计算方式: |
| | | * 长半轴: |
| | | * a = 6378245.0 |
| | | * 扁率: |
| | | * 1/f = 298.3(变量相关计算为:(a-b)/a) |
| | | * 短半轴: |
| | | * b = 6356863.0188 (变量相关计算方法为:b = a * (1 - f)) |
| | | * 第一偏心率平方: |
| | | * e2 = (a^2 - b^2) / a^2; |
| | | */ |
| | | private const double ee = 0.00669342162296594323; |
| | | |
| | | /// <summary> |
| | | /// APP上报GPS经纬度 |
| | | /// </summary> |
| | | public void AppLatAndLonEvent() |
| | | { |
| | | Application.LocationAction += (lon, lat) => |
| | | { |
| | | ////GPS坐标转成高德坐标 |
| | | //double out_lng, out_lat; |
| | | //this.WGS84_to_GCJ02(lon, lat, out out_lng, out out_lat); |
| | | //上报经纬度 |
| | | this.AutomatedGeofenceStatusReporting(lon, lat); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 自动化地理围栏状态上报云端 |
| | | /// </summary> |
| | | /// <param name="out_lng">APP GPS经度</param> |
| | | /// <param name="out_lat">APP GPS纬度</param> |
| | | private void AutomatedGeofenceStatusReporting(double out_lng, double out_lat) |
| | | { |
| | | List<LogicData> logicDataList = new List<LogicData>(); |
| | | logicDataList.Clear(); |
| | | //获取逻辑ID列表 |
| | | var idStr = Send.GetLogicIdList(); |
| | | if (idStr.Code == "0" && idStr.Data != null && idStr.Data.ToString() != "") |
| | | { |
| | | var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data); |
| | | logicDataList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date); |
| | | } |
| | | ///有自动列表才处理 |
| | | if (logicDataList.Count>0) { |
| | | ///遍历所有列表 |
| | | for (int i = 0; i < logicDataList.Count; i++) |
| | | { |
| | | var logicDate = logicDataList[i]; |
| | | ///自动化没有配置地理围栏不处理 |
| | | if (string.IsNullOrEmpty(logicDate.geo_fence.latitude) || string.IsNullOrEmpty(logicDate.geo_fence.longitude)) |
| | | { |
| | | //经纬度为空,认为自动化没有配置地理围栏,不处理; |
| | | continue; |
| | | } |
| | | //自动化纬度 |
| | | double lat = Convert.ToDouble(logicDate.geo_fence.latitude); |
| | | //自动化经度 |
| | | double lon = Convert.ToDouble(logicDate.geo_fence.longitude); |
| | | //自动化配置输入条件<地理围栏半径><单位,公里、千米.米> |
| | | int radius = int.Parse(logicDate.geo_fence.radius); |
| | | //计算2个经纬度之间的距离 |
| | | int r =Infrastructure.Service.Helper.CalculatedDistance.Distance(out_lat, out_lng, lat, lon); |
| | | //定义一个局部变量 |
| | | string direction = string.Empty; |
| | | //两点距离小于配置距离<既自动化配置输入条件地理围栏半径>,说明进入区域 |
| | | if (r<radius) { |
| | | //到达某地 |
| | | direction = "arrive"; |
| | | } else { |
| | | //离开 |
| | | direction = "leave"; |
| | | } |
| | | bool f= Send.GeoFenceStateReport(logicDate.userLogicId,logicDate.sid, direction); |
| | | //if () { } |
| | | //Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | ProgressTextColor = CSS.CSS_Color.textColor, |
| | | ProgressTextSize = 10,//显示百分比字体大小 |
| | | SeekBarViewHeight = Application.GetRealHeight(8),//进度条的高度 |
| | | MinValue=5,//产品经理晓辉要求改的 2021-11-06 |
| | | MaxValue=100, |
| | | Progress=5,//产品经理晓辉要求改的 2021-11-06 |
| | | |
| | | }; |
| | | /// <summary> |
| | | /// 图标+ |
| | |
| | | /// 逻辑使能(开,关) |
| | | /// </summary> |
| | | public string enable = ""; |
| | | //public CycleA cycle; |
| | | //public string modifyTime = ""; |
| | | /// <summary> |
| | | /// 地理围栏配置 |
| | | /// </summary> |
| | | public Fence geo_fence = new Fence(); |
| | | } |
| | | |
| | | class CycleA |
| | |
| | | { |
| | | case StringId.wendugaoyu: |
| | | { |
| | | keyValue = "outdoor_temp"; |
| | | keyValue = "temperature"; |
| | | comparator = ">"; |
| | | } |
| | | break; |
| | | case StringId.wendudiyu: |
| | | { |
| | | keyValue = "outdoor_temp"; |
| | | keyValue = "temperature"; |
| | | comparator = "<"; |
| | | } |
| | | break; |
| | | case StringId.shidugaoyu: |
| | | { |
| | | keyValue = "outdoor_humity"; |
| | | keyValue = "humidity"; |
| | | comparator = ">"; |
| | | } |
| | | break; |
| | | case StringId.shidudiyu: |
| | | { |
| | | keyValue = "outdoor_humity"; |
| | | keyValue = "humidity"; |
| | | comparator = "<"; |
| | | } |
| | | break; |
| | | } |
| | | |
| | | AddDic(keyValue, comparator, value); |
| | | AddDic(keyValue, comparator, value,"float"); |
| | | }); |
| | | } |
| | | /// <summary> |
| | |
| | | , (text) => |
| | | { |
| | | var value= pmView.GetValue("pm25", text); |
| | | AddDic("pm2.5", "in", value); |
| | | AddDic("pm25", "in", value, "integer"); |
| | | }); |
| | | } |
| | | /// <summary> |
| | | /// 封装数据 |
| | | /// </summary> |
| | | /// <param name="keyValue">类型值(pm2.5;outdoor_temp;outdoor_humity)</param> |
| | | /// <param name="keyValue">类型值(pm25;temperature;humidity)</param> |
| | | /// <param name="comparator">比较关系</param> |
| | | /// <param name="value">值</param> |
| | | private void AddDic(string keyValue, string comparator, string value) |
| | | public void AddDic(string keyValue, string comparator,string value,string data_type) |
| | | { |
| | | Input input = new Input(); |
| | | input.sid = LogicMethod.CurrLogicMethod.NewSid(); |
| | | input.condition_type = "4"; |
| | | input.condition_type = "6"; |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "key", keyValue); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", comparator); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "float"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", data_type); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "value", value); |
| | | input.condition.Add(dic); |
| | | AddCondition(input, keyValue, comparator); |
| | |
| | | for (var i = 0; i < Logic.currlogic.input.Count; i++) |
| | | { |
| | | var condition_type = Logic.currlogic.input[i].condition_type; |
| | | if (condition_type == "4") |
| | | if (condition_type == "6") |
| | | { |
| | | var dicList = Logic.currlogic.input[i].condition; |
| | | if (ExistKey(dicList, keyValue, comparator)) |
| | |
| | | }; |
| | | } |
| | | break; |
| | | case "地理围栏": |
| | | { |
| | | list = new List<string> { |
| | | Language.StringByID(StringId.likai ), |
| | | Language.StringByID(StringId.daoda), |
| | | }; |
| | | } |
| | | break; |
| | | } |
| | | return list; |
| | | } |
| | |
| | | conditionArray.Add(conditionJOb); |
| | | } |
| | | inputTypeJOb.Add("condition",conditionArray); |
| | | if (dictionary.condition_type=="8") { |
| | | ///地理围栏 |
| | | var geo_fencejob = new JObject(); |
| | | geo_fencejob.Add("longitude", dictionary.geo_fence.longitude); |
| | | geo_fencejob.Add("latitude", dictionary.geo_fence.latitude); |
| | | geo_fencejob.Add("radius", dictionary.geo_fence.radius); |
| | | inputTypeJOb.Add("geo_fence", geo_fencejob); |
| | | } |
| | | inputArray.Add(inputTypeJOb); |
| | | } |
| | | |
| | |
| | | conditionJOb.Add("data_type", dic["data_type"]); |
| | | conditionJOb.Add("value", dic["value"]); |
| | | conditionArray.Add(conditionJOb); |
| | | if (dictionary.condition_type == "8") |
| | | { |
| | | ///地理围栏 |
| | | var geo_fencejob = new JObject(); |
| | | geo_fencejob.Add("longitude", dictionary.geo_fence.longitude); |
| | | geo_fencejob.Add("latitude", dictionary.geo_fence.latitude); |
| | | geo_fencejob.Add("radius", dictionary.geo_fence.radius); |
| | | inputTypeJOb.Add("geo_fence", geo_fencejob); |
| | | } |
| | | } |
| | | inputTypeJOb.Add("condition", conditionArray); |
| | | inputArray.Add(inputTypeJOb); |
| | |
| | | } |
| | | return responsePackNew; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 自动化地理围栏状态上报 |
| | | /// </summary> |
| | | /// <param name="userLogicId">自动化云端id<备注:logicSid与userLogicId 不能同时为空></param> |
| | | /// <param name="logicSid">自动化sid<备注:logicSid与userLogicId 不能同时为空></param> |
| | | /// <param name="direction">arrive:到达(进入) leave:离开</param> |
| | | /// <returns></returns> |
| | | public static bool GeoFenceStateReport(string userLogicId, string logicSid, string direction) |
| | | { |
| | | var jObject = new JObject(); |
| | | jObject.Add("homeId", LogicMethod.CurrLogicMethod.HomeId); |
| | | jObject.Add("userLogicId", userLogicId); |
| | | jObject.Add("sid", logicSid); |
| | | jObject.Add("direction", direction); |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_GeoFenceStateReport); |
| | | //如果是token过期则刷新token |
| | | if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) |
| | | { |
| | | RefreshToken(); |
| | | GeoFenceStateReport(userLogicId, logicSid, direction); |
| | | } |
| | | if (responsePackNew.Code == "0") |
| | | { |
| | | //成功 |
| | | return true; |
| | | } |
| | | //失败 |
| | | return false; |
| | | } |
| | | |
| | | /// <summary> |
| | | ///请求服务器(与住宅有关:例如;homeId) |
| | | /// </summary> |
| | |
| | | brightnessView.frameLayout.Y = lightSwitchView.frameLayout.Bottom; |
| | | brightnessView.btnText.TextID = StringId.brightnesLogic; |
| | | fLayout.AddChidren(brightnessView.FLayoutView()); |
| | | brightnessView.btnState.Text = "5%";//产品经理晓辉要求改的 2021-11-06 |
| | | #endregion |
| | | #region 点击事件 |
| | | ///开关点击事件 |
| | |
| | | string text = view.btnClick.Tag.ToString(); |
| | | if (text == Language.StringByID(StringId.clearday)) |
| | | { |
| | | value = "sunny"; |
| | | value = "Sunny"; |
| | | } |
| | | else if (text == Language.StringByID(StringId.cloudy)) |
| | | { |
| | | value = "cloudy"; |
| | | value = "Cloudy"; |
| | | } |
| | | else if (text == Language.StringByID(StringId.rain)) |
| | | { |
| | | value = "rainy"; |
| | | value = "Rain"; |
| | | } |
| | | AddDic(value); |
| | | }; |
| | |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "value", value); |
| | | input.condition.Add(dic); |
| | | AddCondition(input); |
| | | AddCondition(input, "weather", "="); |
| | | } |
| | | /// <summary> |
| | | /// 添加条件 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | private void AddCondition(Input input) |
| | | private void AddCondition(Input input, string keyValue, string comparator) |
| | | { |
| | | ///记录索引值 |
| | | int index = -1; |
| | |
| | | var condition_type = Logic.currlogic.input[i].condition_type; |
| | | if (condition_type == "6") |
| | | { |
| | | var dicList = Logic.currlogic.input[i].condition; |
| | | if (ExistKey(dicList, keyValue, comparator)) |
| | | { |
| | | ///找到标记索引,退出循环体 |
| | | index = i; |
| | | break; |
| | | } |
| | | ///找到标记索引,退出循环体 |
| | | index = i; |
| | | break; |
| | |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 判断是否存在Key |
| | | /// </summary> |
| | | /// <param name="dicList"></param> |
| | | /// <param name="keyValue"></param> |
| | | /// <param name="comparator">比较关系</param> |
| | | /// <returns></returns> |
| | | private bool ExistKey(List<Dictionary<string, string>> dicList, string keyValue, string comparator) |
| | | { |
| | | for (int i = 0; i < dicList.Count; i++) |
| | | { |
| | | var dic = dicList[i]; |
| | | string key = dic["key"]; |
| | | string comparatorValue = dic["comparator"]; |
| | | if (key == keyValue && comparatorValue == comparator) |
| | | { |
| | | //判断是否存在 |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | |
| | | //viewLayout.AddChidren(banbenshengjiFL.FLayoutView()); |
| | | |
| | | |
| | | var versions = Pir.currPir.versions.Find((c) => c.module == "FW"); |
| | | var versions = Pir.currPir.versions.Find((c) => c.module.Contains("FW")); |
| | | if (versions == null) |
| | | { |
| | | versions = new Entity.VersionInfo(); |