From 1c4904d77f484c075080942d87785481b52b6fb2 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期一, 28 十月 2019 14:58:46 +0800 Subject: [PATCH] Revert "Merge branch 'dev-tzy' into DEV_GXC" --- ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs | 1368 ++++++++++++++++++++-------------------------------------- 1 files changed, 481 insertions(+), 887 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs index 59e67bb..13af081 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs @@ -9,159 +9,104 @@ namespace Shared.Phone.Device.Logic { - public class DeviceStateCondition : FrameLayout + public class DeviceStateCondition :FrameLayout { public DeviceStateCondition() { Tag = "Logic"; } - Button roombjButton = new Button(); - Button roomTextButton = new Button(); - Button devicetypeButton = new Button(); + Button SelectedButton = new Button(); + HorizontalScrolViewLayout horizontalScrol; VerticalScrolViewLayout middle; - FrameLayout clickframeLayout = new FrameLayout(); - Button clickbutton = new Button(); - Button clicktextcolcrbutton = new Button(); - public void Show() { - + UserView.HomePage.Instance.ScrollEnabled = false; - this.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; - #region 鏈�涓婇潰鐨勫竷灞�浠g爜 - var topRowLayout = new RowLayout - { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, - }; - this.AddChidren(topRowLayout); + this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor; + var topFrameLayout = new RowLayout + { + Height = Application.GetRealHeight(220), + Y = Application.GetRealHeight(80), + BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor, + }; + AddChidren(topFrameLayout); + var titleName = new Button { - TextSize = 16, + TextID = MyInternationalizationString.devicestate, + TextSize = 17, TextColor = ZigbeeColor.Current.LogicTextBlackColor, TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(160), - Width = Application.GetRealWidth(300), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - TextID = MyInternationalizationString.devicestate, + X = Application.GetRealWidth(150), }; - topRowLayout.AddChidren(titleName); - - var clickBtn = new Button - { - Width = Application.GetRealWidth(81 + 51), - Height = Application.GetRealHeight(58 + 40), - Y = Application.GetRealHeight(98 - 40), - }; - topRowLayout.AddChidren(clickBtn); - clickBtn.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; + topFrameLayout.AddChidren(titleName); var back = new Button { - Width = Application.GetRealWidth(30), - Height = Application.GetRealHeight(51), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(98), - //Gravity = Gravity.CenterVertical; - UnSelectedImagePath = "ZigeeLogic/back.png", + Width = Application.GetRealWidth(110), + Height = Application.GetRealHeight(110), + X = Application.GetRealWidth(20), + Gravity = Gravity.CenterVertical, + UnSelectedImagePath = "ZigeeLogic/Back.png", }; - topRowLayout.AddChidren(back); + topFrameLayout.AddChidren(back); back.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); UserView.HomePage.Instance.ScrollEnabled = true; }; - var foolrname = new Button + var roomname = new Button { - TextColor = ZigbeeColor.Current.LogicTextBlackColor, + Width = Application.GetMinRealAverage(300 + 300-30), + Height = Application.GetMinRealAverage(80), + X = Application.GetRealWidth(1080 - 300 - 30 - 300), + Y = Application.GetRealHeight(120), TextAlignment = TextAlignment.CenterRight, - X = Application.GetRealWidth(1080 - 400 - 120), - Width = Application.GetRealWidth(400), - Height = Application.GetRealHeight(69), - Y = Application.GetRealHeight(92), - //TextID = MyInternationalizationString.customroom, - Text = Config.Instance.Home.GetCurrentFloorName, - }; - topRowLayout.AddChidren(foolrname); - var dropdown = new Button - { + //Text = "鑷畾涔夋埧闂�", TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterRight, - X = foolrname.Right, - Width = Application.GetRealWidth(72), - Height = Application.GetRealHeight(72), - Y = Application.GetRealHeight(92), - UnSelectedImagePath = "ZigeeLogic/drop-down.png", + TextID=MyInternationalizationString.customroom, }; - topRowLayout.AddChidren(dropdown); + topFrameLayout.AddChidren(roomname); - #endregion - - ///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱 - if (Common.Room.Lists.Count == 0) + var horizontalScrolfl = new FrameLayout { - return; - } - ///鎴块棿婊戝姩鎺т欢 - var roomhorizontalScrol = new HorizontalScrolViewLayout() - { - Width = Application.GetRealWidth(1080 - 58), - Height = Application.GetRealHeight(200), - Y = topRowLayout.Bottom, - X = Application.GetRealWidth(58), - }; - this.AddChidren(roomhorizontalScrol); - - var devicetypehorizontalScrol1 = new HorizontalScrolViewLayout() - { - Width = Application.GetRealWidth(1080 - 58 - 200), - Height = Application.GetRealHeight(280), - Y = roomhorizontalScrol.Bottom, + Height = Application.GetRealHeight(220 + 30), + Y = topFrameLayout.Bottom, BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - X = Application.GetRealWidth(58 + 200), }; - this.AddChidren(devicetypehorizontalScrol1); - ///璁惧绫诲瀷婊戝姩鎺т欢 - var devicetypehorizontalScrol = new HorizontalScrolViewLayout() + AddChidren(horizontalScrolfl); + + + horizontalScrol = new HorizontalScrolViewLayout() { - Width = Application.GetRealWidth(1080 - 58), - Height = Application.GetRealHeight(280), - Y = roomhorizontalScrol.Bottom, - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - X = Application.GetRealWidth(58), - Radius = (uint)Application.GetRealHeight(50), - + Width = Application.GetRealWidth(1080 - 40), + Height = Application.GetRealHeight(180 + 30), + Y = Application.GetRealHeight(40), + X = Application.GetRealWidth(40), + Radius = (uint)Application.GetRealHeight(30), }; - this.AddChidren(devicetypehorizontalScrol); + horizontalScrolfl.AddChidren(horizontalScrol); - middle = new VerticalScrolViewLayout(); - middle.Y = devicetypehorizontalScrol.Bottom + Application.GetRealHeight(40); - middle.Height = Application.GetRealHeight(1920) - devicetypehorizontalScrol.Y; + middle = new VerticalScrolViewLayout(); + middle.Y = horizontalScrolfl.Bottom; + middle.Height = Application.GetRealHeight(1920 - 300 - 250); middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; - middle.X = Application.GetRealWidth(58); - middle.Radius = (uint)Application.GetRealHeight(50); this.AddChidren(middle); ///鐩墠鏀寔鐨勮澶� - var deviceTypeList = new List<DeviceType> { + List<DeviceType> deviceTypeList = new List<DeviceType> { DeviceType.IASZone, DeviceType.OnOffSwitch, - DeviceType.OnOffOutput,//妤兼鐏� - DeviceType.DoorLock, - DeviceType.TemperatureSensor, + //DeviceType.ColorDimmableLight, + // DeviceType.OnOffOutput, + // DeviceType.WindowCoveringDevice, + // DeviceType.AirSwitch, }; - - ///妤煎眰鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> foorlclick = (sender, e) => + ///鎴块棿鐐瑰嚮浜嬩欢 + roomname.MouseUpEventHandler += (sender, e) => { var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; @@ -170,187 +115,95 @@ { flMain.RemoveFromParent(); }; - var foolrbj = new VerticalScrolViewLayout + var roombj = new VerticalScrolViewLayout { Width = Application.GetRealWidth(400), Height = Application.GetRealHeight(600), X = Application.GetRealWidth(1080 - 400 - 60), - Y = Application.GetRealHeight(184 + 50), + Y = Application.GetRealHeight(220 + 30 + 80), BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, Radius = (uint)Application.GetRealHeight(30), }; - flMain.AddChidren(foolrbj); - foreach (var foolr in Config.Instance.Home.FloorDics) + flMain.AddChidren(roombj); + List<Common.Room> roomlist = new List<Common.Room>(); + roomlist.Clear(); + Common.Room customroom = new Common.Room(); + customroom.Name =Language.StringByID(MyInternationalizationString.customroom); + foreach (var device in Common.Logic.LogicDviceList) { + + var deviceui = customroom.GetDeviceUI(device); + if (deviceui != null) + { + customroom.DeviceUIList.Add(deviceui); + } - var foolrRowLayout = new FrameLayout + } + roomlist.Add(customroom); + roomlist.AddRange(Common.Room.Lists); + foreach (var room in roomlist) + { + var rowLayout = new RowLayout { Height = Application.GetRealHeight(150), }; - foolrbj.AddChidren(foolrRowLayout); + roombj.AddChidren(rowLayout); - var btnfoolrname = new Button + var btnroomname = new Button { - Width = Application.GetRealWidth(250), - Height = Application.GetRealHeight(160), - Text = foolr.Value, - TextAlignment = TextAlignment.Center, + Width = Application.GetRealWidth(300), + Text = room.Name, + TextAlignment = TextAlignment.CenterLeft, + X = Application.GetRealWidth(30), TextColor = ZigbeeColor.Current.LogicTextBlackColor, - //SelectedTextColor=0xfffc744b, - Tag = foolr.Key, }; - foolrRowLayout.AddChidren(btnfoolrname); + rowLayout.AddChidren(btnroomname); - - EventHandler<MouseEventArgs> foolrnameclick = (sender13, e13) => + EventHandler<MouseEventArgs> roomclick = (sender1, e1) => { - roomhorizontalScrol.RemoveAll(); - devicetypehorizontalScrol.RemoveAll(); - middle.RemoveAll(); - foolrname.Text = btnfoolrname.Text; + flMain.RemoveFromParent(); - var list = Send.GetRoomList(btnfoolrname.Tag.ToString()); - AllRoomView(list, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); + roomname.Text = room.Name; + var list = new List<DeviceUI>(); + foreach (var device in room.DeviceUIList) + { + if (!deviceTypeList.Contains(device.CommonDevice.Type)) + { + continue; + } + list.Add(device); + } + AllDeviceTypeView(list); }; - foolrRowLayout.MouseUpEventHandler += foolrnameclick; - btnfoolrname.MouseUpEventHandler += foolrnameclick; - + rowLayout.MouseUpEventHandler += roomclick; + btnroomname.MouseUpEventHandler += roomclick; } - }; - foolrname.MouseUpEventHandler += foorlclick; - dropdown.MouseUpEventHandler += foorlclick; - ///绗竴娆¤繘鏉� - var roomlists = new List<Common.Room>(); - roomlists.Clear(); - if (Config.Instance.Home.FloorDics.Count < 2) + + Common.Room room1= new Common.Room(); + foreach (var device in Common.Logic.LogicDviceList) { - foolrname.Visible = false; - dropdown.Visible = false; - if (Config.Instance.Home.FloorDics.Count == 0) + + if (!deviceTypeList.Contains(device.Type)) { - roomlists.AddRange(Common.Room.Lists); + continue; } - else + var deviceui = room1.GetDeviceUI(device); + if (deviceui != null) { - roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); - } - } - else - { - roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); - - } - - AllRoomView(roomlists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol); - } - /// <summary> - /// 鍔犺浇鎵�鏈夋埧闂寸殑瑙嗗浘鏂规硶 - /// </summary> - void AllRoomView(List<Common.Room> roomlist, List<DeviceType> deviceTypeList, HorizontalScrolViewLayout roomhorizontalScrol, HorizontalScrolViewLayout devicetypehorizontalScrol) - { - for (int i = 0; i < roomlist.Count; i++) - { - var room = roomlist[i]; - - var fra = new FrameLayout - { - Height = Application.GetRealHeight(200), - Width = Application.GetRealWidth(255), - }; - roomhorizontalScrol.AddChidren(fra); - - var roombjBtn = new Button - { - Height = Application.GetRealHeight(158), - Width = Application.GetRealWidth(255), - UnSelectedImagePath = "ZigeeLogic/iconBackgroundColor.png", - SelectedImagePath = "ZigeeLogic/iconSelectedBackgroundColor.png", - Y=Application.GetRealHeight(21), - }; - fra.AddChidren(roombjBtn); - - var roomnameBtn= new Button - { - - Height = Application.GetRealHeight(152-26-20), - Width = Application.GetRealWidth(255-20-50), - Text = room.Name, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - SelectedTextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, - Y=Application.GetRealHeight(21 +13+10), - X=Application.GetRealWidth(10+25), - - }; - fra.AddChidren(roomnameBtn); - - if (i == 0)// - { - roombjButton.IsSelected = false; - roombjButton = roombjBtn; - roombjBtn.IsSelected = true; - - roomTextButton.IsSelected = false; - roomTextButton = roomnameBtn; - roomnameBtn.IsSelected = true; - - var list = new List<DeviceUI>(); - foreach (var device in room.DeviceUIList) - { - if (device.CommonDevice==null) { - continue; - } - if (!deviceTypeList.Contains(device.CommonDevice.Type)) - { - continue; - } - list.Add(device); - } - AllDeviceTypeView(list, devicetypehorizontalScrol); - + room1.DeviceUIList.Add(deviceui); } - - EventHandler<MouseEventArgs> roomclick = (sender, e) => - { - - - roombjButton.IsSelected = false; - roombjButton = roombjBtn; - roombjBtn.IsSelected = true; - - roomTextButton.IsSelected = false; - roomTextButton = roomnameBtn; - roomnameBtn.IsSelected = true; - - var list = new List<DeviceUI>(); - foreach (var device in room.DeviceUIList) - { - if (device.CommonDevice==null) { - continue; - } - if (!deviceTypeList.Contains(device.CommonDevice.Type)) - { - continue; - } - list.Add(device); - } - AllDeviceTypeView(list, devicetypehorizontalScrol); - - - }; - roomnameBtn.MouseUpEventHandler += roomclick; - roombjBtn.MouseUpEventHandler += roomclick; - } + AllDeviceTypeView(room1.DeviceUIList); } /// <summary> /// 鍔犺浇璇ュ尯鍩熸墍鏈夎澶囪鍥炬柟娉� /// </summary>0 /// <param name="devicelist">Devicelist.</param> - void AllDeviceTypeView(List<DeviceUI> devicelist, HorizontalScrolViewLayout devicetypehorizontalScrol) + void AllDeviceTypeView(List<DeviceUI> devicelist) { List<string> devicetypelist = new List<string>(); devicetypelist.Clear(); @@ -367,7 +220,7 @@ devicetypelist.Add(Language.StringByID(MyInternationalizationString.Curtains)); } - var iASZonejosn = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.IASZone|| device.CommonDevice.Type == DeviceType.TemperatureSensor); + var iASZonejosn = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.IASZone); if (iASZonejosn != null) { devicetypelist.Add(Language.StringByID(MyInternationalizationString.sensor)); @@ -377,100 +230,65 @@ { devicetypelist.Add(Language.StringByID(MyInternationalizationString.OnOffSwitch)); } - var doorLock = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.DoorLock); - if (doorLock != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.doorLock)); - } #endregion - - devicetypehorizontalScrol.RemoveAll(); - for (int i = 0; i < devicetypelist.Count; i++) + + horizontalScrol.RemoveAll(); + foreach (var devicetype in devicetypelist) { - - var devicetype = devicetypelist[i]; - - var spaceRowLayout = new FrameLayout(); - devicetypehorizontalScrol.AddChidren(spaceRowLayout); - if (i == 0) - { - spaceRowLayout.Width = Application.GetRealWidth(37); - } - else - { - spaceRowLayout.Width = Application.GetRealWidth(80); - } var deviceRowLayout = new FrameLayout { - Width = Application.GetRealWidth(156 + 20), - Height = Application.GetRealHeight(280 - 30), - Y = Application.GetRealHeight(30), + Height = Application.GetRealHeight(180 + 30), + Width = Application.GetRealWidth(250), }; - devicetypehorizontalScrol.AddChidren(deviceRowLayout); - - var backgroundColor = new Button - { - Width = Application.GetRealWidth(156), - Height = Application.GetRealHeight(180), - X = Application.GetRealWidth(10), - UnSelectedImagePath = "ZigeeLogic/deviceunselectedbackgroundcolor.png", - SelectedImagePath = "ZigeeLogic/deviceselectedbackgroundcolor.png", - }; - deviceRowLayout.AddChidren(backgroundColor); - + horizontalScrol.AddChidren(deviceRowLayout); var devicetypeicon = new Button { - Width = Application.GetRealWidth(84), - Height = Application.GetRealHeight(84), - X = Application.GetRealWidth(46), - Y = Application.GetRealHeight(30), + Width = Application.GetRealWidth(110), + Height = Application.GetRealHeight(110), + X = Application.GetRealWidth(70), }; deviceRowLayout.AddChidren(devicetypeicon); - - var devicetypename = new Button - { - Width = Application.GetRealWidth(176), - Height = Application.GetRealHeight(40), - Text = devicetype, - TextAlignment = TextAlignment.Center, - Y = backgroundColor.Bottom, - TextColor = ZigbeeColor.Current.LogicAddColor, - TextSize = 10, - }; - deviceRowLayout.AddChidren(devicetypename); if (devicetype == Language.StringByID(MyInternationalizationString.Lights)) { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedlight.png"; - // devicetypeicon.SelectedImagePath = "ZigeeLogic/LightSelected.png"; + devicetypeicon.UnSelectedImagePath = "ZigeeLogic/Light.png"; + devicetypeicon.SelectedImagePath = "ZigeeLogic/LightSelected.png"; } else if (devicetype == Language.StringByID(MyInternationalizationString.Curtains)) { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedcurtain.png"; - //devicetypeicon.SelectedImagePath = "ZigeeLogic/CurtainSelected.png"; + devicetypeicon.UnSelectedImagePath = "ZigeeLogic/Curtain.png"; + devicetypeicon.SelectedImagePath = "ZigeeLogic/CurtainSelected.png"; } else if (devicetype == Language.StringByID(MyInternationalizationString.OnOffSwitch)) { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedpanel.png"; - // devicetypeicon.SelectedImagePath = "ZigeeLogic/OnOffSwitchSelected.png"; + devicetypeicon.UnSelectedImagePath = "ZigeeLogic/OnOffSwitch.png"; + devicetypeicon.SelectedImagePath = "ZigeeLogic/OnOffSwitchSelected.png"; } else if (devicetype == Language.StringByID(MyInternationalizationString.sensor)) { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedsenor.png"; - // devicetypeicon.SelectedImagePath = "ZigeeLogic/SensorSelected.png"; + devicetypeicon.UnSelectedImagePath = "ZigeeLogic/Sensor.png"; + devicetypeicon.SelectedImagePath = "ZigeeLogic/SensorSelected.png"; } - else if (devicetype == Language.StringByID(MyInternationalizationString.doorLock)) + + var devicetypename = new Button { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selecteddoorlock.png"; - } + Width = Application.GetRealWidth(250), + Height = Application.GetRealHeight(50), + Text = devicetype, + TextAlignment = TextAlignment.Center, + Y = devicetypeicon.Bottom + Application.GetRealHeight(20), + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + }; + deviceRowLayout.AddChidren(devicetypename); + EventHandler<MouseEventArgs> devicetypeclick = (sender13, e13) => { List<DeviceType> list = new List<DeviceType>(); list.Clear(); - devicetypeButton.IsSelected = false; - devicetypeButton = backgroundColor; - backgroundColor.IsSelected = true; + SelectedButton.IsSelected = false; + SelectedButton = devicetypeicon; + SelectedButton.IsSelected = true; ///鍒嗙被鏄剧ず锛堜緥濡傜伅鍏夛細{鐏厜1锛岀伅鍏�2...}锛� if (devicetype == Language.StringByID(MyInternationalizationString.Lights)) { @@ -487,11 +305,6 @@ else if (devicetype == Language.StringByID(MyInternationalizationString.sensor)) { list.Add(DeviceType.IASZone); - list.Add(DeviceType.TemperatureSensor); - } - else if (devicetype == Language.StringByID(MyInternationalizationString.doorLock)) - { - list.Add(DeviceType.DoorLock); } ConditionDeviceView(list, devicelist); @@ -500,7 +313,6 @@ deviceRowLayout.MouseUpEventHandler += devicetypeclick; devicetypename.MouseUpEventHandler += devicetypeclick; devicetypeicon.MouseUpEventHandler += devicetypeclick; - backgroundColor.MouseUpEventHandler += devicetypeclick; } ///鏄剧ず鎴块棿鎵�鏈夎澶� @@ -524,123 +336,44 @@ continue; } - - var deviceFramelayout = new FrameLayout + var row = new RowLayout { - Height = Application.GetRealHeight(160), - }; - middle.AddChidren(deviceFramelayout); - - var bjFramelayout = new FrameLayout - { - Width = Application.GetRealWidth(112), - Height = Application.GetRealHeight(112), - X = Application.GetRealWidth(58), - Y = Application.GetRealHeight(30 + 9), - Radius = (uint)Application.GetRealHeight(56), - BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, - }; - deviceFramelayout.AddChidren(bjFramelayout); - - var deviceIconBtn = new Button - { - Width = Application.GetRealWidth(82), - Height = Application.GetRealHeight(82), - Gravity = Gravity.Center, + Height = Application.GetRealHeight(180), }; - bjFramelayout.AddChidren(deviceIconBtn); - - var deviceRow = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(850), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(176 + 10), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - - }; - deviceFramelayout.AddChidren(deviceRow); + middle.AddChidren(row); var devicename = new Button { - Text = common.CommonDevice.DeviceEpointName, + Gravity = Gravity.CenterVertical, TextAlignment = TextAlignment.CenterLeft, + X = Application.GetRealWidth(40), + Width = Application.GetRealWidth(600), + //SelectedBackgroundColor = 0xFFE9652D, + Text = common.CommonDevice.DeviceEpointName, TextColor = ZigbeeColor.Current.LogicTextBlackColor, - SelectedTextColor = ZigbeeColor.Current.LogicAddColor, }; - deviceRow.AddChidren(devicename); - switch (common.CommonDevice.Type) + row.AddChidren(devicename); + + var btndeviceback = new Button { - case DeviceType.OnOffOutput: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/light.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedlight.png"; - } - break; - case DeviceType.IASZone: - { - var iASZonedevice = common.CommonDevice as IASZone; - if (iASZonedevice.DeviceID != 1026) - { - break; - } - deviceIconBtn.UnSelectedImagePath = $"ZigeeLogic/sensor{iASZonedevice.IasDeviceType}.png"; - deviceIconBtn.SelectedImagePath = $"ZigeeLogic/selectedsensor{iASZonedevice.IasDeviceType}.png"; - - - } - break; - case DeviceType.TemperatureSensor: - { - var temperatureSensor = common.CommonDevice as TemperatureSensor; - if (temperatureSensor.SensorDiv == 1) - { - deviceIconBtn.UnSelectedImagePath = $"ZigeeLogic/temperature.png"; - deviceIconBtn.SelectedImagePath = $"ZigeeLogic/selectedtemperature.png"; - } - else - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/humidity.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedhumidity.png"; - } - } - break; - case DeviceType.OnOffSwitch: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/panel.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedpanel.png"; - } - break; - case DeviceType.DoorLock: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/doorlock.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selecteddoorlock.png"; - } - break; - } + Width = Application.GetRealWidth(110), + Height = Application.GetRealHeight(110), + UnSelectedImagePath = "ZigeeLogic/Next.png", + X = Application.GetRealWidth(1080 - 140), + Gravity = Gravity.CenterVertical, + }; + row.AddChidren(btndeviceback); EventHandler<MouseEventArgs> devicclick = (sen, e) => { - clickbutton.IsSelected = false; - clickbutton = deviceIconBtn; - deviceIconBtn.IsSelected = true; - clickframeLayout.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; - clickframeLayout = bjFramelayout; - bjFramelayout.BackgroundColor = ZigbeeColor.Current.LogicIconBackgroundColor; - clicktextcolcrbutton.IsSelected = false; - clicktextcolcrbutton = devicename; - devicename.IsSelected = true; var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; this.AddChidren(flMain); CurrentDeviceView(flMain, common.CommonDevice, false); }; - deviceFramelayout.MouseUpEventHandler += devicclick; - bjFramelayout.MouseUpEventHandler += devicclick; - deviceIconBtn.MouseUpEventHandler += devicclick; - deviceRow.MouseUpEventHandler += devicclick; + row.MouseUpEventHandler += devicclick; devicename.MouseUpEventHandler += devicclick; - + btndeviceback.MouseUpEventHandler += devicclick; } } @@ -648,95 +381,59 @@ /// 閫変腑璇ヨ澶囧姛鑳戒綔涓烘潯浠剁殑瑙嗗浘鏂规硶 /// </summary> /// <param name="common">Common.</param> - public async static void CurrentDeviceView(FrameLayout flMain, CommonDevice common, bool edit) + public static void CurrentDeviceView(FrameLayout flMain,CommonDevice common,bool edit) { //涓嶈褰撳墠鐣岄潰婊戝姩 UserView.HomePage.Instance.ScrollEnabled = false; - List<Dictionary<string, string>> doorlockConditionsInfo= new List<Dictionary<string, string>>(); Dictionary<string, string> deviceConditionsInfo = new Dictionary<string, string>(); - dictionary(deviceConditionsInfo, "Type", "1"); - dictionary(deviceConditionsInfo, "IsValid", "1"); - dictionary(deviceConditionsInfo, "MacAddr", common.DeviceAddr); - dictionary(deviceConditionsInfo, "Epoint", common.DeviceEpoint.ToString()); //var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; //this.AddChidren(flMain); flMain.MouseUpEventHandler += (sender, e) => { flMain.RemoveFromParent(); - - }; - - var devicefra1 = new FrameLayout - { - Width = Application.GetRealWidth(1080), - Height = Application.GetRealHeight(100), - Y = Application.GetRealHeight(1920 - 100), - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - flMain.AddChidren(devicefra1); - var devicefra = new FrameLayout { - Width = Application.GetRealWidth(1080), - Height = Application.GetRealHeight(530), - Y = Application.GetRealHeight(1920 - 530), + Width = Application.GetRealWidth(1080 - 80), + X = Application.GetRealWidth(40), BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - Radius = (uint)Application.GetRealHeight(60), + Radius = (uint)Application.GetRealHeight(50), }; flMain.AddChidren(devicefra); - #region -------鍙栨秷 瀹屾垚 - var timetype = new RowLayout + var devicename = new Button { - Height = Application.GetRealHeight(140), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - devicefra.AddChidren(timetype); - var Btncancel = new Button - { - TextID = MyInternationalizationString.cancel, - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - X = Application.GetRealWidth(80), - TextAlignment = TextAlignment.CenterLeft, - }; - timetype.AddChidren(Btncancel); - Btncancel.MouseUpEventHandler += (sender16, e16) => - { - flMain.RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; - - var Btntitle = new Button - { - TextID = MyInternationalizationString.security, - TextColor = ZigbeeColor.Current.LogicBtnTypeColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(320), - TextAlignment = TextAlignment.Center, - X = Btncancel.Right + Application.GetRealWidth(100), - TextSize = 16, + Y = Application.GetRealHeight(20), Text = common.DeviceEpointName, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + Height = Application.GetRealHeight(150), + Width = Application.GetRealWidth(1080 - 80), }; - timetype.AddChidren(Btntitle); - var Btncomplete = new Button + devicefra.AddChidren(devicename); + + string SelectedDeviceStatuscondition = "no"; + + if (deviceConditionsInfo.ContainsKey("Type")) { - TextID = MyInternationalizationString.complete, - TextColor = ZigbeeColor.Current.LogicBtnCompleteColor, - Height = Application.GetRealHeight(140), - Width = Application.GetRealWidth(200), - TextAlignment = TextAlignment.CenterRight, - X = Btntitle.Right + Application.GetRealWidth(100), - - }; - timetype.AddChidren(Btncomplete); - #endregion - - string SelectedDeviceStatuscondition = ""; - + deviceConditionsInfo.Remove("Type"); + } + if (deviceConditionsInfo.ContainsKey("IsValid")) + { + deviceConditionsInfo.Remove("IsValid"); + } + if (deviceConditionsInfo.ContainsKey("MacAddr")) + { + deviceConditionsInfo.Remove("MacAddr"); + } + if (deviceConditionsInfo.ContainsKey("Epoint")) + { + deviceConditionsInfo.Remove("Epoint"); + } + deviceConditionsInfo.Add("Type", "1"); + deviceConditionsInfo.Add("IsValid", "1"); + deviceConditionsInfo.Add("MacAddr", common.DeviceAddr); + deviceConditionsInfo.Add("Epoint",common.DeviceEpoint.ToString()); Dictionary<string, string> devices = null; if (edit) { @@ -758,72 +455,101 @@ ///鐏厜 case DeviceType.OnOffOutput: { - dictionary(deviceConditionsInfo, "Cluster_ID", "6"); - dictionary(deviceConditionsInfo, "AttriButeId", "0"); - dictionary(deviceConditionsInfo, "Range", "1"); - dictionary(deviceConditionsInfo, "AttriButeData2", "0"); + + if (deviceConditionsInfo.ContainsKey("Cluster_ID")) + { + deviceConditionsInfo.Remove("Cluster_ID"); + } + if (deviceConditionsInfo.ContainsKey("AttriButeId")) + { + deviceConditionsInfo.Remove("AttriButeId"); + } + if (deviceConditionsInfo.ContainsKey("Range")) + { + deviceConditionsInfo.Remove("Range"); + } + if (deviceConditionsInfo.ContainsKey("AttriButeData2")) + { + deviceConditionsInfo.Remove("AttriButeData2"); + } + deviceConditionsInfo.Add("Cluster_ID", "6"); + deviceConditionsInfo.Add("AttriButeId", "0"); + deviceConditionsInfo.Add("Range", "1"); + deviceConditionsInfo.Add("AttriButeData2", "0"); + #region 鐏厜View - - var openframelayout = new FrameLayout + devicefra.Y = Application.GetRealHeight(1920 - 30 - 720); + devicefra.Height = Application.GetRealHeight(720); + var OnOffOutputfra = new FrameLayout { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(20), + Y = Application.GetRealHeight(180), + Height = Application.GetRealHeight(180 * 2 + 30), }; - devicefra.AddChidren(openframelayout); + devicefra.AddChidren(OnOffOutputfra); var openrowlayout = new RowLayout { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, + Height = Application.GetRealHeight(180), }; - openframelayout.AddChidren(openrowlayout); + OnOffOutputfra.AddChidren(openrowlayout); var btnopen = new Button { - Width = Application.GetRealWidth(600), + //Text = "寮�", TextID = MyInternationalizationString.open, TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, + X = Application.GetRealWidth(40), + Width = Application.GetRealWidth(300), + Height = Application.GetRealHeight(180), + //SelectedBackgroundColor = 0xfffe5e00, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, }; openrowlayout.AddChidren(btnopen); - var openBtnSelected = new SelectedButton(); + var openBtnSelected = new Button + { + X = Application.GetRealWidth(1000 - 150), + Width = Application.GetMinRealAverage(110), + Height = Application.GetMinRealAverage(110), + UnSelectedImagePath = "Item/YesSelected.png", + Visible = false, + Gravity = Gravity.CenterVertical + }; openrowlayout.AddChidren(openBtnSelected); - var closeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = openframelayout.Bottom, - }; - devicefra.AddChidren(closeframelayout); + var closerowlayout = new RowLayout { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, + Y = openrowlayout.Bottom, + Height = Application.GetRealHeight(180), }; - closeframelayout.AddChidren(closerowlayout); + OnOffOutputfra.AddChidren(closerowlayout); var btnclose = new Button { //Text = "鍏�", TextID = MyInternationalizationString.close, - Width = Application.GetRealWidth(600), TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, + X = Application.GetRealWidth(40), + Width = Application.GetRealWidth(300), + Height = Application.GetRealHeight(180), + TextColor = ZigbeeColor.Current.LogicTextBlackColor, }; closerowlayout.AddChidren(btnclose); - var closeBtnSelected = new SelectedButton(); + var closeBtnSelected = new Button + { + X = Application.GetRealWidth(1000 - 150), + Width = Application.GetMinRealAverage(110), + Height = Application.GetMinRealAverage(110), + UnSelectedImagePath = "Item/YesSelected.png", + Visible = false, + Gravity = Gravity.CenterVertical, + }; closerowlayout.AddChidren(closeBtnSelected); #endregion @@ -832,47 +558,44 @@ { openBtnSelected.Visible = true; closeBtnSelected.Visible = false; - btnopen.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - SelectedDeviceStatuscondition = "OnOffOutput"; - dictionary(deviceConditionsInfo, "AttriButeData1", "1");//榛樿鍊� - + SelectedDeviceStatuscondition = "yes"; + if (deviceConditionsInfo.ContainsKey("AttriButeData1")) + { + deviceConditionsInfo.Remove("AttriButeData1"); + } + deviceConditionsInfo.Add("AttriButeData1", "1");//榛樿鍊� }; openrowlayout.MouseUpEventHandler += openclick; btnopen.MouseUpEventHandler += openclick; openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; ///鐐瑰嚮鍙栨秷浜嬩欢 EventHandler<MouseEventArgs> closeclick = (sender, e) => { - btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; openBtnSelected.Visible = false; closeBtnSelected.Visible = true; - SelectedDeviceStatuscondition = "OnOffOutput"; - dictionary(deviceConditionsInfo, "AttriButeData1", "0");//榛樿鍊� + SelectedDeviceStatuscondition = "yes"; + if (deviceConditionsInfo.ContainsKey("AttriButeData1")) + { + deviceConditionsInfo.Remove("AttriButeData1"); + } + deviceConditionsInfo.Add("AttriButeData1", "0");//榛樿鍊� }; closerowlayout.MouseUpEventHandler += closeclick; btnclose.MouseUpEventHandler += closeclick; - closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; + closeBtnSelected.MouseUpEventHandler += openclick; if (edit && devices != null) { if (devices["AttriButeId"] == "0") { if (devices["AttriButeData1"] == "1") { - btnopen.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; openBtnSelected.Visible = true; closeBtnSelected.Visible = false; } else { - btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; openBtnSelected.Visible = false; closeBtnSelected.Visible = true; @@ -884,10 +607,29 @@ case DeviceType.WindowCoveringDevice: { - dictionary(deviceConditionsInfo, "Cluster_ID", "258"); - dictionary(deviceConditionsInfo, "AttriButeId", "8"); - dictionary(deviceConditionsInfo, "Range", "0"); - dictionary(deviceConditionsInfo, "AttriButeData2", "0"); + + if (deviceConditionsInfo.ContainsKey("Cluster_ID")) + { + deviceConditionsInfo.Remove("Cluster_ID"); + } + if (deviceConditionsInfo.ContainsKey("AttriButeId")) + { + deviceConditionsInfo.Remove("AttriButeId"); + } + if (deviceConditionsInfo.ContainsKey("Range")) + { + deviceConditionsInfo.Remove("Range"); + } + if (deviceConditionsInfo.ContainsKey("AttriButeData2")) + { + deviceConditionsInfo.Remove("AttriButeData2"); + } + deviceConditionsInfo.Add("Cluster_ID", "258"); + deviceConditionsInfo.Add("AttriButeId", "8"); + deviceConditionsInfo.Add("Range", "0"); + deviceConditionsInfo.Add("AttriButeData2", "0"); + + #region 绐楀笜View devicefra.Y = Application.GetRealHeight(1920 - 30 - 720); @@ -910,7 +652,7 @@ //Text = "寮�", TextID = MyInternationalizationString.open, TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(50), + X = Application.GetRealWidth(40), Width = Application.GetRealWidth(300), Height = Application.GetRealHeight(180), //SelectedBackgroundColor = 0xfffe5e00, @@ -941,7 +683,7 @@ //Text = "鍏�", TextID = MyInternationalizationString.close, TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(50), + X = Application.GetRealWidth(40), Width = Application.GetRealWidth(300), Height = Application.GetRealHeight(180), TextColor = ZigbeeColor.Current.LogicTextBlackColor, @@ -963,10 +705,15 @@ ///鐐瑰嚮纭浜嬩欢 EventHandler<MouseEventArgs> openclick = (sender, e) => { - SelectedDeviceStatuscondition = "WindowCoveringDevice"; + SelectedDeviceStatuscondition = "yes"; openBtnSelected.Visible = true; closeBtnSelected.Visible = false; - dictionary(deviceConditionsInfo, "AttriButeData1", "95");//榛樿鍊� + if (deviceConditionsInfo.ContainsKey("AttriButeData1")) + { + deviceConditionsInfo.Remove("AttriButeData1"); + } + deviceConditionsInfo.Add("AttriButeData1", "95");//榛樿鍊� + }; openrowlayout.MouseUpEventHandler += openclick; @@ -975,10 +722,14 @@ ///鐐瑰嚮鍙栨秷浜嬩欢 EventHandler<MouseEventArgs> closeclick = (sender, e) => { - SelectedDeviceStatuscondition = "WindowCoveringDevice"; + SelectedDeviceStatuscondition = "yes"; openBtnSelected.Visible = false; closeBtnSelected.Visible = true; - dictionary(deviceConditionsInfo, "AttriButeData1", "5");//榛樿鍊� + if (deviceConditionsInfo.ContainsKey("AttriButeData1")) + { + deviceConditionsInfo.Remove("AttriButeData1"); + } + deviceConditionsInfo.Add("AttriButeData1", "5");//榛樿鍊� }; closerowlayout.MouseUpEventHandler += closeclick; @@ -1011,126 +762,141 @@ { break; } + if (deviceConditionsInfo.ContainsKey("Cluster_ID")) + { + deviceConditionsInfo.Remove("Cluster_ID"); + } + if (deviceConditionsInfo.ContainsKey("AttriButeId")) + { + deviceConditionsInfo.Remove("AttriButeId"); + } - dictionary(deviceConditionsInfo, "Cluster_ID", "1280"); - dictionary(deviceConditionsInfo, "AttriButeId", "1281"); - dictionary(deviceConditionsInfo, "AttriButeData2", "0"); + if (deviceConditionsInfo.ContainsKey("AttriButeData2")) + { + deviceConditionsInfo.Remove("AttriButeData2"); + } + deviceConditionsInfo.Add("Cluster_ID", "1280"); + deviceConditionsInfo.Add("AttriButeId", "1281"); + + deviceConditionsInfo.Add("AttriButeData2", "0"); #region 瀹夐槻璁惧View - var openframelayout = new FrameLayout + devicefra.Y = Application.GetRealHeight(1920 - 30 - 720); + devicefra.Height = Application.GetRealHeight(720); + var iASZonedevicefra = new FrameLayout { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(20), + Y = Application.GetRealHeight(180), + Height = Application.GetRealHeight(180 * 2 + 30), }; - devicefra.AddChidren(openframelayout); + devicefra.AddChidren(iASZonedevicefra); var openrowlayout = new RowLayout { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, + Height = Application.GetRealHeight(180), }; - openframelayout.AddChidren(openrowlayout); + var btnopen = new Button { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.open, + + //TextID = MyInternationalizationString.open, TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, + X = Application.GetRealWidth(40), + Width = Application.GetRealWidth(300), + Height = Application.GetRealHeight(180), + SelectedBackgroundColor = 0xfffe5e00, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, }; openrowlayout.AddChidren(btnopen); - var openBtnSelected = new SelectedButton(); + var openBtnSelected = new Button + { + X = Application.GetRealWidth(1000 - 150), + Width = Application.GetMinRealAverage(110), + Height = Application.GetMinRealAverage(110), + UnSelectedImagePath = "Item/YesSelected.png", + Visible = false, + Gravity = Gravity.CenterVertical + }; openrowlayout.AddChidren(openBtnSelected); - var closeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = openframelayout.Bottom, - }; - devicefra.AddChidren(closeframelayout); var closerowlayout = new RowLayout { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, + Height = Application.GetRealHeight(180), + Y = openrowlayout.Bottom, }; - closeframelayout.AddChidren(closerowlayout); + /// var btnclose = new Button { - //Text = "鍏�", - TextID = MyInternationalizationString.close, - Width = Application.GetRealWidth(600), + + //TextID = MyInternationalizationString.close, TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, + X = Application.GetRealWidth(40), + Width = Application.GetRealWidth(300), + Height = Application.GetRealHeight(180), + TextColor = ZigbeeColor.Current.LogicTextBlackColor, }; closerowlayout.AddChidren(btnclose); - var closeBtnSelected = new SelectedButton(); + var closeBtnSelected = new Button + { + X = Application.GetRealWidth(1000 - 150), + Width = Application.GetMinRealAverage(110), + Height = Application.GetMinRealAverage(110), + UnSelectedImagePath = "Item/YesSelected.png", + Visible = false, + Gravity = Gravity.CenterVertical + }; closerowlayout.AddChidren(closeBtnSelected); #endregion - - int timevalue = 0; ///鐐瑰嚮纭浜嬩欢 EventHandler<MouseEventArgs> openclick = (sender, e) => { - SelectedDeviceStatuscondition = "IASZone"; - btnopen.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + SelectedDeviceStatuscondition = "yes"; openBtnSelected.Visible = true; closeBtnSelected.Visible = false; - if (iASZonedevice.IasDeviceType == 13) + if (deviceConditionsInfo.ContainsKey("Range")) { - closeBtnSelected.Visible = true; + deviceConditionsInfo.Remove("Range"); } - dictionary(deviceConditionsInfo, "Range", "5"); - dictionary(deviceConditionsInfo, "AttriButeData1", "1"); + deviceConditionsInfo.Add("Range", "5"); + if (deviceConditionsInfo.ContainsKey("AttriButeData1")) + { + deviceConditionsInfo.Remove("AttriButeData1"); + } + deviceConditionsInfo.Add("AttriButeData1", "1");//榛樿鍊� }; openrowlayout.MouseUpEventHandler += openclick; btnopen.MouseUpEventHandler += openclick; openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; ///鐐瑰嚮鍙栨秷浜嬩欢 EventHandler<MouseEventArgs> closeclick = (sender, e) => { - SelectedDeviceStatuscondition = "IASZone"; - btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + SelectedDeviceStatuscondition = "yes"; openBtnSelected.Visible = false; closeBtnSelected.Visible = true; - dictionary(deviceConditionsInfo, "Range", "1"); - dictionary(deviceConditionsInfo, "AttriButeData1", "0"); - if (iASZonedevice.IasDeviceType == 13) + if (deviceConditionsInfo.ContainsKey("Range")) { - SelectedDeviceStatuscondition = "no"; - btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - var ignoreTime = new IgnoreTime(); - UserView.HomePage.Instance.AddChidren(ignoreTime); - UserView.HomePage.Instance.PageIndex += 1; - ignoreTime.Show(common, btnclose.Text, edit, timevalue); + deviceConditionsInfo.Remove("Range"); } - + deviceConditionsInfo.Add("Range", "1"); + if (deviceConditionsInfo.ContainsKey("AttriButeData1")) + { + deviceConditionsInfo.Remove("AttriButeData1"); + } + deviceConditionsInfo.Add("AttriButeData1", "0");//榛樿鍊� }; closerowlayout.MouseUpEventHandler += closeclick; btnclose.MouseUpEventHandler += closeclick; closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; @@ -1139,140 +905,69 @@ case 13: { btnopen.TextID = MyInternationalizationString.someone; - btnclose.TextID = MyInternationalizationString.unattendedtime1; - closeBtnSelected.UnSelectedImagePath = "ZigeeLogic/next.png"; - closeBtnSelected.Visible = true; - openframelayout.AddChidren(openrowlayout); - closeframelayout.AddChidren(closerowlayout); + //btnclose.TextID = MyInternationalizationString.unmanned; + iASZonedevicefra.AddChidren(openrowlayout); + //iASZonedevicefra.AddChidren(closerowlayout); } break; case 21: - case 22: { - #region - devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 * 3 - 20 - 50); - devicefra.Height = Application.GetRealHeight(140 + 160 * 3 + 20 + 50); btnopen.TextID = MyInternationalizationString.logicopen; btnclose.TextID = MyInternationalizationString.logicclose; - closerowlayout.LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor; - openframelayout.AddChidren(openrowlayout); - closeframelayout.AddChidren(closerowlayout); - - - - var timeoutframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = closeframelayout.Bottom, - }; - devicefra.AddChidren(timeoutframelayout); - var timeoutrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - timeoutframelayout.AddChidren(timeoutrowlayout); - - var btntimeout = new Button - { - TextID = MyInternationalizationString.closetimeout, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - }; - timeoutrowlayout.AddChidren(btntimeout); - - var timeoutBtnSelected = new Button - { - X = Application.GetRealWidth(860), - Width = Application.GetMinRealAverage(60), - Height = Application.GetMinRealAverage(60), - UnSelectedImagePath = "ZigeeLogic/next.png", - Gravity = Gravity.CenterVertical, - }; - timeoutrowlayout.AddChidren(timeoutBtnSelected); - EventHandler<MouseEventArgs> timeoutclick = (sender, e) => - { - SelectedDeviceStatuscondition = "no"; - btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - var ignoreTime = new IgnoreTime(); - UserView.HomePage.Instance.AddChidren(ignoreTime); - UserView.HomePage.Instance.PageIndex += 1; - ignoreTime.Show(common, btntimeout.Text, edit, timevalue); - - }; - timeoutframelayout.MouseUpEventHandler += timeoutclick; - timeoutrowlayout.MouseUpEventHandler += timeoutclick; - btntimeout.MouseUpEventHandler += timeoutclick; - timeoutBtnSelected.MouseUpEventHandler += timeoutclick; - - #endregion + iASZonedevicefra.AddChidren(openrowlayout); + iASZonedevicefra.AddChidren(closerowlayout); + } + break; + case 22: + { + btnopen.TextID = MyInternationalizationString.logicopen; + btnclose.TextID = MyInternationalizationString.logicclose; + iASZonedevicefra.AddChidren(openrowlayout); + iASZonedevicefra.AddChidren(closerowlayout); } break; case 40: { - devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50); - devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50); btnopen.TextID = MyInternationalizationString.smokescreen; //btnclose.TextID = MyInternationalizationString.nosmokescreen; - openframelayout.AddChidren(openrowlayout); - openrowlayout.LineColor = ZigbeeColor.Current.LogicBackgroundColor; + iASZonedevicefra.AddChidren(openrowlayout); } break; case 42: { btnopen.TextID = MyInternationalizationString.waterleakage; btnclose.TextID = MyInternationalizationString.noleakage; - openframelayout.AddChidren(openrowlayout); - closeframelayout.AddChidren(closerowlayout); - + iASZonedevicefra.AddChidren(openrowlayout); + iASZonedevicefra.AddChidren(closerowlayout); } break; case 43: { - devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50); - devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50); btnopen.TextID = MyInternationalizationString.gas; //btnclose.TextID = MyInternationalizationString.nogas; - openframelayout.AddChidren(openrowlayout); - openrowlayout.LineColor = ZigbeeColor.Current.LogicBackgroundColor; + iASZonedevicefra.AddChidren(openrowlayout); } break; case 44: { - devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50); - devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50); btnopen.TextID = MyInternationalizationString.emergencybutton; //btnclose.TextID = MyInternationalizationString.nosmokescreen; - openframelayout.AddChidren(openrowlayout); - openrowlayout.LineColor = ZigbeeColor.Current.LogicBackgroundColor; + iASZonedevicefra.AddChidren(openrowlayout); } break; case 277: { - devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50); - devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50); btnopen.TextID = MyInternationalizationString.callthepolice; //btnclose.TextID = MyInternationalizationString.nosmokescreen; - openframelayout.AddChidren(openrowlayout); - openrowlayout.LineColor = ZigbeeColor.Current.LogicBackgroundColor; + iASZonedevicefra.AddChidren(openrowlayout); } break; default: { - devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50); - devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50); btnopen.TextID = MyInternationalizationString.callthepolice; - openframelayout.AddChidren(openrowlayout); - openrowlayout.LineColor = ZigbeeColor.Current.LogicBackgroundColor; + iASZonedevicefra.AddChidren(openrowlayout); } break; } @@ -1282,229 +977,138 @@ { if (devices["AttriButeData1"] == "1") { - btnopen.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; openBtnSelected.Visible = true; closeBtnSelected.Visible = false; } else { - if (devices.ContainsKey("IgnoreTime")) - { - timevalue = int.Parse(devices["IgnoreTime"]); - } - else - { - btnopen.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; - btnclose.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - } + openBtnSelected.Visible = false; + closeBtnSelected.Visible = true; } } - - } } break; case DeviceType.OnOffSwitch: { + if (deviceConditionsInfo.ContainsKey("Cluster_ID")) + { + deviceConditionsInfo.Remove("Cluster_ID"); + } + if (deviceConditionsInfo.ContainsKey("AttriButeId")) + { + deviceConditionsInfo.Remove("AttriButeId"); + } + if (deviceConditionsInfo.ContainsKey("Range")) + { + deviceConditionsInfo.Remove("Range"); + } + if (deviceConditionsInfo.ContainsKey("AttriButeData1")) + { + deviceConditionsInfo.Remove("AttriButeData1"); + } + if (deviceConditionsInfo.ContainsKey("AttriButeData2")) + { + deviceConditionsInfo.Remove("AttriButeData2"); + } + deviceConditionsInfo.Add("Cluster_ID", "1282"); + deviceConditionsInfo.Add("AttriButeId", "1283"); + deviceConditionsInfo.Add("Range", "0");//鎸夐敭鐗规畩 + deviceConditionsInfo.Add("AttriButeData1", "0"); + deviceConditionsInfo.Add("AttriButeData2", "0"); - dictionary(deviceConditionsInfo, "Cluster_ID", "1282"); - dictionary(deviceConditionsInfo, "AttriButeId", "1283"); - dictionary(deviceConditionsInfo, "Range", "0");//鎸夐敭鐗规畩 - dictionary(deviceConditionsInfo, "AttriButeData1", "0"); - dictionary(deviceConditionsInfo, "AttriButeData2", "0"); - - devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 - 20 - 50); - devicefra.Height = Application.GetRealHeight(140 + 160 + 20 + 50); + devicefra.Y = Application.GetRealHeight(1920 - 30 - 720); + devicefra.Height = Application.GetRealHeight(720); var OnOffOutputfra = new FrameLayout { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(20), + Y = Application.GetRealHeight(180), + Height = Application.GetRealHeight(180 * 2 + 30), }; devicefra.AddChidren(OnOffOutputfra); var buttonRow = new RowLayout { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, + Height = Application.GetRealHeight(180), }; OnOffOutputfra.AddChidren(buttonRow); var button = new Button { - Width = Application.GetRealWidth(600), + //TextID = MyInternationalizationString.button1, TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - Text = Language.StringByID(MyInternationalizationString.OnOffSwitch) + common.DeviceEpoint.ToString(), + X = Application.GetRealWidth(40), + Width = Application.GetRealWidth(300), + Height = Application.GetRealHeight(180), + Text=Language.StringByID(MyInternationalizationString.OnOffSwitch)+common.DeviceEpoint.ToString(), //SelectedBackgroundColor = 0xfffe5e00, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, }; buttonRow.AddChidren(button); - var buttonSelected = new SelectedButton(); + var buttonSelected = new Button + { + X = Application.GetRealWidth(1000 - 150), + Width = Application.GetMinRealAverage(110), + Height = Application.GetMinRealAverage(110), + UnSelectedImagePath = "Item/YesSelected.png", + Visible = false, + Gravity = Gravity.CenterVertical + }; buttonRow.AddChidren(buttonSelected); - EventHandler<MouseEventArgs> buttonclick = (sender, e) => + EventHandler<MouseEventArgs> buttonclick = (sender, e) => { buttonSelected.Visible = true; - SelectedDeviceStatuscondition = "OnOffSwitch"; - button.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + SelectedDeviceStatuscondition = "yes"; }; buttonRow.MouseUpEventHandler += buttonclick; button.MouseUpEventHandler += buttonclick; buttonSelected.MouseUpEventHandler += buttonclick; - OnOffOutputfra.MouseUpEventHandler += buttonclick; if (edit && devices != null) { buttonSelected.Visible = true; - button.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; } - - } - break; - case DeviceType.DoorLock: - { - #region ------ - var doorlockifonlist = Send.ReadDoorLockIfon("ccccccfffe300347"); - //var list = Send.ReadDoorLockIfon(common.DeviceAddr); - var pra = new UserCenter.MemberListInfoPra(); - string result = await UserCenter.UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra); - var listInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<UserCenter.MemberInfoRes>>(result); - Send.UserList.Clear(); - for (int i = 0; i < listInfo.Count; i++) - { - var membership = new Send.MembershipIfon(); - var membershipifon = listInfo[i]; - for (int j = 0; j < doorlockifonlist.Count; j++) - { - ///鏌ユ壘鎴愬憳浠ュ強鎴愬憳闂ㄩ攣瑙﹀彂婧�(1鎸夐敭/3鍗�/15鎸囩汗) - if (doorlockifonlist[j].CloudAccountId == membershipifon.SubAccountDistributedMark) - { - membership.UserIdMode.Add(doorlockifonlist[j].UserIdMode); - membership.MembershipName = membershipifon.UserName; - membership.MembershipId = membershipifon.SubAccountDistributedMark; - - } - - } - if (membership.UserIdMode.Count != 0) - { - ///杩囨护鎺夐噸澶嶆暟鎹紱 - var str = Send.UserList.Find((c) => { return c.MembershipId == membership.MembershipId; }); - if (str == null) - { - Send.UserList.Add(membership); - } - } - - } - #endregion - - var memberList = new MemberList(); - UserView.HomePage.Instance.AddChidren(memberList); - UserView.HomePage.Instance.PageIndex += 1; - MemberList.action += () => { flMain.RemoveFromParent(); }; - memberList.Show(common); + } break; - case DeviceType.TemperatureSensor: - { - devicefra.Y = Application.GetRealHeight(1920 - 140 - 160 * 2 - 20 - 50); - devicefra.Height = Application.GetRealHeight(140 + 160 * 2 + 20 + 50); - var temperatureSensor = common as TemperatureSensor; - var Btntemperaturevalue = new Button - { - TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - Height = Application.GetRealHeight(60), - Width = Application.GetRealWidth(400), - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(80), - Y = timetype.Bottom + Application.GetRealHeight(70), - }; - devicefra.AddChidren(Btntemperaturevalue); - - var horizontalSeekBarVol = new HorizontalSeekBar - { - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(80), - Radius = (uint)Application.GetRealHeight(25), - Y = timetype.Bottom + Application.GetRealHeight(70 + 60 + 70), - X = Application.GetRealWidth(80), - ProgressColor = ZigbeeColor.Current.LogicProgressColorSelected, - Max = 100, - SleepTime = 1000, - ThumbRadius = 9, - }; - devicefra.AddChidren(horizontalSeekBarVol); - horizontalSeekBarVol.MouseUpEventHandler += (sender, e) => - { - SelectedDeviceStatuscondition = "TemperatureSensor"; - if (temperatureSensor.SensorDiv == 1) - { - dictionary(deviceConditionsInfo, "AttriButeData1", horizontalSeekBarVol.Progress.ToString()); - - Btntemperaturevalue.Text = "褰撳墠>" + horizontalSeekBarVol.Progress.ToString() + "鈩�"; - - } - else - { - Btntemperaturevalue.Text = "褰撳墠<" + horizontalSeekBarVol.Progress.ToString() + "%"; - dictionary(deviceConditionsInfo, "AttriButeData1", horizontalSeekBarVol.Progress.ToString());//娓╁害鍊� - } - }; - - - - if (temperatureSensor.SensorDiv == 1) - { - dictionary(deviceConditionsInfo, "Cluster_ID", "1026"); - dictionary(deviceConditionsInfo, "AttriButeId", "0"); - dictionary(deviceConditionsInfo, "Range", "0");//0澶т簬AttriButeData1鏃惰Е鍙戝姩浣� - dictionary(deviceConditionsInfo, "AttriButeData1", "0"); - dictionary(deviceConditionsInfo, "AttriButeData2", "0"); - Btntemperaturevalue.Text = "褰撳墠>0鈩�"; - - } - else - { - Btntemperaturevalue.Text = "褰撳墠<0%"; - dictionary(deviceConditionsInfo, "Cluster_ID", "1029"); - dictionary(deviceConditionsInfo, "AttriButeId", "0"); - dictionary(deviceConditionsInfo, "Range", "2");//2灏忎簬AttriButeData1鏃惰Е鍙戝姩浣� - dictionary(deviceConditionsInfo, "AttriButeData1", "0");//娓╁害鍊� - dictionary(deviceConditionsInfo, "AttriButeData2", "0"); - } - - if (edit && devices != null) - { - horizontalSeekBarVol.Progress = int.Parse(devices["AttriButeData1"]); - if (temperatureSensor.SensorDiv == 1) - { - - Btntemperaturevalue.Text = "褰撳墠>" + devices["AttriButeData1"] + "鈩�"; - - } - else - { - Btntemperaturevalue.Text = "褰撳墠<" + devices["AttriButeData1"] + "%"; - } - } - - } - break; } - Btncomplete.MouseUpEventHandler += (sender2, e2) => + + var cancel = new Button + { + Height = Application.GetRealHeight(160), + TextID = MyInternationalizationString.cancel, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + TextSize = 16, + BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor, + Y = devicefra.Height - Application.GetRealHeight(160), + + }; + devicefra.AddChidren(cancel); + cancel.MouseUpEventHandler += (sender, e) => + { + flMain.RemoveFromParent(); + UserView.HomePage.Instance.ScrollEnabled = true; + }; + + + var btnSave = new Button + { + Y = Application.GetRealHeight(20), + Width = Application.GetRealWidth(200), + Height = Application.GetRealHeight(150), + Text = Language.StringByID(MyInternationalizationString.complete), + TextColor = ZigbeeColor.Current.LogicTextBlueColor, + X = Application.GetRealWidth(1000 - 200), + }; + devicefra.AddChidren(btnSave); + btnSave.MouseUpEventHandler += (sender2, e2) => { //UserView.HomePage.Instance.ScrollEnabled = true; - if (SelectedDeviceStatuscondition != "") + if (SelectedDeviceStatuscondition == "yes") { LogicIfon.AddDeviceconditions(common, deviceConditionsInfo); } @@ -1531,16 +1135,6 @@ } - public static void dictionary(Dictionary<string, string> deviceConditionsInfo, string Key, string Value) - { - if (deviceConditionsInfo.ContainsKey(Key)) - { - deviceConditionsInfo.Remove(Key); - } - deviceConditionsInfo.Add(Key, Value); - } - - } } -- Gitblit v1.8.0