Merge remote-tracking branch 'origin/WJC'
1 文件已复制
46个文件已添加
3个文件已删除
25个文件已修改
1 文件已重命名
| | |
| | | 7049=是否要删除自动化? |
| | | 7050=添加场景 |
| | | 7051=延时 |
| | | 7052=保存失败,请重试 |
| | | 7053=删除失败,请重试 |
| | | 7054=暂停 |
| | | 7055=亮度 |
| | | 7056=百分比 |
| | | |
| | | |
| | | |
| | |
| | | <AndroidAsset Include="Assets\Phone\Classification\Room\Roombg8.png" /> |
| | | <AndroidAsset Include="Assets\Phone\Classification\Room\Roombg9.png" /> |
| | | <AndroidAsset Include="Assets\Phone\Classification\Room\Roombg10.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\heatlogic.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\on.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\off.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\timecondition.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\down.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\timeicon.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\lightloguc.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\set.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\addconditiontarget.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\functionicon.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\airconditionerlogic.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\bjicon5.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\delayed.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\next.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\curtainlogic.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\weekoff.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\weekon.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\outletlogic.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\back.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\scene.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\editname.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\bjicon1.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\bjicon2.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\bjicon3.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\bjicon4.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\-.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\+.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\point.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\ selected+.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\selected-.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidNativeLibrary Include="libs\armeabi-v7a\libelianjni.so" /> |
| | |
| | | //------------------------------------------------------------------------------ |
| | | // <auto-generated> |
| | | // This code was generated by a tool. |
| | | // Runtime Version:4.0.30319.42000 |
| | | // |
| | | // Changes to this file may cause incorrect behavior and will be lost if |
| | | // the code is regenerated. |
| | |
| | | { |
| | | |
| | | |
| | | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] |
| | | [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] |
| | | public partial class Resource |
| | | { |
| | | |
| | |
| | | <BundleResource Include="Resources\Phone\Classification\Room\Roombg8.png" /> |
| | | <BundleResource Include="Resources\Phone\Classification\Room\Roombg9.png" /> |
| | | <BundleResource Include="Resources\Phone\Classification\Room\Roombg10.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\heatlogic.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\on.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\off.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\timecondition.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\down.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\timeicon.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\lightloguc.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\set.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\addconditiontarget.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\functionicon.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\airconditionerlogic.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\bjicon5.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\delayed.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\next.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\curtainlogic.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\weekoff.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\weekon.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\outletlogic.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\back.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\scene.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\editname.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\bjicon1.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\bjicon2.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\bjicon3.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\bjicon4.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\-.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\+.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\point.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\ selected+.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\selected-.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ITunesArtwork Include="iTunesArtwork" /> |
| | |
| | | 5047=你手机暂未安装"QQ音乐"{\r\n}请前往手机商场安装 |
| | | |
| | | |
| | | |
| | | 7000=新建自动化 |
| | | 7001=编辑自动化 |
| | | 7002=如果 |
| | |
| | | 7049=是否要删除自动化? |
| | | 7050=添加场景 |
| | | 7051=延时 |
| | | |
| | | 7052=保存失败,请重试 |
| | | 7053=删除失败,请重试 |
| | | 7054=暂停 |
| | | 7055=亮度 |
| | | 7056=百分比 |
| | | |
| | | |
| | | 9000=请使用新的手机账号登录APP |
| | |
| | | 9041=系统信息 |
| | | 9042=信息中心 |
| | | 9043=该账号已在其它设备登录 |
| | | 9044=上传成功 |
| | | 9045=上传失败 |
| | | |
| | | |
| | | 10000=无效登录密钥,请重新登录! |
| | |
| | | public const int delAutomation = 7049; |
| | | public const int addSceneLogic = 7050; |
| | | public const int delayLogic = 7051; |
| | | public const int saveFail = 7052; |
| | | public const int delFail = 7053; |
| | | public const int stop= 7054; |
| | | public const int brightnesLogic= 7055; |
| | | public const int percentum = 7056; |
| | | |
| | | |
| | | |
| | | #region LE新增 |
| | |
| | | /// <summary> |
| | | /// 编辑自动化 |
| | | /// </summary> |
| | | public const string API_POST_Logic_Update = ":/home-wisdom/app/logic/update"; |
| | | public const string API_POST_Logic_Update = "/home-wisdom/app/logic/update"; |
| | | /// <summary> |
| | | /// 删除自动化 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 启用禁用自动化 |
| | | /// </summary> |
| | | public const string API_POST_Logic_Enable = ":/home-wisdom/app/logic/enable"; |
| | | public const string API_POST_Logic_Enable = "/home-wisdom/app/logic/enable"; |
| | | #endregion |
| | | |
| | | |
| | |
| | | /// <summary> |
| | | /// 色温 |
| | | /// </summary> |
| | | ColorTemperature =0x0203, |
| | | ColorTemperature = 0x0203, |
| | | RGB = 0x0204, |
| | | Curtain = 0x0301, |
| | | MotorCurtain = 0x0303, |
| | |
| | | |
| | | Fan = 0x1001, |
| | | TV = 0x1002, |
| | | Socket =0x0102, |
| | | Socket = 0x0102, |
| | | |
| | | PM25 = 0x0506, |
| | | CO2 = 0x0507, |
| | |
| | | Humidity = 0x0503, |
| | | |
| | | A31Music = 0x0902, |
| | | |
| | | //虚拟的先用来调试界面 |
| | | /// <summary> |
| | | /// RGBW |
| | | /// </summary> |
| | | RGBW = 0x0102, |
| | | /// <summary> |
| | | /// CCT灯 |
| | | /// </summary> |
| | | CCT = 0x0103, |
| | | /// <summary> |
| | | /// 开合帘 |
| | | /// </summary> |
| | | TrietexCurtain = 0x0104, |
| | | /// <summary> |
| | | /// 卷帘 |
| | | /// </summary> |
| | | RollerCurtain = 0x0105, |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | public Function() |
| | | { |
| | | } |
| | | |
| | | |
| | | #region base info |
| | | /// <summary> |
| | |
| | | } |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 功能类型 |
| | | /// </summary> |
| | | ///// <summary> |
| | | ///// 功能类型 |
| | | ///// </summary> |
| | | public FunctionType functionType |
| | | { |
| | | get |
| | | { |
| | | var _functionTypeString = sid.Substring(16, 4); |
| | | return (FunctionType)Enum.ToObject(typeof(FunctionType), Convert.ToInt32(_functionTypeString, 16)); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | topView.setBtn.Visible = true; |
| | | topView.clickSetBtn.Visible = true; |
| | | } |
| | | topView.clickSetBtn.MouseUpEventHandler += (sender,e) => { |
| | | topView.clickSetBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | Set set = new Set(); |
| | | MainPage.BasePageView.AddChidren(set); |
| | | set.Show(); |
| | |
| | | |
| | | }; |
| | | |
| | | VerticalScrolViewLayout viewLayout = new VerticalScrolViewLayout |
| | | VerticalScrolViewLayout viewLayout = new VerticalScrolViewLayout |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Width = Application.GetRealWidth(LogicView.TextSize.view375), |
| | |
| | | LogicView.LogicTypeTitleView titleOutpu = new LogicView.LogicTypeTitleView(); |
| | | titleOutpu.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); |
| | | titleOutpu.btnText.TextID = StringId.theFollowingActions; |
| | | titleOutpu.btnNextIcon.Visible = false; |
| | | viewLayout.AddChidren(titleOutpu.FLayoutView()); |
| | | //目标处理方法 |
| | | InpOrOutLogicMethod.OutputTarget(this, viewLayout); |
| | |
| | | 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.GetMinRealAverage(36); |
| | | push.btnNextIcon.Height = Application.GetMinRealAverage(36); |
| | | push.btnNextIcon.X = Application.GetRealWidth(305); |
| | | push.btnNextIcon.UnSelectedImagePath = "LogicIcon/off.png"; |
| | | push.btnNextIcon.SelectedImagePath = "LogicIcon/on.png"; |
| | | viewLayout.AddChidren(push.FLayoutView()); |
| | | ///发送通知View |
| | | LogicView.LogicTypeTitleView notification = new LogicView.LogicTypeTitleView(); |
| | |
| | | this.AddChidren(saveView.FLayoutView()); |
| | | saveView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | if (string.IsNullOrEmpty(Logic.currlogic.sid)) |
| | | { |
| | | List<string> list = new List<string>(); |
| | | foreach (var logic in Logic.LogicList) |
| | | { |
| | | list.Add(logic.name); |
| | | } |
| | | new LogicView.TipPopView().InputBox(StringId.editName, Logic.currlogic.name, StringId.nameNull, StringId.NameAlreadyExists, list, (logicName) => |
| | | { |
| | | Logic.currlogic.name = logicName; |
| | | Logic.currlogic.sid = LogicMethod.NewSid(); |
| | | //发送新加修改逻辑命令; |
| | | var responsePackNew = Send.AddLogic(Logic.currlogic); |
| | | if (responsePackNew.Code == "0") |
| | | { |
| | | Logic.LogicList.Add(Logic.currlogic); |
| | | LogicMethod.RemoveAllView(); |
| | | MainView.MainShow(); |
| | | } |
| | | else { |
| | | new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail)); |
| | | } |
| | | |
| | | Logic.currlogic.sid = "000101000000000A0A0100CC1100"; |
| | | //Logic.currlogic.sid = LogicMethod.NewSid(); |
| | | //var f = Send.AddLogic(Logic.currlogic); |
| | | }); |
| | | |
| | | //var a = Send.getLogicIdList(); |
| | | |
| | | //var d = Send.getLogic(Logic.currlogic); |
| | | |
| | | // var c = Send.delLogic(Logic.currlogic); |
| | | |
| | | var e1= Send.switchLogic(Logic.currlogic); |
| | | |
| | | |
| | | |
| | | //if (string.IsNullOrEmpty(Logic.currlogic.sid)) |
| | | //{ |
| | | // List<string> list = new List<string>(); |
| | | // foreach (var logic in Logic.LogicList) |
| | | // { |
| | | // list.Add(logic.name); |
| | | // } |
| | | // new LogicView.TipPopView().InputBox(StringId.editName, Logic.currlogic.name, StringId.nameNull, StringId.NameAlreadyExists, list, (logicName) => |
| | | // { |
| | | // Logic.currlogic.name = logicName; |
| | | // Logic.currlogic.sid = LogicMethod.NewSid(); |
| | | // var responsePackNew = Send.AddLogic(Logic.currlogic); |
| | | // if (responsePackNew.Code == "0") |
| | | // { |
| | | // Logic.LogicList.Add(Logic.currlogic); |
| | | // LogicMethod.RemoveAllView(); |
| | | // MainView.MainShow(); |
| | | // } |
| | | // //发送新加修改逻辑命令; |
| | | |
| | | // }); |
| | | |
| | | //} |
| | | //else |
| | | //{ |
| | | // LogicMethod.RemoveAllView(); |
| | | // MainView.MainShow(); |
| | | // //发送新加修改逻辑命令; |
| | | //} |
| | | } |
| | | else |
| | | { |
| | | //发送新加修改逻辑命令; |
| | | var responsePackNew = Send.updateLogic(Logic.currlogic); |
| | | if (responsePackNew.Code == "0") |
| | | { |
| | | LogicMethod.RemoveAllView(); |
| | | MainView.MainShow(); |
| | | } |
| | | else { |
| | | new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail)); |
| | | } |
| | | } |
| | | |
| | | }; |
| | | #endregion |
| | |
| | | fLayout.RemoveFromParent(); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 满足条件 |
| | | /// </summary> |
New file |
| | |
| | | using System; |
| | | using Shared; |
| | | using System.Collections.Generic; |
| | | namespace HDL_ON.UI.UI2.Intelligence.Automation |
| | | { |
| | | public class ConditionDeviceFunList : FrameLayout |
| | | { |
| | | public ConditionDeviceFunList() |
| | | { |
| | | Tag = "Logic"; |
| | | } |
| | | /// <summary> |
| | | /// 定义一个记录选中设备状态列表; |
| | | /// </summary> |
| | | private List<Dictionary<string, string>> dicSateteList = new List<Dictionary<string, string>>(); |
| | | /// <summary> |
| | | /// 定义一个变量,记录选中状态 |
| | | /// </summary> |
| | | private string selectedState = "unknown"; |
| | | /// <summary> |
| | | /// 定义一个变量,记录选中状态记录属性 |
| | | /// </summary> |
| | | private string keyVlaue = ""; |
| | | public void Show(Entity.Function device, int index, bool edit) |
| | | { |
| | | #region 界面布局 |
| | | this.BackgroundColor = CSS.CSS_Color.viewMiddle; |
| | | LogicView.TopView topView = new LogicView.TopView(); |
| | | this.AddChidren(topView.FLayoutView()); |
| | | topView.clickBackBtn.MouseUpEventHandler += (e, sen) => |
| | | { |
| | | RemoveFromParent(); |
| | | }; |
| | | topView.topNameBtn.Text = device.name; |
| | | |
| | | FrameLayout fLayout = new FrameLayout |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Height = Application.GetRealHeight(667 - 64), |
| | | }; |
| | | this.AddChidren(fLayout); |
| | | #endregion |
| | | switch (device.functionType) |
| | | { |
| | | //开关灯光 light.Switch |
| | | case FunctionType.Dimmer: |
| | | case FunctionType.RGB: |
| | | case FunctionType.RGBW: |
| | | case FunctionType.CCT: |
| | | case FunctionType.Relay: |
| | | //窗帘 |
| | | case FunctionType.Curtain: |
| | | case FunctionType.RollerCurtain: |
| | | case FunctionType.TrietexCurtain: |
| | | //空调 |
| | | case FunctionType.AC: |
| | | //地热 |
| | | case FunctionType.FloorHeating: |
| | | { |
| | | LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView(); |
| | | lightSwitchView.btnText.TextID = StringId.switchLogic; |
| | | lightSwitchView.btnState.Text = ""; |
| | | fLayout.AddChidren(lightSwitchView.FLayoutView()); |
| | | lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | FrameLayout frame = new FrameLayout |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.viewTrans60lucence, |
| | | }; |
| | | this.AddChidren(frame); |
| | | SwitchViewMethod(frame, device, lightSwitchView.btnState, 2); |
| | | }; |
| | | if (edit) |
| | | { |
| | | GetEditState(device, index, lightSwitchView.btnState, null, null, null); |
| | | } |
| | | |
| | | } |
| | | break; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | #region 保存 |
| | | ///保存View |
| | | LogicView.SaveView saveView = new LogicView.SaveView(); |
| | | saveView.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); |
| | | saveView.btnSave.TextID = StringId.completeLogic; |
| | | this.AddChidren(saveView.FLayoutView()); |
| | | saveView.btnClick.MouseUpEventHandler += (sen, e) => |
| | | { |
| | | |
| | | |
| | | if (selectedState != "unknown") |
| | | { |
| | | Input inputDevice = new Input(); |
| | | inputDevice.condition_type = "3"; |
| | | inputDevice.sid = device.sid; |
| | | inputDevice.condition = dicSateteList; |
| | | if (edit) |
| | | { |
| | | //移除旧数据 |
| | | Logic.currlogic.input.RemoveAt(index); |
| | | //新数据插入旧数据的位置; |
| | | Logic.currlogic.input.Insert(index, inputDevice); |
| | | } |
| | | else |
| | | { |
| | | //添加一个条件 |
| | | AddCondition(inputDevice); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (!edit) |
| | | { |
| | | //提示用户 |
| | | return; |
| | | } |
| | | this.RemoveFromParent(); |
| | | return; |
| | | } |
| | | LogicMethod.RemoveAllView(); |
| | | AddLogic addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | |
| | | #endregion |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 移除控件 |
| | | /// </summary> |
| | | /// <param name="frame"></param> |
| | | private void RemView(FrameLayout frame) |
| | | { |
| | | frame.RemoveFromParent(); |
| | | } |
| | | /// <summary> |
| | | /// 显示编辑之前的设备状态 |
| | | /// </summary> |
| | | /// <param name="device">编辑设备</param> |
| | | /// <param name="index">编辑数据的索引</param> |
| | | /// <param name="button1">显示Btn</param> |
| | | /// <param name="button2">显示Btn</param> |
| | | /// <param name="button3">显示Btn</param> |
| | | /// <param name="button4">显示Btn</param> |
| | | private void GetEditState(Entity.Function device , int index, Button button1, Button button2, Button button3, Button button4) |
| | | { |
| | | Input inputs = Logic.currlogic.input[index]; |
| | | var dicList = inputs.condition as List<Dictionary<string, string>>; |
| | | //清除之前旧数据 |
| | | dicSateteList.Clear(); |
| | | if (dicList.Count != 0) |
| | | { |
| | | //有数据重新赋值 |
| | | dicSateteList = dicList; |
| | | } |
| | | switch (device.functionType) |
| | | { |
| | | //开关灯光 light.Switch |
| | | case FunctionType.Dimmer: |
| | | case FunctionType.RGB: |
| | | case FunctionType.RGBW: |
| | | case FunctionType.CCT: |
| | | case FunctionType.Relay: |
| | | //窗帘 |
| | | case FunctionType.Curtain: |
| | | case FunctionType.RollerCurtain: |
| | | case FunctionType.TrietexCurtain: |
| | | //空调 |
| | | case FunctionType.AC: |
| | | //地热 |
| | | case FunctionType.FloorHeating: |
| | | { |
| | | foreach (var dic in dicList) |
| | | { |
| | | string value = dic["value"]; |
| | | if (value == "on") |
| | | { |
| | | button1.Text = Language.StringByID(StringId.onLogic); |
| | | } |
| | | else |
| | | { |
| | | button1.Text = Language.StringByID(StringId.offLogic); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 添加选中数据 |
| | | /// </summary> |
| | | /// <param name="dicList">存储数据列表</param> |
| | | /// <param name="keyValue">识别设备</param> |
| | | /// <param name="dictionary">选中数据</param> |
| | | /// <returns></returns> |
| | | private void AddDictionaryData(List<Dictionary<string, string>> dicList, string keyValue, Dictionary<string, string> dictionary) |
| | | { |
| | | int indexValue = -1; |
| | | for (int i = 0; i < dicList.Count; i++) |
| | | { |
| | | var dic = dicList[i]; |
| | | if (dic.ContainsValue(keyValue)) |
| | | { |
| | | //判断是否存在 |
| | | indexValue = i; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (indexValue != -1) |
| | | { |
| | | //存在移除 |
| | | dicList.RemoveAt(indexValue); |
| | | //重新添加 |
| | | dicList.Insert(indexValue, dictionary); |
| | | } |
| | | else |
| | | { |
| | | //新添加 |
| | | dicList.Add(dictionary); |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 添加条件 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | private void AddCondition(Input input) |
| | | { |
| | | int indexValue = -1; |
| | | for (int i = 0; i < Logic.currlogic.input.Count; i++) |
| | | { |
| | | if (Logic.currlogic.input[i].sid == input.sid) |
| | | { |
| | | indexValue = i; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (indexValue != -1) |
| | | { |
| | | Logic.currlogic.input.RemoveAt(indexValue); |
| | | Logic.currlogic.input.Insert(indexValue, input); |
| | | } |
| | | else |
| | | { |
| | | Logic.currlogic.input.Add(input); |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 开关功能展开界面 |
| | | /// </summary> |
| | | /// <param name="frame"></param> |
| | | /// <param name="device"></param> |
| | | /// <param name="button"></param> |
| | | /// <param name="len"></param> |
| | | public void SwitchViewMethod(FrameLayout frame, Entity.Function device, Button button, int len) |
| | | { |
| | | |
| | | LogicView.SwitchView switchView = new LogicView.SwitchView(); |
| | | switchView.FLayoutView(frame, len); |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.dictionary(dic, "key", "on_off"); |
| | | LogicMethod.dictionary(dic, "comparator", "="); |
| | | LogicMethod.dictionary(dic, "data_type", "string"); |
| | | keyVlaue = "on_off"; |
| | | switchView.btnOn.MouseUpEventHandler += (sender2, e2) => |
| | | { |
| | | LogicMethod.dictionary(dic, "value", "on"); |
| | | button.TextID = StringId.onLogic; |
| | | selectedState = device.functionType + "_on"; |
| | | AddDictionaryData(dicSateteList, keyVlaue, dic); |
| | | RemView(frame); |
| | | }; |
| | | switchView.btnOff.MouseUpEventHandler += (sender3, e3) => |
| | | { |
| | | LogicMethod.dictionary(dic, "value", "off"); |
| | | button.TextID = StringId.offLogic; |
| | | selectedState = device.functionType + "_off"; |
| | | AddDictionaryData(dicSateteList, keyVlaue, dic); |
| | | RemView(frame); |
| | | }; |
| | | if (button.Text != "") |
| | | { |
| | | if (button.Text == switchView.btnOn.Text) |
| | | { |
| | | switchView.btnOn.TextColor = CSS.CSS_Color.textConfirmColor; |
| | | } |
| | | else if (button.Text == switchView.btnOff.Text) |
| | | { |
| | | switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | Y = Application.GetRealHeight(103), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(21 + 44), |
| | | BackgroundImagePath = "LogicIcon/bjicon.png", |
| | | //BackgroundImagePath = "LogicIcon/bjicon.png", |
| | | }; |
| | | fLayout.AddChidren(bghFrameLyout); |
| | | |
| | |
| | | { |
| | | bghFrameLyout.Height = Application.GetRealHeight(21 + 44 * 5); |
| | | bghFrameLyout.AddChidren(vvBgh); |
| | | |
| | | bghFrameLyout.BackgroundImagePath = "LogicIcon/bjicon5.png"; |
| | | } |
| | | else |
| | | { |
| | |
| | | bghFrameLyout.AddChidren(areaBgh); |
| | | bghFrameLyout.Height = Application.GetRealHeight(21 + 44 * roomList.Count); |
| | | areaBgh.Height = Application.GetRealHeight(44 * roomList.Count); |
| | | bghFrameLyout.BackgroundImagePath = $"LogicIcon/bjicon{roomList.Count+1}.png"; |
| | | } |
| | | #endregion |
| | | |
| | |
| | | |
| | | DeviceListView(vv, list); |
| | | }; |
| | | |
| | | if (roomList.Count-1==i) { |
| | | ///改变最后那条一个线的颜色,界面显示效果作用; |
| | | areaView.btnLine.BackgroundColor = CSS.CSS_Color.view; |
| | | } |
| | | } |
| | | }; |
| | | funAllAreaView.btnText1.MouseUpEventHandler += roomClick; |
| | |
| | | Y = Application.GetRealHeight(103), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(21 + 44), |
| | | BackgroundImagePath = "LogicIcon/bjicon.png", |
| | | //BackgroundImagePath = "LogicIcon/bjicon5.png", |
| | | }; |
| | | fLayout.AddChidren(bghFrameLyout); |
| | | |
| | |
| | | { |
| | | bghFrameLyout.Height = Application.GetRealHeight(21 + 44 * 5); |
| | | bghFrameLyout.AddChidren(vvBgh); |
| | | |
| | | bghFrameLyout.BackgroundImagePath = "LogicIcon/bjicon5.png"; |
| | | } |
| | | else |
| | | { |
| | | bghFrameLyout.AddChidren(areaBgh); |
| | | bghFrameLyout.Height = Application.GetRealHeight(21 + 44 * deviceTypeList.Count); |
| | | areaBgh.Height = Application.GetRealHeight(44 * deviceTypeList.Count); |
| | | bghFrameLyout.BackgroundImagePath = $"LogicIcon/bjicon{deviceTypeList.Count+1}.png"; |
| | | } |
| | | #endregion |
| | | |
| | |
| | | var lists = LogicMethod.GetShowDeviceList(typeFunctionList, functionList); |
| | | DeviceListView(vv, lists); |
| | | }; |
| | | |
| | | if (deviceTypeList.Count - 1 == i) |
| | | { |
| | | ///改变最后那条一个线的颜色,界面显示效果作用; |
| | | areaView.btnLine.BackgroundColor = CSS.CSS_Color.view; |
| | | } |
| | | } |
| | | }; |
| | | funAllAreaView.btnText2.MouseUpEventHandler += funClick; |
| | |
| | | funView.btnDeviceName.Text = dev.name; |
| | | funView.btnRoomName.Text = dev.GetRoomListName(); |
| | | funView.btnClick.MouseUpEventHandler += (sen,e) => { |
| | | DeviceFunList deviceFunList = new DeviceFunList(); |
| | | MainPage.BasePageView.AddChidren(deviceFunList); |
| | | deviceFunList.Show(dev,0,false,if_type); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | 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 { |
| | | TargetDeviceFunList targetDeviceFunList = new TargetDeviceFunList(); |
| | | MainPage.BasePageView.AddChidren(targetDeviceFunList); |
| | | targetDeviceFunList.Show(dev, 0, false); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | |
| | | }; |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="thisView">当前界面</param> |
| | | /// <param name="viewLayout">上下滑动控件</param> |
| | | public static void InputCondition(FrameLayout thisView,VerticalScrolViewLayout viewLayout) |
| | | public static void InputCondition(FrameLayout thisView, VerticalScrolViewLayout viewLayout) |
| | | { |
| | | for (int i = 0; i < Logic.currlogic.input.Count; i++) |
| | | { |
| | | Input inputCondition = Logic.currlogic.input[i]; |
| | | ///各种条件的View |
| | | LogicView.AddOutputInputView inputView = new LogicView.AddOutputInputView(); |
| | | viewLayout.AddChidren(inputView.FLayoutView()); |
| | | inputView.FLayoutView(viewLayout); |
| | | ///记录条件类型 |
| | | inputView.btnClick.Name = inputCondition.condition_type; |
| | | ///记录条件索引 |
| | |
| | | inputView.btnText.Text = Language.StringByID(StringId.hour) + ": " + value; |
| | | inputView.btnClick.AddTag("timepoint", value); |
| | | } |
| | | |
| | | } |
| | | break; |
| | | case "2": |
| | |
| | | //区别不同设备,显示不同设备状态 |
| | | switch (device.functionType) |
| | | { |
| | | //开关灯光 light.Switch |
| | | case FunctionType.Dimmer: |
| | | case FunctionType.RGB: |
| | | case FunctionType.RGBW: |
| | | case FunctionType.CCT: |
| | | case FunctionType.Relay: |
| | | //窗帘 |
| | | case FunctionType.Curtain: |
| | | case FunctionType.RollerCurtain: |
| | | case FunctionType.TrietexCurtain: |
| | | //空调 |
| | | case FunctionType.AC: |
| | | //地热 |
| | | case FunctionType.FloorHeating: |
| | | {//开关灯 |
| | | foreach (var dic in dicList) |
| | | { |
| | | |
| | | |
| | | string value = dic["value"]; |
| | | if (value == "on") |
| | | { |
| | |
| | | int indexVulae = int.Parse(inputView.btnClick.Tag.ToString()); |
| | | //标记编辑状态 |
| | | bool edit = true; |
| | | //表示是条件 |
| | | string if_type = LogicMethod.condition_if; |
| | | switch (button.Name) |
| | | { |
| | | case "1": |
| | |
| | | { |
| | | //用sid找到设备; |
| | | var device = LogicMethod.GetDevice(inputCondition.sid); |
| | | DeviceFunList deviceFunList = new DeviceFunList(); |
| | | ConditionDeviceFunList deviceFunList = new ConditionDeviceFunList(); |
| | | MainPage.BasePageView.AddChidren(deviceFunList); |
| | | deviceFunList.Show(device, indexVulae,edit, if_type); |
| | | deviceFunList.Show(device, indexVulae, edit); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | break; |
| | | |
| | | |
| | | |
| | | } |
| | | }; |
| | | ///删除控件 |
| | | inputView.btnDel.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | Logic.currlogic.input.Remove(inputCondition); |
| | | inputView.frameLayout.RemoveFromParent(); |
| | | }; |
| | | } |
| | | |
| | |
| | | Output outputTarget = Logic.currlogic.output[i]; |
| | | ///各种条件的View |
| | | LogicView.AddOutputInputView targetView = new LogicView.AddOutputInputView(); |
| | | viewLayout.AddChidren(targetView.FLayoutView()); |
| | | targetView.FLayoutView(viewLayout); |
| | | ///记录条件类型 |
| | | targetView.btnClick.Name = outputTarget.target_type; |
| | | ///记录条件索引 |
| | |
| | | targetView.btnText.Text = device.name; |
| | | //改变设备名称显示控件宽度 |
| | | targetView.btnText.Width = Application.GetRealWidth(80); |
| | | //第一个变量显示状态值 |
| | | string stateStr = ""; |
| | | //区别不同设备,显示不同设备状态 |
| | | switch (device.functionType) |
| | | { |
| | |
| | | string value = dic["value"]; |
| | | if (value == "on") |
| | | { |
| | | targetView.btnState.Text = Language.StringByID(StringId.onLogic); |
| | | stateStr = Language.StringByID(StringId.onLogic); |
| | | |
| | | } |
| | | else |
| | | { |
| | | targetView.btnState.Text = Language.StringByID(StringId.offLogic); |
| | | stateStr = Language.StringByID(StringId.offLogic); |
| | | } |
| | | } |
| | | targetView.btnState.Text = stateStr; |
| | | } |
| | | break; |
| | | case FunctionType.Dimmer: |
| | | { |
| | | bool _if = false; |
| | | foreach (var dic in dicList) |
| | | { |
| | | |
| | | if (dic["key"] == "on_off") |
| | | { |
| | | string value = dic["value"]; |
| | | if (value == "on") |
| | | { |
| | | targetView.btnState.Text = Language.StringByID(StringId.onLogic); |
| | | _if = false; |
| | | } |
| | | else |
| | | { |
| | | targetView.btnState.Text = Language.StringByID(StringId.offLogic); |
| | | _if = true; |
| | | } |
| | | } |
| | | |
| | | } |
| | | foreach (var dic in dicList) |
| | | { |
| | | if (dic["key"] == "brightness") |
| | | { |
| | | string value = dic["value"]; |
| | | if (!_if) |
| | | { |
| | | targetView.btnState.Text += value; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case FunctionType.Curtain: |
| | | {//开关灯 |
| | | foreach (var dic in dicList) |
| | | { |
| | | string value = dic["value"]; |
| | | switch (value) |
| | | { |
| | | case "on": |
| | | { |
| | | stateStr = Language.StringByID(StringId.onLogic); |
| | | } |
| | | break; |
| | | case "off": |
| | | { |
| | | stateStr = Language.StringByID(StringId.offLogic); |
| | | } |
| | | break; |
| | | case "stop": |
| | | { |
| | | stateStr = Language.StringByID(StringId.stop); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | targetView.btnState.Text = stateStr; |
| | | } |
| | | break; |
| | | } |
| | |
| | | int indexVulae = int.Parse(targetView.btnClick.Tag.ToString()); |
| | | //标记编辑状态 |
| | | bool edit = true; |
| | | //表示是目标 |
| | | string if_type = LogicMethod.target_if; |
| | | switch (button.Name) |
| | | { |
| | | case "1": |
| | | { |
| | | //用sid找到设备; |
| | | var device = LogicMethod.GetDevice(outputTarget.sid); |
| | | DeviceFunList deviceFunList = new DeviceFunList(); |
| | | TargetDeviceFunList deviceFunList = new TargetDeviceFunList(); |
| | | MainPage.BasePageView.AddChidren(deviceFunList); |
| | | deviceFunList.Show(device, indexVulae, edit, if_type); |
| | | deviceFunList.Show(device, indexVulae, edit); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | break; |
| | |
| | | break; |
| | | } |
| | | }; |
| | | ///删除控件 |
| | | targetView.btnDel.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | Logic.currlogic.output.Remove(outputTarget); |
| | | targetView.frameLayout.RemoveFromParent(); |
| | | }; |
| | | } |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | public class Logic |
| | | { |
| | | |
| | | /// <summary> |
| | | /// 逻辑列表 |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | public static Logic currlogic; |
| | | /// <summary> |
| | | /// 云端唯一id |
| | | /// </summary> |
| | | public string userLogicId = ""; |
| | | /// <summary> |
| | | /// 逻辑唯一标识 |
| | | /// </summary> |
| | | public string sid = ""; |
| | |
| | | } |
| | | return logicId; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 生成逻辑sid方法 |
| | | /// </summary> |
| | | //public static string NewSid() |
| | | //{ |
| | | // String sLogicid = ""; |
| | | // try |
| | | // { |
| | | // String sOidBeginsWith = "000101";//厂商 + 通讯方式 |
| | | // //生成4个byte时间戳 |
| | | // DateTime dt = DateTime.Now; |
| | | // long sTimeSp = GateWay.ConvertDateTimeLong(dt); |
| | | // string sTimeSpan = ""; |
| | | // GateWay.ConvertIntToByteArray(sTimeSp, ref sTimeSpan); |
| | | // if (sTimeSpan.Length != 8) return sLogicid; |
| | | // //间隔10毫秒 错开时间戳 |
| | | // HDLUDP.TimeBetwnNext(10); |
| | | // sLogicid = sOidBeginsWith + sTimeSpan; |
| | | // //1501 物模型为自动化, 0001 表示 1 号自动化功能 |
| | | // sLogicid += "15"; |
| | | // sLogicid += "1501"; |
| | | // //自动化号自增 |
| | | // int iTopSceneId = 1; |
| | | // if (myGateway.LogicResponse != null) |
| | | // { |
| | | // if (myGateway.LogicResponse.objects != null) |
| | | // { |
| | | // for (int i = 0; i < myGateway.LogicResponse.objects.Count; i++) |
| | | // { |
| | | // string ccc = myGateway.LogicResponse.objects[i].sid.Substring(myGateway.LogicResponse.objects[i].sid.Length - 8, 4); |
| | | // int iThisSceneId = Convert.ToInt16(myGateway.LogicResponse.objects[i].sid.Substring(myGateway.LogicResponse.objects[i].sid.Length - 8, 4), 16); |
| | | // if (iThisSceneId >= iTopSceneId) |
| | | // iTopSceneId = iThisSceneId + 1; |
| | | // } |
| | | // } |
| | | // } |
| | | // sLogicid += iTopSceneId.ToString("X4");//场景号 两个byte |
| | | // //大类小类没有用到 固定为0 |
| | | // sLogicid += "0000"; |
| | | // return sLogicid; |
| | | // } |
| | | // catch |
| | | // { |
| | | // return sLogicid; |
| | | // } |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// 封装Dictionary对象 |
| | | /// </summary> |
| | |
| | | /// <returns></returns> |
| | | public static List<HDL_ON.Entity.Function> GetGatewayDeviceList() |
| | | { |
| | | List<HDL_ON.Entity.Function> list = new List<Entity.Function>(); |
| | | for (int i=0;i<10;i++) { |
| | | HDL_ON.Entity.Function function = new Entity.Function(); |
| | | switch (i) { |
| | | case 0: { |
| | | function.sid = "1234560001212121020182"; |
| | | function.name ="灯光"; |
| | | list.Add(function); |
| | | } |
| | | break; |
| | | case 1: { |
| | | |
| | | function.sid = "1234560001212121030182"; |
| | | function.name = "窗帘"; |
| | | list.Add(function); |
| | | } break; |
| | | case 2: { |
| | | function.sid = "1234560001212121040182"; |
| | | function.name = "空调"; |
| | | list.Add(function); |
| | | } break; |
| | | case 3: |
| | | { |
| | | function.sid = "1234560001212121010282"; |
| | | function.name = "RGBW"; |
| | | list.Add(function); |
| | | } |
| | | break; |
| | | case 4: |
| | | { |
| | | |
| | | return HDL_ON.Entity.DB_ResidenceData.functionList.GetAllFunction(); |
| | | function.sid = "1234560001212121010382"; |
| | | function.name = "CCT灯"; |
| | | list.Add(function); |
| | | } |
| | | break; |
| | | case 5: |
| | | { |
| | | function.sid = "1234560001212121010482"; |
| | | function.name = "开合帘"; |
| | | list.Add(function); |
| | | } |
| | | break; |
| | | case 6: |
| | | { |
| | | function.sid = "1234560001212121010582"; |
| | | function.name = "卷帘"; |
| | | list.Add(function); |
| | | } |
| | | break; |
| | | case 7: |
| | | { |
| | | function.sid = "1234560001212121040282"; |
| | | function.name = "地热"; |
| | | list.Add(function); |
| | | } |
| | | break; |
| | | case 8: |
| | | { |
| | | function.sid = "1234560001212121020282"; |
| | | function.name = "调关"; |
| | | list.Add(function); |
| | | } |
| | | break; |
| | | case 9: |
| | | { |
| | | function.sid = "1234560001212121020482"; |
| | | function.name = "RGB"; |
| | | list.Add(function); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | return list; |
| | | //return HDL_ON.Entity.DB_ResidenceData.functionList.GetAllFunction(); |
| | | } |
| | | /// <summary> |
| | | /// 获取网关场景列表 |
| | |
| | | switch (functionType) |
| | | { |
| | | case FunctionType.Relay: |
| | | case FunctionType.RGB: |
| | | case FunctionType.RGBW: |
| | | case FunctionType.CCT: |
| | | case FunctionType.Dimmer: |
| | | { |
| | | strPath = "LogicIcon/lightloguc.png"; |
| | | } |
| | | break; |
| | | case FunctionType.Curtain: |
| | | case FunctionType.RollerCurtain: |
| | | case FunctionType.TrietexCurtain: |
| | | { |
| | | strPath = "LogicIcon/curtainlogic.png"; |
| | | } |
| | | break; |
| | | case FunctionType.AC: |
| | | { |
| | | strPath = "LogicIcon/airconditionerlogic.png"; |
| | | } |
| | | break; |
| | | case FunctionType.FloorHeating: |
| | | { |
| | | strPath = "LogicIcon/heatlogic.png"; |
| | | } |
| | | break; |
| | | |
| | |
| | | { |
| | | List<string> deviceStrTypeList = new List<string>(); |
| | | deviceStrTypeList.Clear(); |
| | | var lightjosn = deviceList.Find((device) => device.functionType == FunctionType.Relay || device.functionType == FunctionType.Dimmer); |
| | | var lightjosn = deviceList.Find((device) => device.functionType == FunctionType.Relay || device.functionType == FunctionType.Dimmer|| device.functionType == FunctionType.CCT || device.functionType == FunctionType.RGB|| device.functionType == FunctionType.RGBW); |
| | | if (lightjosn != null) |
| | | { |
| | | deviceStrTypeList.Add(Language.StringByID(StringId.Lights)); |
| | | } |
| | | |
| | | var curtainjosn = deviceList.Find((device) => device.functionType ==FunctionType.Curtain); |
| | | var curtainjosn = deviceList.Find((device) => device.functionType ==FunctionType.Curtain|| device.functionType == FunctionType.TrietexCurtain|| device.functionType == FunctionType.RollerCurtain); |
| | | if (curtainjosn != null) |
| | | { |
| | | deviceStrTypeList.Add(Language.StringByID(StringId.Curtain)); |
| | |
| | | if (ac != null) |
| | | { |
| | | deviceStrTypeList.Add(Language.StringByID(StringId.AC)); |
| | | } |
| | | var floorHeating = deviceList.Find((device) => device.functionType == FunctionType.FloorHeating); |
| | | if (ac != null) |
| | | { |
| | | deviceStrTypeList.Add(Language.StringByID(StringId.FloorHeating)); |
| | | } |
| | | return deviceStrTypeList; |
| | | |
| | |
| | | { |
| | | functionTypeList.Add(FunctionType.Relay); |
| | | functionTypeList.Add(FunctionType.Dimmer); |
| | | functionTypeList.Add(FunctionType.RGB); |
| | | functionTypeList.Add(FunctionType.RGBW); |
| | | functionTypeList.Add(FunctionType.CCT); |
| | | } |
| | | else if (deviceType == Language.StringByID(StringId.Curtain)) |
| | | { |
| | | functionTypeList.Add(FunctionType.Curtain); |
| | | functionTypeList.Add(FunctionType.RollerCurtain); |
| | | functionTypeList.Add(FunctionType.TrietexCurtain); |
| | | } |
| | | else if (deviceType == Language.StringByID(StringId.AC)) |
| | | { |
| | | functionTypeList.Add(FunctionType.AC); |
| | | } |
| | | else if (deviceType == Language.StringByID(StringId.FloorHeating)) |
| | | { |
| | | functionTypeList.Add(FunctionType.FloorHeating); |
| | | } |
| | | return functionTypeList; |
| | | |
| | |
| | | switch (if_type) { |
| | | case condition_if: { |
| | | deviceTypeList.Add(FunctionType.Relay); |
| | | deviceTypeList.Add(FunctionType.RGB); |
| | | deviceTypeList.Add(FunctionType.RGBW); |
| | | deviceTypeList.Add(FunctionType.Dimmer); |
| | | deviceTypeList.Add(FunctionType.CCT); |
| | | deviceTypeList.Add(FunctionType.Curtain); |
| | | deviceTypeList.Add(FunctionType.RollerCurtain); |
| | | deviceTypeList.Add(FunctionType.TrietexCurtain); |
| | | deviceTypeList.Add(FunctionType.AC); |
| | | deviceTypeList.Add(FunctionType.FloorHeating); |
| | | } |
| | | break; |
| | | case target_if: |
| | | { |
| | | deviceTypeList.Add(FunctionType.Relay); |
| | | deviceTypeList.Add(FunctionType.RGB); |
| | | deviceTypeList.Add(FunctionType.RGBW); |
| | | deviceTypeList.Add(FunctionType.Dimmer); |
| | | deviceTypeList.Add(FunctionType.CCT); |
| | | deviceTypeList.Add(FunctionType.Curtain); |
| | | deviceTypeList.Add(FunctionType.RollerCurtain); |
| | | deviceTypeList.Add(FunctionType.TrietexCurtain); |
| | | deviceTypeList.Add(FunctionType.AC); |
| | | deviceTypeList.Add(FunctionType.FloorHeating); |
| | | } |
| | | break; |
| | | } |
| | |
| | | /// <summary> |
| | | /// 主控件View |
| | | /// </summary> |
| | | public FrameLayout frameLayout = new FrameLayout |
| | | public FrameLayout frameLayout= new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(44), |
| | | Width = Application.GetRealWidth(343), |
| | | BackgroundColor= CSS.CSS_Color.view, |
| | | X = Application.GetRealWidth(LogicView.TextSize.left16), |
| | | }; |
| | | |
| | | /// <summary> |
| | | /// 主控件View |
| | | /// </summary> |
| | | public RowLayout rowLayout = new RowLayout |
| | | { |
| | | Height = Application.GetRealHeight(43), |
| | | Width = Application.GetRealWidth(343), |
| | | LineColor = CSS.CSS_Color.viewTranslucence, |
| | | SubViewWidth=Application.GetRealWidth(68), |
| | | }; |
| | | /// <summary> |
| | | /// (条件或者目标)图标 |
| | |
| | | BackgroundColor = CSS.CSS_Color.viewLine, |
| | | |
| | | }; |
| | | |
| | | public Button btnDel = new Button |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.textRedColor, |
| | | TextID = StringId.Del, |
| | | TextSize = LogicView.TextSize.text16, |
| | | TextColor = CSS.CSS_Color.view, |
| | | Gravity = Gravity.Center, |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | |
| | | public Button btnClick = new Button |
| | | { |
| | | Height = Application.GetRealHeight(44), |
| | |
| | | /// View的方法 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public FrameLayout FLayoutView() |
| | | public void FLayoutView(VerticalScrolViewLayout verticalScrolView) |
| | | { |
| | | verticalScrolView.AddChidren(frameLayout); |
| | | frameLayout.AddChidren(rowLayout); |
| | | btnIcon.Gravity = Gravity.CenterVertical; |
| | | btnText.Gravity = Gravity.CenterVertical; |
| | | btnText.TextAlignment = TextAlignment.CenterLeft; |
| | | btnNextIcon.Gravity = Gravity.CenterVertical; |
| | | frameLayout.AddChidren(btnIcon); |
| | | frameLayout.AddChidren(btnText); |
| | | frameLayout.AddChidren(btnState); |
| | | frameLayout.AddChidren(btnNextIcon); |
| | | rowLayout.AddChidren(btnIcon); |
| | | rowLayout.AddChidren(btnText); |
| | | rowLayout.AddChidren(btnState); |
| | | rowLayout.AddChidren(btnNextIcon); |
| | | rowLayout.AddRightView(btnDel); |
| | | rowLayout.AddChidren(btnClick); |
| | | btnLine.Y = frameLayout.Height - 1; |
| | | frameLayout.AddChidren(btnLine); |
| | | frameLayout.AddChidren(btnClick); |
| | | return frameLayout; |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using Shared; |
| | | namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView |
| | | { |
| | | public class FunTypeView |
| | | { |
| | | /// <summary> |
| | | /// 主控件View |
| | | /// </summary> |
| | | public FrameLayout frameLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | BackgroundColor = CSS.CSS_Color.view, |
| | | }; |
| | | |
| | | /// <summary> |
| | | /// 文本描述 |
| | | /// </summary> |
| | | public Button btnText = new Button |
| | | { |
| | | TextSize = TextSize.text16, |
| | | Width = Application.GetRealWidth(130), |
| | | Height = Application.GetRealHeight(22), |
| | | TextColor = CSS.CSS_Color.textColor, |
| | | //Y=Application.GetRealHeight(12), |
| | | X = Application.GetRealWidth(16), |
| | | Gravity = Gravity.CenterVertical, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | |
| | | /// <summary> |
| | | /// (条件或者目标)设备状态文本描述 |
| | | /// </summary> |
| | | public Button btnState = new Button |
| | | { |
| | | TextSize = TextSize.text12, |
| | | Width = Application.GetRealWidth(130), |
| | | Height = Application.GetRealHeight(17), |
| | | TextColor = CSS.CSS_Color.textCancelColor, |
| | | Y = Application.GetRealHeight(17), |
| | | X = Application.GetRealWidth(375 - 48 - 130), |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | Text="", |
| | | }; |
| | | /// <summary> |
| | | /// 图标 |
| | | /// </summary> |
| | | public Button btnNextIcon = new Button |
| | | { |
| | | Width = Application.GetMinRealAverage(16), |
| | | Height = Application.GetMinRealAverage(16), |
| | | UnSelectedImagePath = "LogicIcon/next.png", |
| | | X = Application.GetRealWidth(339), |
| | | }; |
| | | |
| | | /// <summary> |
| | | /// 线 |
| | | /// </summary> |
| | | public Button btnLine = new Button |
| | | { |
| | | Width = Application.GetRealWidth(343), |
| | | X = Application.GetRealWidth(16), |
| | | Height = 1, |
| | | BackgroundColor = CSS.CSS_Color.viewLine, |
| | | |
| | | }; |
| | | |
| | | public Button btnClick = new Button |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | }; |
| | | /// <summary> |
| | | /// View的方法 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public FrameLayout FLayoutView() |
| | | { |
| | | btnNextIcon.Gravity = Gravity.CenterVertical; |
| | | frameLayout.AddChidren(btnText); |
| | | frameLayout.AddChidren(btnState); |
| | | frameLayout.AddChidren(btnNextIcon); |
| | | btnLine.Y = frameLayout.Height - 1; |
| | | frameLayout.AddChidren(btnLine); |
| | | frameLayout.AddChidren(btnClick); |
| | | return frameLayout; |
| | | } |
| | | } |
| | | } |
| | |
| | | /// <returns></returns> |
| | | public FrameLayout FLayoutView() |
| | | { |
| | | btnText.TextAlignment = TextAlignment.BottomLeft; |
| | | btnText.TextAlignment = TextAlignment.CenterLeft; |
| | | btnNextIcon.Gravity = Gravity.CenterVertical; |
| | | frameLayout.AddChidren(btnText); |
| | | frameLayout.AddChidren(btnNextIcon); |
New file |
| | |
| | | using System; |
| | | using Shared; |
| | | using System.Collections.Generic; |
| | | namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView |
| | | { |
| | | public class ModeView |
| | | { |
| | | /// <summary> |
| | | /// 主控件View |
| | | /// </summary> |
| | | public FrameLayout frameLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | BackgroundColor = CSS.CSS_Color.view, |
| | | }; |
| | | |
| | | /// <summary> |
| | | /// 文本描述 |
| | | /// </summary> |
| | | public Button btnText = new Button |
| | | { |
| | | TextSize = TextSize.text14, |
| | | Width = Application.GetRealWidth(130), |
| | | Height = Application.GetRealHeight(20), |
| | | TextColor = CSS.CSS_Color.textColor, |
| | | X = Application.GetRealWidth(20), |
| | | Gravity = Gravity.CenterVertical, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | |
| | | /// <summary> |
| | | /// 图标 |
| | | /// </summary> |
| | | public Button btnClickIcon = new Button |
| | | { |
| | | X = Application.GetRealWidth(303), |
| | | Width = Application.GetMinRealAverage(28), |
| | | Height = Application.GetMinRealAverage(28), |
| | | UnSelectedImagePath = "LogicIcon/weekoff.png", |
| | | SelectedImagePath = "LogicIcon/weekon.png", |
| | | Gravity = Gravity.CenterVertical, |
| | | }; |
| | | |
| | | /// <summary> |
| | | /// 线 |
| | | /// </summary> |
| | | public Button btnLine = new Button |
| | | { |
| | | Width = Application.GetRealWidth(343), |
| | | X = Application.GetRealWidth(16), |
| | | Height = 1, |
| | | BackgroundColor = CSS.CSS_Color.viewLine, |
| | | |
| | | }; |
| | | |
| | | public Button btnClick = new Button |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | }; |
| | | /// <summary> |
| | | /// View的方法 |
| | | /// </summary> |
| | | /// <param name="fLayout"></param> |
| | | /// <param name="list"></param> |
| | | public void FLayoutView(FrameLayout fLayout, List<string> list) |
| | | { |
| | | /// 主控件 |
| | | FrameLayout frameLayout1 = new FrameLayout |
| | | { |
| | | Y = Application.GetRealHeight(460), |
| | | Height = Application.GetRealHeight(56 + 150), |
| | | Width = Application.GetRealWidth(343), |
| | | X = Application.GetRealWidth(16), |
| | | BackgroundColor = CSS.CSS_Color.view, |
| | | Radius = (uint)Application.GetRealHeight(12), |
| | | }; |
| | | /// 标题Btn |
| | | Button btnTitle = new Button |
| | | { |
| | | TextID = StringId.timeHorizon, |
| | | TextSize = TextSize.text16, |
| | | TextColor = CSS.CSS_Color.textColor, |
| | | IsBold = true, |
| | | Width = Application.GetRealWidth(343 - (52 + 4 + 10) * 2), |
| | | Height = Application.GetRealHeight(22), |
| | | Y = Application.GetRealHeight(17), |
| | | X = Application.GetRealWidth(52 + 4 + 10) |
| | | }; |
| | | /// 取消Btn |
| | | Button btnCancel = new Button |
| | | { |
| | | TextID = StringId.cancelSelected, |
| | | TextSize = TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textCancelColor, |
| | | Width = Application.GetRealWidth(52), |
| | | Height = Application.GetRealHeight(32), |
| | | Y = Application.GetRealHeight(10), |
| | | X = Application.GetRealWidth(4) |
| | | }; |
| | | /// 确定Btn |
| | | Button btnConfirm = new Button |
| | | { |
| | | TextID = StringId.confirmSelected, |
| | | TextSize = TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textConfirmColor, |
| | | Width = Application.GetRealWidth(52), |
| | | Height = Application.GetRealHeight(32), |
| | | X = Application.GetRealWidth(343 - 4 - 52), |
| | | Y = Application.GetRealHeight(10), |
| | | }; |
| | | fLayout.AddChidren(frameLayout); |
| | | frameLayout1.Y = Application.GetRealHeight(667 - 20 - 56 - 50 * list.Count); |
| | | frameLayout1.Height = Application.GetRealHeight(56 + 50 * list.Count); |
| | | frameLayout1.AddChidren(btnTitle); |
| | | frameLayout1.AddChidren(btnCancel); |
| | | frameLayout1.AddChidren(btnConfirm); |
| | | for (int j = 0; j < list.Count; j++) |
| | | { |
| | | frameLayout.Y = Application.GetRealHeight(56 + 50 * j); |
| | | frameLayout1.AddChidren(frameLayout); |
| | | frameLayout.AddChidren(btnText); |
| | | frameLayout.AddChidren(btnClickIcon); |
| | | btnLine.Y = frameLayout.Height - 1; |
| | | frameLayout.AddChidren(btnLine); |
| | | frameLayout.AddChidren(btnClick); |
| | | btnClick.Tag = list[j]; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | btnText.Gravity = Gravity.CenterVertical; |
| | | btnText.TextAlignment = TextAlignment.CenterLeft; |
| | | btnNextIcon.Gravity = Gravity.CenterVertical; |
| | | btnDeviceName.Gravity= Gravity.CenterVertical; |
| | | frameLayout.AddChidren(btnIcon); |
| | | frameLayout.AddChidren(btnText); |
| | | frameLayout.AddChidren(btnDeviceName); |
| | |
| | | public FrameLayout frameLayout = new FrameLayout |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Y = Application.GetRealHeight(12), |
| | | //Y = Application.GetRealHeight(12), |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(102), |
| | | BackgroundColor = CSS.CSS_Color.view, |
| | |
| | | BackgroundColor = CSS.CSS_Color.view, |
| | | Y = Application.GetRealHeight(515), |
| | | X = Application.GetRealWidth(16), |
| | | Height = Application.GetRealHeight(44*44), |
| | | Height = Application.GetRealHeight(44 * 44), |
| | | Width = Application.GetRealWidth(343), |
| | | Radius=(uint)Application.GetRealHeight(12) |
| | | Radius = (uint)Application.GetRealHeight(12) |
| | | }; |
| | | /// <summary> |
| | | /// 取消 |
| | |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = TextSize.text16, |
| | | TextColor = CSS.CSS_Color.textRedColor, |
| | | TextID=StringId.cancelSelected, |
| | | TextID = StringId.cancelSelected, |
| | | Y = Application.GetRealHeight(611), |
| | | X = Application.GetRealWidth(16), |
| | | Height = Application.GetRealHeight(44), |
| | |
| | | Radius = (uint)Application.GetRealHeight(12) |
| | | }; |
| | | /// <summary> |
| | | /// 开 |
| | | /// </summary> |
| | | public Button btnOn = new Button |
| | | { |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = LogicView.TextSize.text16, |
| | | TextColor = CSS.CSS_Color.textCancelColor, |
| | | TextID = StringId.onLogic, |
| | | Height = Application.GetRealHeight(44), |
| | | Width = Application.GetRealWidth(343), |
| | | |
| | | }; |
| | | /// <summary> |
| | | /// 线 |
| | | /// </summary> |
| | | public Button btnLine = new Button |
| | | { |
| | | Height = 1, |
| | | BackgroundColor = CSS.CSS_Color.viewLine, |
| | | Y = Application.GetRealHeight(43), |
| | | }; |
| | | /// <summary> |
| | | /// 关 |
| | | /// </summary> |
| | | public Button btnOff = new Button |
| | | { |
| | | Y = Application.GetRealHeight(44), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = LogicView.TextSize.text16, |
| | | TextColor = CSS.CSS_Color.textCancelColor, |
| | | TextID = StringId.offLogic, |
| | | Height = Application.GetRealHeight(44), |
| | | Width = Application.GetRealWidth(343), |
| | | }; |
| | | /// <summary> |
| | | /// 线1 |
| | | /// </summary> |
| | | public Button btnLine1 = new Button |
| | | { |
| | | Height = 1, |
| | | BackgroundColor = CSS.CSS_Color.viewLine, |
| | | Y = Application.GetRealHeight(43 + 44), |
| | | }; |
| | | /// <summary> |
| | | /// 暂停 |
| | | /// </summary> |
| | | public Button btnStop = new Button |
| | | { |
| | | Y = Application.GetRealHeight(44 + 44), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = LogicView.TextSize.text16, |
| | | TextColor = CSS.CSS_Color.textCancelColor, |
| | | TextID = StringId.stop, |
| | | Height = Application.GetRealHeight(44), |
| | | Width = Application.GetRealWidth(343), |
| | | }; |
| | | |
| | | /// <summary> |
| | | /// View的方法 |
| | | /// </summary> |
| | | /// <param name="frame">父控件</param> |
| | | /// <param name="i">显示View数量</param> |
| | | /// <param name="i">显示选择View数量</param> |
| | | /// <returns></returns> |
| | | public void FLayoutView(FrameLayout frame,int i) |
| | | public void FLayoutView(FrameLayout frame, int i) |
| | | { |
| | | frameLayout.Y = Application.GetRealHeight(603 - (44 * i)); |
| | | frameLayout.Height = Application.GetRealHeight(44 * i); |
| | | frame.AddChidren(frameLayout); |
| | | frame.AddChidren(btnCancel); |
| | | frameLayout.AddChidren(btnOn); |
| | | frameLayout.AddChidren(btnLine); |
| | | frameLayout.AddChidren(btnOff); |
| | | if (i > 2) |
| | | { |
| | | /// 判断是否要是显示"暂停"按钮 |
| | | frameLayout.AddChidren(btnLine1); |
| | | frameLayout.AddChidren(btnStop); |
| | | } |
| | | btnCancel.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | frame.RemoveFromParent(); |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Threading; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | |
| | |
| | | X = Application.GetRealWidth(35), |
| | | Height = Application.GetRealHeight(22), |
| | | Width = Application.GetRealWidth(200), |
| | | TextColor =CSS_Color.textConfirmColor, |
| | | TextColor = CSS_Color.textConfirmColor, |
| | | TextSize = TextSize.text16, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextID = titleId, |
| | |
| | | Width = Application.GetRealWidth(135), |
| | | Height = Application.GetRealHeight(44), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor =CSS_Color.textTipColor, |
| | | TextColor = CSS_Color.textTipColor, |
| | | TextSize = TextSize.text16, |
| | | TextID = StringId.cancelMusic, |
| | | Gravity = Gravity.BottomLeft, |
| | |
| | | X = Application.GetRealWidth(20), |
| | | Height = Application.GetRealHeight(22), |
| | | Width = Application.GetRealWidth(270 - 20 * 2), |
| | | TextColor =CSS_Color.textTipColor, |
| | | TextColor = CSS_Color.textTipColor, |
| | | TextSize = TextSize.text12, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextID = tipTxet, |
| | |
| | | Width = Application.GetRealWidth(135), |
| | | Height = Application.GetRealHeight(44), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor =CSS_Color.textTipColor, |
| | | TextColor = CSS_Color.textTipColor, |
| | | TextSize = TextSize.text16, |
| | | TextID = StringId.cancelMusic, |
| | | Gravity = Gravity.BottomLeft, |
| | |
| | | }; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 信息提示窗口,自动关闭 |
| | | /// </summary> |
| | | /// <param name="msg">提示错误文本</param> |
| | | public void FlashingBox(string msg) |
| | | { |
| | | new PublicAssmebly().TipMsgAutoClose(msg, false, 2000); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using Shared; |
| | | namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView |
| | | { |
| | | public class BrightnessView |
| | | { |
| | | /// <summary> |
| | | /// 主控件 |
| | | /// </summary> |
| | | public FrameLayout frameLayout = new FrameLayout |
| | | { |
| | | Y = Application.GetRealHeight(467), |
| | | Height = Application.GetRealHeight(56 + 124), |
| | | Width = Application.GetRealWidth(343), |
| | | X = Application.GetRealWidth(16), |
| | | BackgroundColor = CSS.CSS_Color.view, |
| | | Radius = (uint)Application.GetRealHeight(12), |
| | | }; |
| | | /// <summary> |
| | | /// 标题Btn |
| | | /// </summary> |
| | | public Button btnTitle = new Button |
| | | { |
| | | TextID = StringId.timeHorizon, |
| | | TextSize = TextSize.text16, |
| | | TextColor = CSS.CSS_Color.textColor, |
| | | IsBold = true, |
| | | Width = Application.GetRealWidth(343 - (52 + 4 + 10) * 2), |
| | | Height = Application.GetRealHeight(22), |
| | | Y = Application.GetRealHeight(17), |
| | | X = Application.GetRealWidth(52 + 4 + 10) |
| | | }; |
| | | /// <summary> |
| | | /// 取消Btn |
| | | /// </summary> |
| | | public Button btnCancel = new Button |
| | | { |
| | | TextID = StringId.cancelSelected, |
| | | TextSize = TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textCancelColor, |
| | | Width = Application.GetRealWidth(52), |
| | | Height = Application.GetRealHeight(32), |
| | | Y = Application.GetRealHeight(10), |
| | | X = Application.GetRealWidth(4) |
| | | }; |
| | | /// <summary> |
| | | /// 确定Btn |
| | | /// </summary> |
| | | public Button btnConfirm = new Button |
| | | { |
| | | TextID = StringId.confirmSelected, |
| | | TextSize = TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textConfirmColor, |
| | | Width = Application.GetRealWidth(52), |
| | | Height = Application.GetRealHeight(32), |
| | | X = Application.GetRealWidth(343 - 4 - 52), |
| | | Y = Application.GetRealHeight(10), |
| | | }; |
| | | /// <summary> |
| | | /// 图标- |
| | | /// </summary> |
| | | public Button btn_subtract = new Button |
| | | { |
| | | Width = Application.GetMinRealAverage(24), |
| | | Height = Application.GetMinRealAverage(24), |
| | | X = Application.GetRealWidth(26), |
| | | Y = Application.GetRealHeight(118), |
| | | UnSelectedImagePath = "LogicIcon/-.png", |
| | | }; |
| | | /// <summary> |
| | | /// 图标-扩大热键 |
| | | /// </summary> |
| | | public Button btn_subtract_click = new Button |
| | | { |
| | | Width = Application.GetMinRealAverage(24+20), |
| | | Height = Application.GetMinRealAverage(24), |
| | | X = Application.GetRealWidth(26-20), |
| | | Y = Application.GetRealHeight(118), |
| | | |
| | | }; |
| | | public DiyImageSeekBar seekBarVol = new DiyImageSeekBar |
| | | { |
| | | Y = Application.GetRealHeight(103),//进度条父控件Y坐标 |
| | | X = Application.GetRealWidth(62-10),//进度条X坐标 |
| | | SeekBarPadding=Application.GetRealHeight(10),//进度条实际长度=244-10*2(内边距); |
| | | Width = Application.GetRealWidth(240),//进度条的长度 |
| | | Height = Application.GetRealHeight(54),//进度条父控件高度 |
| | | IsProgressTextShow = true,//显示百分比 |
| | | IsClickable = true,//进度条是否滑动 |
| | | ProgressBarColor =CSS.CSS_Color.textConfirmColor,//选中进度条颜色 |
| | | ThumbImagePath = "LogicIcon/point.png",//进度条按钮图标 |
| | | ThumbImageHeight = Application.GetRealHeight(54),//进度条按钮图标的高度(默认正方形:宽和高一样) |
| | | ProgressTextColor = CSS.CSS_Color.textColor, |
| | | ProgressTextSize = 10,//显示百分比字体大小 |
| | | SeekBarViewHeight = Application.GetRealHeight(8),//进度条的高度 |
| | | }; |
| | | /// <summary> |
| | | /// 图标+ |
| | | /// </summary> |
| | | public Button btn_add = new Button |
| | | { |
| | | Width = Application.GetMinRealAverage(24), |
| | | Height = Application.GetMinRealAverage(24), |
| | | X = Application.GetRealWidth(294), |
| | | Y = Application.GetRealHeight(118), |
| | | UnSelectedImagePath = "LogicIcon/+.png", |
| | | |
| | | }; |
| | | /// <summary> |
| | | /// 图标+扩大热键 |
| | | /// </summary> |
| | | public Button btn_add_click = new Button |
| | | { |
| | | Width = Application.GetMinRealAverage(24+20), |
| | | Height = Application.GetMinRealAverage(24), |
| | | X = Application.GetRealWidth(294), |
| | | Y = Application.GetRealHeight(118), |
| | | }; |
| | | /// <summary> |
| | | /// View的方法 |
| | | /// </summary> |
| | | /// <param name="fLayout"></param> |
| | | public void FLayoutView(FrameLayout fLayout) |
| | | { |
| | | fLayout.AddChidren(frameLayout); |
| | | frameLayout.AddChidren(btnTitle); |
| | | frameLayout.AddChidren(btnCancel); |
| | | frameLayout.AddChidren(btnConfirm); |
| | | frameLayout.AddChidren(btn_subtract); |
| | | frameLayout.AddChidren(btn_subtract_click); |
| | | frameLayout.AddChidren(seekBarVol); |
| | | frameLayout.AddChidren(btn_add); |
| | | frameLayout.AddChidren(btn_add_click); |
| | | //取消点击事件 |
| | | btnCancel.MouseUpEventHandler += (sender, e1) => |
| | | { |
| | | //移除fLayout界面 |
| | | fLayout.RemoveFromParent(); |
| | | }; |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | using HDL_ON.UI.UI2.Intelligence.Automation.LogicView; |
| | | using Shared; |
| | | using System.Collections.Generic; |
| | | using Newtonsoft.Json.Linq; |
| | | |
| | | namespace HDL_ON.UI.UI2.Intelligence.Automation |
| | | { |
| | | public class MainView |
| | |
| | | public static void MainShow() |
| | | { |
| | | automationPage.RemoveAll(); |
| | | VerticalScrolViewLayout vv = new VerticalScrolViewLayout(); |
| | | VerticalRefreshLayout vv = new VerticalRefreshLayout(); |
| | | vv.Height = Application.GetRealHeight(667 - 64 - 49);//模拟高度 |
| | | automationPage.AddChidren(vv); |
| | | |
| | | vv.BeginHeaderRefreshingAction += () => |
| | | { |
| | | //清除之前自动化列表; |
| | | Logic.LogicList.Clear(); |
| | | //获取自动列表 |
| | | GetLogicList(); |
| | | //刷新自动化界面 |
| | | MainShow(); |
| | | //关闭刷新View; |
| | | vv.EndHeaderRefreshing(); |
| | | }; |
| | | //获取自动化列表 |
| | | GetLogicList(); |
| | | // for (int i = Logic.LogicList.Count-1; i >= 0; i--)降序排列 |
| | | for (int i = 0; i < Logic.LogicList.Count; i++) |
| | | { |
| | | var currLogic = Logic.LogicList[i]; |
| | |
| | | if (logicView.btnSwitchIcon.IsSelected) |
| | | { |
| | | logicView.btnSwitchIcon.IsSelected = true; |
| | | currLogic.enable = "true"; |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | | logicView.btnSwitchIcon.IsSelected = false; |
| | | currLogic.enable = "false"; |
| | | } |
| | | Send.switchLogic(currLogic); |
| | | |
| | | }; |
| | | //if (i==0)降序排列 |
| | | if (Logic.LogicList.Count - 1 == i) |
| | | { |
| | | ///最后一个距离最底部12,界面显示效果作用; |
| | | vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) }); |
| | | } |
| | | if (currLogic.enable == "true") |
| | | { |
| | | logicView.btnSwitchIcon.IsSelected = true; |
| | |
| | | } |
| | | return monTextName.TrimEnd(','); |
| | | } |
| | | /// <summary> |
| | | /// 获取逻辑列表 |
| | | /// </summary> |
| | | private static void GetLogicList() |
| | | { |
| | | |
| | | if (Logic.LogicList.Count != 0) |
| | | { |
| | | //自动化列表为0才去获取自动化列表; |
| | | return; |
| | | } |
| | | List<string> logicIdList = new List<string>(); |
| | | //获取逻辑ID列表 |
| | | var idStr = Send.getLogicIdList(); |
| | | if (idStr.Code == "0" && idStr.Data != null) |
| | | { |
| | | var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data); |
| | | var dateList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Date>>(date); |
| | | for (int i = 0; i < dateList.Count; i++) |
| | | { |
| | | //添加逻辑ID |
| | | logicIdList.Add(dateList[i].userLogicId); |
| | | } |
| | | } |
| | | //获取自动化列表 |
| | | var logicStr = Send.getLogic(logicIdList); |
| | | if (logicStr.Code == "0" && logicStr.Data != null) |
| | | { |
| | | //获取逻辑详细返回是一个数组(object类型转换为数组); |
| | | var jArray = JArray.Parse(logicStr.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 != null) |
| | | { |
| | | //查找是否已经存在该逻辑 |
| | | var if_logic = Logic.LogicList.Find((c) => c.userLogicId == logic.userLogicId); |
| | | if (if_logic == null) |
| | | { |
| | | //添加逻辑 |
| | | Logic.LogicList.Add(logic); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 判断JObject对象是存在健值 |
| | | /// </summary> |
| | | /// <param name="jObject"></param> |
| | | /// <param name="key"></param> |
| | | /// <returns></returns> |
| | | private bool Exist(JObject jObject, string key) |
| | | { |
| | | |
| | | if (jObject.Property(key) != null) |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | class Date |
| | | { |
| | | /// <summary> |
| | | /// 云端唯一id |
| | | /// </summary> |
| | | public string userLogicId = ""; |
| | | public string gatewayId = ""; |
| | | /// <summary> |
| | | /// 逻辑唯一标识 |
| | | /// </summary> |
| | | public string sid = ""; |
| | | public string name = ""; |
| | | public string enable = ""; |
| | | //public CycleA cycle; |
| | | //public string modifyTime = ""; |
| | | } |
| | | |
| | | class CycleA |
| | | { |
| | | public string type = ""; |
| | | public string[] value; |
| | | } |
| | | } |
| | |
| | | |
| | | namespace HDL_ON.UI.UI2.Intelligence.Automation |
| | | { |
| | | public class Send |
| | | public class Send |
| | | { |
| | | ///// <summary> |
| | | ///// 住宅ID |
| | |
| | | /// <summary> |
| | | /// 住宅ID |
| | | /// </summary> |
| | | public static string homeId = "1333681497069043713"; |
| | | public static string homeId = "1333723044544233473"; |
| | | /// <summary> |
| | | /// 网关ID |
| | | /// </summary> |
| | | public static string gatewayId = "1333682616549752834"; |
| | | public static string gatewayId = "1333723647223775233"; |
| | | |
| | | /// <summary> |
| | | /// 获取逻辑ID列表 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 获取逻辑 |
| | | /// </summary> |
| | | /// <param name="listIdList">逻辑ID列表</param> |
| | | /// <returns></returns> |
| | | public static ResponsePackNew getLogic(Logic logic) |
| | | public static ResponsePackNew getLogic(List<string> listIdList) |
| | | { |
| | | var jArray = new JArray { }; |
| | | jArray.Add(logic.sid); |
| | | for (int i = 0; i < listIdList.Count; i++) |
| | | { |
| | | jArray.Add(listIdList[i]); |
| | | } |
| | | var jObject = new JObject { { "userLogicIds", jArray } }; |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Info); |
| | | return responsePackNew; |
| | |
| | | |
| | | return responsePackNew; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 编辑更新逻辑 |
| | | /// </summary> |
| | |
| | | |
| | | var logicjArray = new JArray { }; |
| | | var logicIfon = new JObject { }; |
| | | logicIfon.Add("userLogicId", logic.userLogicId); |
| | | logicIfon.Add("sid", logic.sid); |
| | | logicIfon.Add("gatewayId", gatewayId); |
| | | logicIfon.Add("name", logic.name); |
| | |
| | | public static ResponsePackNew delLogic(Logic logic) |
| | | { |
| | | var jArray = new JArray { }; |
| | | jArray.Add(logic.sid); |
| | | jArray.Add(logic.userLogicId); |
| | | var jObject = new JObject { { "userLogicIds", jArray } }; |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Delete); |
| | | return responsePackNew; |
| | |
| | | /// <returns></returns> |
| | | public static ResponsePackNew switchLogic(Logic logic) |
| | | { |
| | | logic.enable ="false"; |
| | | var jArray = new JArray { }; |
| | | var job = new JObject { { "userLogicId", logic.sid } , { "enable", logic.enable } }; |
| | | var job = new JObject { { "userLogicId", logic.userLogicId } , { "enable", logic.enable } }; |
| | | jArray.Add(job); |
| | | var jObject = new JObject { { "logics", jArray } }; |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Enable); |
| | |
| | | return HttpUtil.RequestHttpsPostFroHome(api_Url, requestJson, mTimeout); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 请求服务器 |
| | | /// </summary> |
| | |
| | | |
| | | new LogicView.TipPopView().TipBox(StringId.tip, StringId.delAutomation, () => |
| | | { |
| | | LogicMethod.RemoveAllView(); |
| | | Logic.LogicList.Remove(Logic.currlogic); |
| | | MainView.MainShow(); |
| | | //发送删除逻辑命令; |
| | | var responsePackNew= Send.delLogic(Logic.currlogic); |
| | | if (responsePackNew.Code == "0") |
| | | { |
| | | LogicMethod.RemoveAllView(); |
| | | Logic.LogicList.Remove(Logic.currlogic); |
| | | MainView.MainShow(); |
| | | //发送删除逻辑命令; |
| | | } |
| | | else |
| | | { |
| | | new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.delFail)); |
| | | } |
| | | }); |
| | | |
| | | }; |
New file |
| | |
| | | using System; |
| | | using Shared; |
| | | using System.Collections.Generic; |
| | | namespace HDL_ON.UI.UI2.Intelligence.Automation |
| | | { |
| | | public class TargetDeviceFunList : FrameLayout |
| | | { |
| | | public TargetDeviceFunList() |
| | | { |
| | | Tag = "Logic"; |
| | | } |
| | | /// <summary> |
| | | /// 定义一个记录选中设备状态列表; |
| | | /// </summary> |
| | | private List<Dictionary<string, string>> dicSateteList = new List<Dictionary<string, string>>(); |
| | | /// <summary> |
| | | /// 定义一个变量,记录选中状态 |
| | | /// </summary> |
| | | private string selectedState = "unknown"; |
| | | public void Show(Entity.Function device, int index, bool edit) |
| | | { |
| | | #region 界面布局 |
| | | this.BackgroundColor = CSS.CSS_Color.viewMiddle; |
| | | LogicView.TopView topView = new LogicView.TopView(); |
| | | this.AddChidren(topView.FLayoutView()); |
| | | topView.clickBackBtn.MouseUpEventHandler += (e, sen) => |
| | | { |
| | | RemoveFromParent(); |
| | | }; |
| | | topView.topNameBtn.Text = device.name; |
| | | |
| | | FrameLayout fLayout = new FrameLayout |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Height = Application.GetRealHeight(667 - 64), |
| | | }; |
| | | this.AddChidren(fLayout); |
| | | |
| | | ///保存View |
| | | LogicView.SaveView saveView = new LogicView.SaveView(); |
| | | saveView.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); |
| | | saveView.btnSave.TextID = StringId.completeLogic; |
| | | this.AddChidren(saveView.FLayoutView()); |
| | | #endregion |
| | | #region 编辑设备状态 |
| | | switch (device.functionType) |
| | | { |
| | | //开关灯光 light.Switch |
| | | case FunctionType.Dimmer: |
| | | case FunctionType.RGB: |
| | | case FunctionType.RGBW: |
| | | case FunctionType.CCT: |
| | | { |
| | | //2表示(开,关)功能 |
| | | SwitchBrightnessView(fLayout, device, index, edit,2); |
| | | } |
| | | break; |
| | | case FunctionType.Relay: |
| | | { |
| | | //2表示(开,关)功能 |
| | | SwitchView(fLayout, device, index, edit, 2); |
| | | } |
| | | break; |
| | | //窗帘 |
| | | case FunctionType.Curtain: |
| | | { |
| | | //3表示(开,关,暂停)功能 |
| | | SwitchView(fLayout, device, index, edit, 3); |
| | | } |
| | | break; |
| | | case FunctionType.TrietexCurtain: |
| | | case FunctionType.RollerCurtain: |
| | | { |
| | | //3表示(开,关,暂停)功能 |
| | | SwitchBrightnessView(fLayout, device, index, edit, 3); |
| | | } |
| | | break; |
| | | case FunctionType.AC: { |
| | | #region 界面 |
| | | ///开关 |
| | | LogicView.FunTypeView curtainSwitchView = new LogicView.FunTypeView(); |
| | | curtainSwitchView.btnText.TextID = StringId.switchLogic; |
| | | fLayout.AddChidren(curtainSwitchView.FLayoutView()); |
| | | #endregion |
| | | #region 点击事件 |
| | | ///开关点击事件 |
| | | curtainSwitchView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | SwitchViewMethod(device, curtainSwitchView.btnState, 2); |
| | | }; |
| | | if (edit) |
| | | { |
| | | GetEditState(device, index, curtainSwitchView.btnState, null, null, null); |
| | | } |
| | | #endregion |
| | | } |
| | | break; |
| | | |
| | | } |
| | | #endregion |
| | | #region 保存点击时间 |
| | | saveView.btnClick.MouseUpEventHandler += (sen, e) => |
| | | { |
| | | |
| | | |
| | | if (selectedState != "unknown") |
| | | { |
| | | Output outputDevice = new Output(); |
| | | outputDevice.target_type = "1"; |
| | | outputDevice.sid = device.sid; |
| | | outputDevice.status = dicSateteList; |
| | | if (edit) |
| | | { |
| | | //移除旧数据 |
| | | Logic.currlogic.output.RemoveAt(index); |
| | | //新数据插入旧数据的位置; |
| | | Logic.currlogic.output.Insert(index, outputDevice); |
| | | } |
| | | else |
| | | { |
| | | //添加一个条件 |
| | | AddTarget(outputDevice); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (!edit) |
| | | { |
| | | //提示用户 |
| | | return; |
| | | } |
| | | this.RemoveFromParent(); |
| | | return; |
| | | } |
| | | LogicMethod.RemoveAllView(); |
| | | AddLogic addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | #endregion |
| | | |
| | | } |
| | | /// <summary> |
| | | ///开关=界面 |
| | | /// </summary> |
| | | /// <param name="fLayout"></param> |
| | | /// <param name="device"></param> |
| | | /// <param name="index"></param> |
| | | /// <param name="edit"></param> |
| | | /// <param name="intView">选中View的数量</param> |
| | | private void SwitchView(FrameLayout fLayout, Entity.Function device, int index, bool edit,int intView) |
| | | { |
| | | #region 界面 |
| | | ///开关 |
| | | LogicView.FunTypeView curtainSwitchView = new LogicView.FunTypeView(); |
| | | curtainSwitchView.btnText.TextID = StringId.switchLogic; |
| | | fLayout.AddChidren(curtainSwitchView.FLayoutView()); |
| | | #endregion |
| | | #region 点击事件 |
| | | ///开关点击事件 |
| | | curtainSwitchView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | SwitchViewMethod(device, curtainSwitchView.btnState, intView); |
| | | }; |
| | | if (edit) |
| | | { |
| | | GetEditState(device, index, curtainSwitchView.btnState, null, null, null); |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | /// <summary> |
| | | ///(开关+亮度/百分比)界面 |
| | | /// </summary> |
| | | /// <param name="fLayout"></param> |
| | | /// <param name="device"></param> |
| | | /// <param name="index"></param> |
| | | /// <param name="edit"></param> |
| | | /// <param name="intView">选中View的数量</param> |
| | | private void SwitchBrightnessView(FrameLayout fLayout, Entity.Function device, int index, bool edit,int intView) |
| | | { |
| | | #region 界面 |
| | | ///开关 |
| | | LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView(); |
| | | lightSwitchView.btnText.TextID = StringId.switchLogic; |
| | | fLayout.AddChidren(lightSwitchView.FLayoutView()); |
| | | ///亮度 |
| | | LogicView.FunTypeView brightnessView = new LogicView.FunTypeView(); |
| | | brightnessView.frameLayout.Y = lightSwitchView.frameLayout.Bottom; |
| | | if (device.functionType == FunctionType.TrietexCurtain || device.functionType == FunctionType.RollerCurtain) |
| | | { |
| | | |
| | | brightnessView.btnText.TextID = StringId.percentum; |
| | | } |
| | | else |
| | | { |
| | | brightnessView.btnText.TextID = StringId.brightnesLogic; |
| | | } |
| | | fLayout.AddChidren(brightnessView.FLayoutView()); |
| | | #endregion |
| | | #region 点击事件 |
| | | ///开关点击事件 |
| | | lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | SwitchViewMethod(device, lightSwitchView.btnState, intView); |
| | | }; |
| | | ///亮度点击事件 |
| | | brightnessView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | BrightnessMethod(device, brightnessView.btnState, brightnessView.btnText.Text); |
| | | }; |
| | | if (edit) |
| | | { |
| | | GetEditState(device, index, lightSwitchView.btnState, brightnessView.btnState, null, null); |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 开关=功能下一级界面 |
| | | /// </summary> |
| | | /// <param name="device"></param> |
| | | /// <param name="button"></param> |
| | | /// <param name="len">显示选择View数量</param> |
| | | private void SwitchViewMethod(Entity.Function device, Button button, int len) |
| | | { |
| | | #region 界面 |
| | | FrameLayout frame = new FrameLayout |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.viewTrans60lucence, |
| | | }; |
| | | this.AddChidren(frame); |
| | | LogicView.SwitchView switchView = new LogicView.SwitchView(); |
| | | switchView.FLayoutView(frame, len); |
| | | #endregion |
| | | |
| | | #region 点击事件 |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.dictionary(dic, "key", "on_off"); |
| | | string keyVlaue = "on_off"; |
| | | //开-点击事件 |
| | | switchView.btnOn.MouseUpEventHandler += (sender2, e2) => |
| | | { |
| | | LogicMethod.dictionary(dic, "value", "on"); |
| | | button.TextID = StringId.onLogic; |
| | | selectedState = device.functionType + "_on"; |
| | | AddDictionaryData(dicSateteList, keyVlaue, dic); |
| | | RemView(frame); |
| | | }; |
| | | //关-点击事件 |
| | | switchView.btnOff.MouseUpEventHandler += (sender3, e3) => |
| | | { |
| | | LogicMethod.dictionary(dic, "value", "off"); |
| | | button.TextID = StringId.offLogic; |
| | | selectedState = device.functionType + "_off"; |
| | | AddDictionaryData(dicSateteList, keyVlaue, dic); |
| | | RemView(frame); |
| | | |
| | | }; |
| | | //暂停-点击事件 |
| | | switchView.btnStop.MouseUpEventHandler += (sender3, e3) => |
| | | { |
| | | LogicMethod.dictionary(dic, "value", "stop"); |
| | | button.TextID = StringId.stop; |
| | | selectedState = device.functionType + "_stop"; |
| | | AddDictionaryData(dicSateteList, keyVlaue, dic); |
| | | RemView(frame); |
| | | |
| | | }; |
| | | ///显示之前状态 |
| | | if (button.Text != "") |
| | | { |
| | | if (button.Text == switchView.btnOn.Text) |
| | | { |
| | | switchView.btnOn.TextColor = CSS.CSS_Color.textConfirmColor; |
| | | } |
| | | else if (button.Text == switchView.btnOff.Text) |
| | | { |
| | | switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor; |
| | | } |
| | | else if (button.Text == switchView.btnStop.Text) |
| | | { |
| | | switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 亮度/百分比=功能下一级界面 |
| | | /// </summary> |
| | | /// <param name="device"></param> |
| | | /// <param name="button"></param> |
| | | private void BrightnessMethod(Entity.Function device, Button button, string titleName) |
| | | { |
| | | #region 界面 |
| | | FrameLayout frame = new FrameLayout |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.viewTrans60lucence, |
| | | }; |
| | | this.AddChidren(frame); |
| | | LogicView.BrightnessView brightness = new LogicView.BrightnessView(); |
| | | brightness.btnTitle.Text = titleName; |
| | | brightness.FLayoutView(frame); |
| | | #endregion |
| | | #region 点击事件 |
| | | int brightnesValue = 0; |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.dictionary(dic, "key", "brightness"); |
| | | string keyVlaue = "brightness"; |
| | | //—点击事件 |
| | | brightness.btn_subtract_click.MouseUpEventHandler += (sender2, e2) => |
| | | { |
| | | if (brightnesValue > 0) |
| | | { |
| | | brightnesValue -= 1; |
| | | brightness.seekBarVol.Progress = brightnesValue; |
| | | } |
| | | }; |
| | | //+点击事件 |
| | | brightness.btn_add_click.MouseUpEventHandler += (sende2, e2) => |
| | | { |
| | | if (brightnesValue < 100) |
| | | { |
| | | brightnesValue += 1; |
| | | brightness.seekBarVol.Progress = brightnesValue; |
| | | |
| | | } |
| | | }; |
| | | //进度条滑动点击事件 |
| | | EventHandler<int> progressclick = (sender2, e2) => |
| | | { |
| | | brightnesValue = brightness.seekBarVol.Progress; |
| | | }; |
| | | brightness.seekBarVol.OnProgressChangedEvent += progressclick; |
| | | brightness.seekBarVol.OnStopTrackingTouchEvent += progressclick; |
| | | //确定点击事件 |
| | | brightness.btnConfirm.MouseUpEventHandler += (sende2, e2) => |
| | | { |
| | | if (brightnesValue == 0) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | LogicMethod.dictionary(dic, "value", brightnesValue.ToString()); |
| | | selectedState = device.functionType + brightnesValue.ToString(); |
| | | AddDictionaryData(dicSateteList, keyVlaue, dic); |
| | | button.Text = brightnesValue.ToString(); |
| | | RemView(frame); |
| | | |
| | | }; |
| | | //显示之前状态 |
| | | if (button.Text != "") |
| | | { |
| | | brightnesValue = int.Parse(button.Text); |
| | | brightness.seekBarVol.Progress = brightnesValue; |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 移除控件 |
| | | /// </summary> |
| | | /// <param name="frame"></param> |
| | | private void RemView(FrameLayout frame) |
| | | { |
| | | frame.RemoveFromParent(); |
| | | } |
| | | /// <summary> |
| | | /// 显示编辑之前的设备状态 |
| | | /// </summary> |
| | | /// <param name="device">编辑设备</param> |
| | | /// <param name="index">编辑数据的索引</param> |
| | | /// <param name="button1">显示Btn</param> |
| | | /// <param name="button2">显示Btn</param> |
| | | /// <param name="button3">显示Btn</param> |
| | | /// <param name="button4">显示Btn</param> |
| | | private void GetEditState(Entity.Function device, int index, Button button1, Button button2, Button button3, Button button4) |
| | | { |
| | | Output outputs = Logic.currlogic.output[index]; |
| | | var dicList = outputs.status as List<Dictionary<string, string>>; |
| | | //清除之前旧数据 |
| | | dicSateteList.Clear(); |
| | | if (dicList.Count != 0) |
| | | { |
| | | //有数据重新赋值 |
| | | dicSateteList = dicList; |
| | | } |
| | | switch (device.functionType) |
| | | { |
| | | //开关灯光 |
| | | case FunctionType.Relay: |
| | | { |
| | | foreach (var dic in dicList) |
| | | { |
| | | string value = dic["value"]; |
| | | if (value == "on") |
| | | { |
| | | button1.Text = Language.StringByID(StringId.onLogic); |
| | | } |
| | | else |
| | | { |
| | | button1.Text = Language.StringByID(StringId.offLogic); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case FunctionType.Dimmer: |
| | | case FunctionType.RGB: |
| | | case FunctionType.RGBW: |
| | | case FunctionType.CCT: |
| | | { |
| | | foreach (var dic in dicList) |
| | | { |
| | | string value = dic["value"]; |
| | | switch (dic["key"]) |
| | | { |
| | | case "on_off": |
| | | { |
| | | if (value == "on") |
| | | { |
| | | button1.Text = Language.StringByID(StringId.onLogic); |
| | | } |
| | | else |
| | | { |
| | | button1.Text = Language.StringByID(StringId.offLogic); |
| | | } |
| | | } |
| | | break; |
| | | case "brightness": |
| | | { |
| | | |
| | | button2.Text = value; |
| | | } |
| | | break; |
| | | } |
| | | |
| | | } |
| | | } |
| | | break; |
| | | case FunctionType.Curtain: |
| | | { |
| | | foreach (var dic in dicList) |
| | | { |
| | | string value = dic["value"]; |
| | | switch (value) |
| | | { |
| | | case "on": |
| | | { |
| | | button1.Text = Language.StringByID(StringId.onLogic); |
| | | } |
| | | break; |
| | | case "off": |
| | | { |
| | | button1.Text = Language.StringByID(StringId.offLogic); |
| | | } |
| | | break; |
| | | case "stop": |
| | | { |
| | | button1.Text = Language.StringByID(StringId.stop); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case FunctionType.TrietexCurtain: |
| | | case FunctionType.RollerCurtain: { |
| | | |
| | | foreach (var dic in dicList) |
| | | { |
| | | string value = dic["value"]; |
| | | switch (dic["key"]) |
| | | { |
| | | case "on_off": |
| | | { |
| | | switch (value) |
| | | { |
| | | case "on": |
| | | { |
| | | button1.Text = Language.StringByID(StringId.onLogic); |
| | | } |
| | | break; |
| | | case "off": |
| | | { |
| | | button1.Text = Language.StringByID(StringId.offLogic); |
| | | } |
| | | break; |
| | | case "stop": |
| | | { |
| | | button1.Text = Language.StringByID(StringId.stop); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | break; |
| | | case "brightness": |
| | | { |
| | | |
| | | button2.Text = value; |
| | | } |
| | | break; |
| | | } |
| | | |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 添加处理选中数据 |
| | | /// </summary> |
| | | /// <param name="dicList">存储数据列表</param> |
| | | /// <param name="keyValue">识别设备</param> |
| | | /// <param name="dictionary">选中数据</param> |
| | | /// <returns></returns> |
| | | private void AddDictionaryData(List<Dictionary<string, string>> dicList, string keyValue, Dictionary<string, string> dictionary) |
| | | { |
| | | int indexValue = -1; |
| | | for (int i = 0; i < dicList.Count; i++) |
| | | { |
| | | var dic = dicList[i]; |
| | | if (dic.ContainsValue(keyValue)) |
| | | { |
| | | //判断是否存在 |
| | | indexValue = i; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (indexValue != -1) |
| | | { |
| | | //存在移除 |
| | | dicList.RemoveAt(indexValue); |
| | | //重新添加 |
| | | dicList.Insert(indexValue, dictionary); |
| | | } |
| | | else |
| | | { |
| | | //新添加 |
| | | dicList.Add(dictionary); |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 添加目标 |
| | | /// </summary> |
| | | /// <param name="target"></param> |
| | | private void AddTarget(Output target) |
| | | { |
| | | int indexValue = -1; |
| | | for (int i = 0; i < Logic.currlogic.output.Count; i++) |
| | | { |
| | | if (Logic.currlogic.output[i].sid == target.sid) |
| | | { |
| | | indexValue = i; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (indexValue != -1) |
| | | { |
| | | Logic.currlogic.output.RemoveAt(indexValue); |
| | | Logic.currlogic.output.Insert(indexValue, target); |
| | | } |
| | | else |
| | | { |
| | | Logic.currlogic.output.Add(target); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | } |