HDL-ON_Android/Assets/Language.ini
@@ -1601,6 +1601,8 @@ 7129=(100字内) 7130=账号选择 7131=App推送 7132=自动化 7133=已执行 9000=请使用新的手机账号登录APP 9001=请使用新的邮箱账号登录APP HDL-ON_Android/Assets/Phone/LogicIcon/shiwaitianqi.png
HDL-ON_Android/HDL-ON_Android.csproj
@@ -1126,6 +1126,7 @@ <AndroidAsset Include="Assets\Phone\FunctionIcon\ArmCenter\HouseDefenseIconOn.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\ArmCenter\BurglarAlarmIcon.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\ArmCenter\HistoryIcon.png" /> <AndroidAsset Include="Assets\Phone\LogicIcon\shiwaitianqi.png" /> </ItemGroup> <ItemGroup> <AndroidNativeLibrary Include="libs\armeabi-v7a\libelianjni.so" /> HDL-ON_iOS/HDL-ON_iOS.csproj
@@ -1233,6 +1233,7 @@ <BundleResource Include="Resources\Phone\FunctionIcon\ArmCenter\BurglarAlarmIcon.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\ArmCenter\HistoryIcon.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\FunctionBg\SecurityCenterFunctionBg.png" /> <BundleResource Include="Resources\Phone\LogicIcon\shiwaitianqi.png" /> </ItemGroup> <ItemGroup> <ITunesArtwork Include="iTunesArtwork" /> HDL-ON_iOS/Resources/Language.ini
@@ -1601,6 +1601,8 @@ 7129=(100字内) 7130=账号选择 7131=App推送 7132=自动化 7133=已执行 9000=请使用新的手机账号登录APP 9001=请使用新的邮箱账号登录APP HDL-ON_iOS/Resources/Phone/LogicIcon/shiwaitianqi.png
HDL_ON/Common/R.cs
@@ -1099,6 +1099,8 @@ public const int xianzhichangdu = 7129; public const int zhanghaoxuanze = 7130; public const int apptuisong = 7131; public const int zidontghua = 7132; public const int yizhixing = 7133; #region LE新增 /// <summary> HDL_ON/DAL/Server/HttpUtil.cs
@@ -153,6 +153,7 @@ { urlHead = OnAppConfig.Instance.RequestHttpsHost; } //"https://test-gz.hdlcontrol.com"; //"https://bahrain-gateway.hdlcontrol.com"; //urlHead="https://china-gateway.hdlcontrol.com"; string requestFullUrl = urlHead + apiPath; HDL_ON/HDL_ON.projitems
@@ -402,6 +402,7 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmCenter\ArmCenterPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Entity\Function\SecurityAlarm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmCenter\ArmDeploymentSettingPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\OnePortAutomation.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)DAL\" /> HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
@@ -32,7 +32,10 @@ LogicView.SelectTypeView timeView = new LogicView.SelectTypeView(); timeView.btnText.TextID = StringId.time; timeView.btnIcon.UnSelectedImagePath = "LogicIcon/time.png"; viewLayout.AddChidren(timeView.FLayoutView()); if (MainView.IsGatewayType) { viewLayout.AddChidren(timeView.FLayoutView()); } //功能 LogicView.SelectTypeView functionView = new LogicView.SelectTypeView(); @@ -40,13 +43,21 @@ 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 shiwaiView = new LogicView.SelectTypeView(); shiwaiView.frameLayout.Y = functionView.frameLayout.Bottom; shiwaiView.btnText.TextID = StringId.shiwaibainhua; shiwaiView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png"; viewLayout.AddChidren(shiwaiView.FLayoutView()); if (MainView.IsGatewayType) { viewLayout.AddChidren(shiwaiView.FLayoutView()); } #endregion HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
@@ -129,8 +129,8 @@ notification.btnText.TextID = StringId.notification; notification.btnLine.BackgroundColor = CSS.CSS_Color.textWhiteColor; viewLayout.AddChidren(notification.FLayoutView()); if (Logic.currlogic.pushConfigs.Count > 0) //显示之前推送开关状态 if (Logic.currlogic.noticeConfig.enable) { push.btnNextIcon.IsSelected = true; } @@ -141,7 +141,7 @@ ///上下间隔62像素 viewLayout.AddChidren(new FrameLayout { Height = Application.GetRealHeight(40) }); #endregion #region 保存 ///保存View LogicView.SaveView saveView = new LogicView.SaveView(); @@ -188,47 +188,25 @@ DateMethod(cyclicTitle.btnText); }; ///是否要推送点击事件 //初始化对象 PushConfigs pushConfigs = new PushConfigs(); if (Logic.currlogic.pushConfigs.Count > 0) { pushConfigs = Logic.currlogic.pushConfigs[0]; } else { if (!string.IsNullOrEmpty(UserInfo.Current.userMobileInfo)) { //默认推送当前账号 pushConfigs.pushTarget.Add(UserInfo.Current.userMobileInfo); } else { //默认推送当前账号 pushConfigs.pushTarget.Add(UserInfo.Current.userEmailInfo); } } push.btnNextIcon.MouseUpEventHandler += (sender, e) => { push.btnNextIcon.IsSelected = !push.btnNextIcon.IsSelected; //账号列表为空默认推送当前账号 if (Logic.currlogic.pushConfigs.Count == 0) { //初始化对象 PushConfigs pushConfigs = new PushConfigs(); //默认添加推送当前账号 pushConfigs.pushTarget.Add(UserInfo.Current.ID); Logic.currlogic.pushConfigs.Add(pushConfigs); } push.btnNextIcon.IsSelected = !push.btnNextIcon.IsSelected; if (push.btnNextIcon.IsSelected) { if (Logic.currlogic.pushConfigs.Count > 0) { //清空之前旧配置数据 Logic.currlogic.pushConfigs.Clear(); } //增加配置数据 Logic.currlogic.pushConfigs.Add(pushConfigs); Logic.currlogic.noticeConfig.enable = true; } else { if (Logic.currlogic.pushConfigs.Count > 0) { //默认取第一个赋值 pushConfigs = Logic.currlogic.pushConfigs[0]; //清空配置数据 Logic.currlogic.pushConfigs.Clear(); } Logic.currlogic.noticeConfig.enable = false; } }; ///输入推送文本 @@ -236,18 +214,13 @@ { InputPushText inputPushText = new InputPushText(); MainPage.BasePageView.AddChidren(inputPushText); inputPushText.Show(pushConfigs); inputPushText.Show(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; inputPushText.action += (pushConfigsIfon) => { //赋值 pushConfigs = pushConfigsIfon; }; }; ///保存点击事件 saveView.btnClick.MouseUpEventHandler += (sender, e) => { if (Logic.currlogic.input.Count == 0&& Logic.currlogic.output.Count == 0) if (Logic.currlogic.input.Count == 0 && Logic.currlogic.output.Count == 0) { new LogicView.TipPopView().TipBox(StringId.tip, StringId.conditioncNullOrtargetNull); return; @@ -272,7 +245,7 @@ { list.Add(logic.name); } new LogicView.TipPopView().InputBox(StringId.editName, InpOrOutLogicMethod.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName,view new LogicView.TipPopView().InputBox(StringId.editName, InpOrOutLogicMethod.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName, view ) => { Logic.currlogic.name = logicName; @@ -336,7 +309,7 @@ }) { IsBackground = true }.Start(); },()=> { }); }, () => { }); } else @@ -366,7 +339,7 @@ { new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline)); } else else { new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail)); } @@ -536,7 +509,7 @@ //加载之前保存的数据 weekStateList.AddRange(list); } var weekListStr= weekView.GetViewList("week"); var weekListStr = weekView.GetViewList("week"); weekView.MultiSelectShow(fLayout, weekListStr, Language.StringByID(StringId.cyclic), weekStateList , (list) => { @@ -564,7 +537,7 @@ weekView.MonSelectShow(fLayout, Logic.currlogic, (monList) => { //选中数据处理 string textStr= MainView.GetMonString(monList); string textStr = MainView.GetMonString(monList); //显示选中数据 button.Text = textStr; //封装数据 @@ -603,8 +576,7 @@ } } } HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -135,13 +135,14 @@ } } break; case SPK.SensorDoorWindow: { case SPK.SensorDoorWindow: { LogicView.FunTypeView view = new LogicView.FunTypeView(); view.btnText.TextID = StringId.kaiqiandbihe; fLayout.AddChidren(view.FLayoutView()); view.btnClick.MouseUpEventHandler += (sender, e) => { DeviceView(device, view.btnState, StringId.kaiqi , StringId.bihe); DeviceView(device, view.btnState, StringId.kaiqi, StringId.bihe); }; if (edit) { @@ -151,7 +152,7 @@ break; case SPK.SensoruUtrasonic: { LogicView.FunTypeView view = new LogicView.FunTypeView(); view.btnText.TextID = StringId.yourenandwuren; fLayout.AddChidren(view.FLayoutView()); @@ -214,10 +215,22 @@ return; } LogicMethod.RemoveAllView(); AddLogic addLogic = new AddLogic(); MainPage.BasePageView.AddChidren(addLogic); addLogic.Show(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; if (MainView.IsGatewayType) { //A网关 var addLogic = new AddLogic(); MainPage.BasePageView.AddChidren(addLogic); addLogic.Show(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } else { //一端口网关 var onePortAutomation = new OnePortAutomation(); MainPage.BasePageView.AddChidren(onePortAutomation); onePortAutomation.Show(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } }; #endregion HDL_ON/UI/UI2/3-Intelligence/Automation/InputPushText.cs
@@ -11,8 +11,7 @@ { Tag = "Logic"; } public Action<PushConfigs> action; public void Show(PushConfigs pushConfigs) public void Show() { this.BackgroundColor = CSS.CSS_Color.viewMiddle; @@ -41,7 +40,7 @@ Height = Application.GetRealHeight(152), TextAlignment = TextAlignment.TopLeft, Radius=(uint)Application.GetRealHeight(12), Text= pushConfigs.pushContent, Text= Logic.currlogic.noticeConfig.noticeContent, TextSize = LogicView.TextSize.text14, TextColor= CSS.CSS_Color.textColor, PlaceholderText =Language.StringByID(StringId.xianzhichangdu),//"(100字以内)", @@ -61,7 +60,6 @@ #endif } pushConfigs.pushContent = textBox.Text.Trim(); }; #endregion @@ -72,10 +70,11 @@ appPush.btnText.TextID = StringId.apptuisong; appPush.btnText.X = Application.GetRealWidth(12); viewLayout.AddChidren(appPush.FLayoutView()); //定义一个局部账号列表用来记录选中数据; List<string> selectedAccountList = new List<string>(); appPush.btnClick.MouseUpEventHandler += (sender, e) => { //定义一个局部账号列表用来记录选中数据; List<string> accountList = new List<string>(); var userList = new List<HDL_ON.Entity.ResidenceMemberInfo>(); Loading loading = new Loading(); this.AddChidren(loading); loading.Start(); @@ -83,12 +82,8 @@ { try { var userList = Send.GetResidenceMemberAccount(); for (int i = 0; i < userList.Count; i++) { var user = userList[i]; accountList.Add(user.Account); } userList = Send.GetResidenceMemberAccount(); } catch { } finally @@ -96,21 +91,49 @@ Application.RunOnMainThread(() => { loading.Hide(); if (!string.IsNullOrEmpty(UserInfo.Current.userMobileInfo)) userList.Add(new Entity.ResidenceMemberInfo { childAccountId = UserInfo.Current.ID, childAccountPhone = UserInfo.Current.userMobileInfo, childAccountEmail = UserInfo.Current.userEmailInfo }); //住宅子账号列表 List<string> accountList = new List<string>(); //之前状态列表 List<string> stateList = new List<string>(); for (int i = 0; i < userList.Count; i++) { //默认推送当前账号 accountList.Insert(0, UserInfo.Current.userMobileInfo); var user = userList[i]; accountList.Add(user.Account); } else if (Logic.currlogic.pushConfigs.Count > 0) { //默认推送当前账号 accountList.Insert(0, UserInfo.Current.userEmailInfo); var list = Logic.currlogic.pushConfigs[0].pushTarget; for (int i = 0;i< userList.Count; i++) { var user = userList[i]; if (list.Contains(user.childAccountId)) { stateList.Add(user.Account); } } } PublicInterface view = new PublicInterface(); view.FrameOrVvList(this, accountList, pushConfigs.pushTarget, StringId.zhanghaoxuanze view.FrameOrVvList(this, accountList, stateList, StringId.zhanghaoxuanze , (list) => { pushConfigs.pushTarget = list; //清空旧数据列表 selectedAccountList.Clear(); for (int i = 0;i<userList.Count; i++) { var user = userList[i]; if (list.Contains(user.Account)) { selectedAccountList.Add(user.childAccountId); } } }); }); } @@ -127,18 +150,50 @@ topView.clickBackBtn.MouseUpEventHandler += (e, sen) => { action(pushConfigs); RemoveFromParent(); this.RemoveFromParent(); }; saveView.btnClick.MouseUpEventHandler += (e, sen) => { action(pushConfigs); RemoveFromParent(); Logic.currlogic.noticeConfig.noticeContent = textBox.Text.Trim(); if (selectedAccountList.Count > 0) { Logic.currlogic.pushConfigs.Clear();//清空旧数据列表 Logic.currlogic.pushConfigs.Add(new PushConfigs { pushTarget = selectedAccountList }); } //账号列表为空默认推送当前账号 if (Logic.currlogic.pushConfigs.Count == 0) { //初始化对象 PushConfigs pushConfigs = new PushConfigs(); //默认添加推送当前账号 pushConfigs.pushTarget.Add(UserInfo.Current.ID); Logic.currlogic.pushConfigs.Add(pushConfigs); } this.RemoveFromParent(); }; #endregion } /// <summary> /// 手机账号为先,手机账号为空,其次到邮箱账号 /// </summary> private string Account { get { ///手机账号为先,手机账号为空,其次到邮箱账号; if (!string.IsNullOrEmpty(UserInfo.Current.userMobileInfo)) { //默认推送当前手机账号 return UserInfo.Current.userMobileInfo; } else { //默认推送当前邮箱账号 return UserInfo.Current.userEmailInfo; } } } } } HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs
@@ -50,6 +50,10 @@ /// </summary> public List<Output> output = new List<Output>(); /// <summary> /// 通知配置 /// </summary> public NoticeConfig noticeConfig = new NoticeConfig(); /// <summary> /// 推送配置 /// </summary> public List<PushConfigs> pushConfigs = new List<PushConfigs>(); @@ -136,6 +140,21 @@ public string radius = string.Empty; } /// <summary> /// 通知配置 /// </summary> [Serializable] public class NoticeConfig { /// <summary> /// 是否开启通知 /// </summary> public bool enable = false; /// <summary> /// 通知内容 /// </summary> public string noticeContent = "自动化已经执行";//string.Empty; } /// <summary> /// 推送配置 /// </summary> [Serializable] @@ -148,7 +167,7 @@ /// <summary> /// 推送内容 /// </summary> public string pushContent = string.Empty; //public string pushContent = string.Empty; /// <summary> /// 推送目标 /// </summary> HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
@@ -46,11 +46,12 @@ logicView.btnWeekText.Text = GetCyclicText(currLogic); logicView.btnclick.MouseUpEventHandler += (sen, e) => { Logic.currlogic = currLogic; var addLogic = new AddLogic(); MainPage.BasePageView.AddChidren(addLogic); addLogic.Show(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; //Logic.currlogic = currLogic; //var addLogic = new AddLogic(); //MainPage.BasePageView.AddChidren(addLogic); //addLogic.Show(); //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; new MainView { }.SkipAddLogicPage(currLogic); }; //开关图标的点击事件 logicView.btnSwitchIcon.MouseUpEventHandler += (sender1, e1) => @@ -123,13 +124,30 @@ /// <summary> /// 按+跳转到逻辑界面的方法 /// </summary> public void SkipAddLogicPage() public void SkipAddLogicPage(Logic logic=null) { Logic.currlogic = new Logic(); var addLogic = new AddLogic(); MainPage.BasePageView.AddChidren(addLogic); addLogic.Show(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; if (logic == null) { Logic.currlogic = new Logic(); } else { Logic.currlogic = logic; } if (IsGatewayType) { var addLogic = new AddLogic(); MainPage.BasePageView.AddChidren(addLogic); addLogic.Show(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } else { var onePortAutomation = new OnePortAutomation(); MainPage.BasePageView.AddChidren(onePortAutomation); onePortAutomation.Show(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } } /// <summary> ///返回循环描述文本 @@ -209,7 +227,6 @@ } return weekTextName.TrimEnd(','); } /// <summary> /// 获取每月的字符串 /// </summary> @@ -262,6 +279,7 @@ var jay = jArray[a]; //数据返序列化为Logic对象 var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); Console.WriteLine("获取逻辑==="+str); var logic = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic>(str); if (logic != null) { @@ -270,37 +288,38 @@ if (if_logic == null) { Logic newlogic = new Logic(); newlogic.name = logic.name; newlogic.userLogicId = logic.userLogicId; newlogic.sid = logic.sid; newlogic.relation = logic.relation; newlogic.enable = logic.enable; newlogic.cycle = logic.cycle; for (int i = 0; i < logic.input.Count; i++) { if (logic.input[i] == null || string.IsNullOrEmpty(logic.input[i].condition_type)) { //防止调试软件乱传东西上来; //防止有空对象; //正常情况下不会出现的现象; continue; } newlogic.input.Add(logic.input[i]); } for (int i = 0; i < logic.output.Count; i++) { if (logic.output[i] == null || string.IsNullOrEmpty(logic.output[i].target_type)) { //防止调试软件乱传东西上来; //防止有空对象; //正常情况下不会该现象; continue; } newlogic.output.Add(logic.output[i]); } //Logic newlogic = new Logic(); //newlogic.name = logic.name; //newlogic.userLogicId = logic.userLogicId; //newlogic.sid = logic.sid; //newlogic.relation = logic.relation; //newlogic.enable = logic.enable; //newlogic.cycle = logic.cycle; //for (int i = 0; i < logic.input.Count; i++) //{ // if (logic.input[i] == null || string.IsNullOrEmpty(logic.input[i].condition_type)) // { // //防止调试软件乱传东西上来; // //防止有空对象; // //正常情况下不会出现的现象; // continue; // } // newlogic.input.Add(logic.input[i]); //} //for (int i = 0; i < logic.output.Count; i++) //{ // if (logic.output[i] == null || string.IsNullOrEmpty(logic.output[i].target_type)) // { // //防止调试软件乱传东西上来; // //防止有空对象; // //正常情况下不会该现象; // continue; // } // newlogic.output.Add(logic.output[i]); //} //添加逻辑 Logic.LogicList.Add(newlogic); Logic.LogicList.Add(logic); } } @@ -323,7 +342,6 @@ } return false; } /// <summary> /// 显示条件或者目标类型图标 /// </summary> @@ -356,6 +374,14 @@ case 3: { iconInt = 2; } break; case 4: case 6: case 9: { iconInt = 3; } break; @@ -450,6 +476,12 @@ strIcon = "LogicIcon/selectTheFun.png"; } break; case 3: { strIcon = "LogicIcon/shiwaitianqi.png"; } break; case 11: { //分割条件和目标的图标 @@ -477,6 +509,25 @@ btnIcon.UnSelectedImagePath = strIcon; } } /// <summary> /// 判断网关类型 /// </summary> /// <returns></returns> public static bool IsGatewayType { get { if (Entity.DB_ResidenceData.Instance.GatewayType == 1) { return true; } else { return false; } } } } class LogicData { HDL_ON/UI/UI2/3-Intelligence/Automation/OnePortAutomation.cs
New file @@ -0,0 +1,344 @@ using System; using Shared; using System.Collections.Generic; namespace HDL_ON.UI.UI2.Intelligence.Automation { public class OnePortAutomation : FrameLayout { public OnePortAutomation() { Tag = "Logic"; } public void Show() { #region 界面布局 this.BackgroundColor = CSS.CSS_Color.viewMiddle; LogicView.TopView topView = new LogicView.TopView(); topView.setBtn.Visible = true; this.AddChidren(topView.FLayoutView()); topView.clickBackBtn.MouseUpEventHandler += (e, sen) => { RemoveFromParent(); }; if (string.IsNullOrEmpty(Logic.currlogic.userLogicId)) { topView.topNameBtn.TextID = StringId.newAutomation; topView.setBtn.Visible = false; topView.clickSetBtn.Visible = false; } else { topView.topNameBtn.TextID = StringId.editAutomation; topView.setBtn.Visible = true; topView.clickSetBtn.Visible = true; } VerticalScrolViewLayout viewLayout = new VerticalScrolViewLayout { Y = Application.GetRealHeight(64), Width = Application.GetRealWidth(LogicView.TextSize.view375), Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64 - 76), BackgroundColor = CSS.CSS_Color.viewMiddle, }; this.AddChidren(viewLayout); #region 条件 ///如果的View LogicView.AddOutputInputTextView addInputTextView = new LogicView.AddOutputInputTextView(); addInputTextView.btnIf.TextID = StringId.ifCondition; viewLayout.AddChidren(addInputTextView.FLayoutView(46, 12)); ///满足以下条件的View LogicView.LogicTypeTitleView titleCondition = new LogicView.LogicTypeTitleView(); titleCondition.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); titleCondition.btnText.TextID = StringId.andCondition; viewLayout.AddChidren(titleCondition.FLayoutView()); if (Logic.currlogic.relation == "and") { titleCondition.btnText.Text = Language.StringByID(StringId.andCondition); } else { titleCondition.btnText.Text = Language.StringByID(StringId.orCondition); } // 条件处理方法 InpOrOutLogicMethod.InputCondition(this, viewLayout); ///添加图标的View LogicView.LogicAddView addInputIcon = new LogicView.LogicAddView(); addInputIcon.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight); viewLayout.AddChidren(addInputIcon.FLayoutView()); #endregion #region 目标 ///就执行View LogicView.AddOutputInputTextView addOutpuTextView = new LogicView.AddOutputInputTextView(); addOutpuTextView.btnIf.TextID = StringId.isExecuted; viewLayout.AddChidren(addOutpuTextView.FLayoutView(54, 20)); #region 执行推送 发送通知 ///上下间隔12像素 viewLayout.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) }); ///执行推送iew LogicView.LogicTypeTitleView push = new LogicView.LogicTypeTitleView(); push.frameLayout.Height = Application.GetRealHeight(50); push.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); push.btnText.TextID = StringId.push; push.btnNextIcon.Width = Application.GetRealWidth(36); push.btnNextIcon.Height = Application.GetRealWidth(36); push.btnNextIcon.X = Application.GetRealWidth(305); push.btnNextIcon.UnSelectedImagePath = "LogicIcon/off.png"; push.btnNextIcon.SelectedImagePath = "LogicIcon/on.png"; push.btnClick.Width = Application.GetRealWidth(305); viewLayout.AddChidren(push.FLayoutView()); ///发送通知View LogicView.LogicTypeTitleView notification = new LogicView.LogicTypeTitleView(); notification.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight); notification.btnText.TextID = StringId.notification; notification.btnLine.BackgroundColor = CSS.CSS_Color.textWhiteColor; viewLayout.AddChidren(notification.FLayoutView()); //显示之前推送开关状态 if (Logic.currlogic.noticeConfig.enable) { push.btnNextIcon.IsSelected = true; } else { push.btnNextIcon.IsSelected = false; } ///上下间隔62像素 viewLayout.AddChidren(new FrameLayout { Height = Application.GetRealHeight(40) }); #endregion #region 保存 ///保存View LogicView.SaveView saveView = new LogicView.SaveView(); saveView.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); this.AddChidren(saveView.FLayoutView()); #endregion #endregion #endregion #region 界面各种点击事件 ///设置图标点击事件 topView.clickSetBtn.MouseUpEventHandler += (sender, e) => { Set set = new Set(); MainPage.BasePageView.AddChidren(set); set.Show(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; ///或和与点击事件 titleCondition.btnClick.MouseUpEventHandler += (sender, e) => { AndOrMethod(titleCondition.btnText); }; ///条件添加点击事件 addInputIcon.btnClick.MouseUpEventHandler += (sen, e) => { var addInputType = new AddInputType(); MainPage.BasePageView.AddChidren(addInputType); addInputType.Show(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; ///是否要推送点击事件 push.btnNextIcon.MouseUpEventHandler += (sender, e) => { //账号列表为空默认推送当前账号 if (Logic.currlogic.pushConfigs.Count == 0) { //初始化对象 PushConfigs pushConfigs = new PushConfigs(); //默认添加推送当前账号 pushConfigs.pushTarget.Add(UserInfo.Current.ID); Logic.currlogic.pushConfigs.Add(pushConfigs); } push.btnNextIcon.IsSelected = !push.btnNextIcon.IsSelected; if (push.btnNextIcon.IsSelected) { Logic.currlogic.noticeConfig.enable = true; } else { Logic.currlogic.noticeConfig.enable = false; } }; ///输入推送文本 notification.btnClick.MouseUpEventHandler += (sender, e) => { InputPushText inputPushText = new InputPushText(); MainPage.BasePageView.AddChidren(inputPushText); inputPushText.Show(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; ///保存点击事件 saveView.btnClick.MouseUpEventHandler += (sender, e) => { if (Logic.currlogic.input.Count == 0) { new LogicView.TipPopView().TipBox(StringId.tip, StringId.conditioncNull); return; } Loading loading = new Loading(); this.AddChidren(loading); HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; if (string.IsNullOrEmpty(Logic.currlogic.userLogicId)) { List<string> list = new List<string>(); foreach (var logic in Logic.LogicList) { list.Add(logic.name); } new LogicView.TipPopView().InputBox(StringId.editName, InpOrOutLogicMethod.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName, view ) => { Logic.currlogic.name = logicName; Logic.currlogic.sid = LogicMethod.NewSid(); loading.Start(); new System.Threading.Thread(() => { try { //发送新加逻辑命令; responsePackNew = Send.AddLogic(Logic.currlogic); } catch { } finally { Application.RunOnMainThread(() => { loading.Hide(); if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") { //获取逻辑详细返回是一个数组(object类型转换为数组); var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString()); for (int a = 0; a < jArray.Count; a++) { var jay = jArray[a]; //数据返序列化为Logic对象 var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); var logic = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic>(str); if (logic.userLogicId != "") { //更新云端唯一自动化id; Logic.currlogic.userLogicId = logic.userLogicId; } else { //自己看的所以不需要支持中英文 new LogicView.TipPopView().FlashingBox("没有返回云端唯一自动化id"); } } Logic.LogicList.Add(Logic.currlogic); LogicMethod.RemoveAllView(); MainView.MainShow(); } else if (responsePackNew != null && responsePackNew.Code == "14005") { new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline)); } else { new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail)); } }); } }) { IsBackground = true }.Start(); }, () => { }); } else { loading.Start(); new System.Threading.Thread(() => { try { //发送修改逻辑命令; responsePackNew = Send.UpdateLogic(Logic.currlogic); } catch { } finally { Application.RunOnMainThread(() => { loading.Hide(); if (responsePackNew != null && responsePackNew.Code == "0") { LogicMethod.RemoveAllView(); MainView.MainShow(); } else if (responsePackNew != null && responsePackNew.Code == "14005") { new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline)); } else { new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail)); } }); } }) { IsBackground = true }.Start(); } }; #endregion } /// <summary> /// 满足条件 /// </summary> /// <param name="button">显示文本</param> public void AndOrMethod(Button button) { ///之前的状态文本 string currCondition = button.Text; PublicInterface conditionView = new PublicInterface(); var strList = conditionView.GetViewList("andor"); conditionView.SingleSelectionShow(this, strList, Language.StringByID(StringId.meetTheCondition), currCondition , (stateValue) => { //界面显示选中值 button.Text = stateValue; //封装数据 if (stateValue == Language.StringByID(StringId.orCondition)) { Logic.currlogic.relation = "or"; } else { Logic.currlogic.relation = "and"; } }); } } } HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
@@ -127,6 +127,11 @@ outputArray.Add(outputTypeJOb); } var noticeConfigJObject = new JObject(); noticeConfigJObject.Add("enable", logic.noticeConfig.enable); noticeConfigJObject.Add("noticeContent", logic.noticeConfig.noticeContent); var pushConfigsArray = new JArray { }; if (logic.pushConfigs.Count > 0) { // 推送文本 @@ -135,7 +140,6 @@ var pushConfigJob = new JObject { }; pushConfigJob.Add("pushMethod", pushConfig.pushMethod); pushConfigJob.Add("pushContent", pushConfig.pushContent); var accountArray = new JArray { }; foreach (var account in pushConfig.pushTarget) { @@ -156,6 +160,7 @@ logicIfon.Add("cycle", cycleJObject); logicIfon.Add("input", inputArray); logicIfon.Add("output", outputArray); logicIfon.Add("noticeConfig", noticeConfigJObject); logicIfon.Add("pushConfigs", pushConfigsArray); logicjArray.Add(logicIfon); var jObject = new JObject { { "homeId", LogicMethod.HomeId }, { "logics", logicjArray } }; @@ -166,14 +171,12 @@ RefreshToken(); AddLogic(logic); } Console.WriteLine("添加逻辑===" + logicjArray); } catch (Exception e) { var dd = e.Message; } return responsePackNew; } /// <summary> @@ -234,6 +237,10 @@ outputArray.Add(outputTypeJOb); } var noticeConfigJObject = new JObject(); noticeConfigJObject.Add("enable", logic.noticeConfig.enable); noticeConfigJObject.Add("noticeContent", logic.noticeConfig.noticeContent); var pushConfigsArray = new JArray { }; if (logic.pushConfigs.Count > 0) { // 推送文本 @@ -242,7 +249,6 @@ var pushConfigJob = new JObject { }; pushConfigJob.Add("pushMethod", pushConfig.pushMethod); pushConfigJob.Add("pushContent", pushConfig.pushContent); var accountArray = new JArray { }; foreach (var account in pushConfig.pushTarget) { @@ -264,6 +270,7 @@ logicIfon.Add("cycle", cycleJObject); logicIfon.Add("input", inputArray); logicIfon.Add("output", outputArray); logicIfon.Add("noticeConfig", noticeConfigJObject); logicIfon.Add("pushConfigs", pushConfigsArray); logicjArray.Add(logicIfon); @@ -280,8 +287,6 @@ { var dd = e.Message; } return responsePackNew; } /// <summary> HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs
@@ -72,7 +72,7 @@ bodyView.AddChidren(topView); //不是A网关或者是成员 只允许添加场景隐藏自动化 var HideAutoPage = DB_ResidenceData.Instance.GatewayType != 1|| DB_ResidenceData.Instance.CurrentRegion.IsOthreShare; var HideAutoPage = DB_ResidenceData.Instance.CurrentRegion.IsOthreShare; //判断是否需要隐藏自动化 if (HideAutoPage) {