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/LogicDevicePage.cs | 2001 ++++++++++++++-------------------------------------------- 1 files changed, 479 insertions(+), 1,522 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicDevicePage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicDevicePage.cs index cb9097a..296d3fb 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicDevicePage.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicDevicePage.cs @@ -16,139 +16,83 @@ { 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 + this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor; + + var topFrameLayout = new RowLayout { - BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor, - Height = Application.GetRealHeight(184), - LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor, + Height = Application.GetRealHeight(220), + Y = Application.GetRealHeight(80), + BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor, }; - this.AddChidren(topRowLayout); + 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); - #endregion + topFrameLayout.AddChidren(roomname); - - ///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱 - 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() - { - 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), + AddChidren(horizontalScrolfl); + + horizontalScrol = new HorizontalScrolViewLayout() + { + 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.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); ///鐩墠鏀寔鐨勮澶� @@ -156,14 +100,10 @@ DeviceType.OnOffOutput, DeviceType.DimmableLight, DeviceType.WindowCoveringDevice, - DeviceType.Thermostat, - DeviceType.AirSwitch, }; - - - ///妤煎眰鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> foorlclick = (sender, e) => + ///鎴块棿鐐瑰嚮浜嬩欢 + roomname.MouseUpEventHandler += (sender, e) => { var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; @@ -172,191 +112,101 @@ { 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 customroom1 = 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 = customroom1.GetDeviceUI(device); + if (deviceui != null) { - roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId); + customroom1.DeviceUIList.Add(deviceui); } - } - 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); - - } - - - 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(customroom1.DeviceUIList); } /// <summary> ///鍔犺浇璇ュ尯鍩熸墍鏈夎澶囩殑瑙嗗浘鏂规硶 /// </summary> - void AllDeviceTypeView(List<DeviceUI> devicelist, HorizontalScrolViewLayout devicetypehorizontalScrol) + void AllDeviceTypeView(List<DeviceUI> devicelist) { List<string> devicetypelist = new List<string>(); devicetypelist.Clear(); - + #region ------鎺掑垪璁惧绫诲瀷------ var lightjosn = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.DimmableLight || device.CommonDevice.Type == DeviceType.OnOffOutput); if (lightjosn != null) @@ -368,99 +218,58 @@ { devicetypelist.Add(Language.StringByID(MyInternationalizationString.Curtains)); } - var ac = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.Thermostat); - if (ac != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.AC)); - } - var airSwitch = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.AirSwitch); - if (airSwitch != null) - { - devicetypelist.Add(Language.StringByID(MyInternationalizationString.Airswitch)); - } - + #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.UnSelectedImagePath = "ZigeeLogic/Light.png"; + devicetypeicon.SelectedImagePath = "ZigeeLogic/LightSelected.png"; } else if (devicetype == Language.StringByID(MyInternationalizationString.Curtains)) { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedcurtain.png"; + devicetypeicon.UnSelectedImagePath = "ZigeeLogic/Curtain.png"; + devicetypeicon.SelectedImagePath = "ZigeeLogic/CurtainSelected.png"; } - else if (devicetype == Language.StringByID(MyInternationalizationString.AC)) + + + + var devicetypename = new Button { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedac.png"; - } - else if (devicetype == Language.StringByID(MyInternationalizationString.Airswitch)) - { - devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedairswitch.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) => { - - devicetypeButton.IsSelected = false; - devicetypeButton = backgroundColor; - backgroundColor.IsSelected = true; List<DeviceType> list = new List<DeviceType>(); list.Clear(); + SelectedButton.IsSelected = false; + SelectedButton = devicetypeicon; + SelectedButton.IsSelected = true; ///鍒嗙被鏄剧ず锛堜緥濡傜伅鍏夛細{鐏厜1锛岀伅鍏�2...}锛� if (devicetype == Language.StringByID(MyInternationalizationString.Lights)) { @@ -471,14 +280,6 @@ { list.Add(DeviceType.WindowCoveringDevice); } - else if (devicetype == Language.StringByID(MyInternationalizationString.AC)) - { - list.Add(DeviceType.Thermostat); - } - else if (devicetype == Language.StringByID(MyInternationalizationString.Airswitch)) - { - list.Add(DeviceType.AirSwitch); - } ActionDeviceView(list, devicelist); @@ -486,17 +287,16 @@ deviceRowLayout.MouseUpEventHandler += devicetypeclick; devicetypename.MouseUpEventHandler += devicetypeclick; devicetypeicon.MouseUpEventHandler += devicetypeclick; - backgroundColor.MouseUpEventHandler += devicetypeclick; } ///鏄剧ず鎴块棿鎵�鏈夎澶� - ActionDeviceView(new List<DeviceType>(), devicelist); + ActionDeviceView( new List<DeviceType>(), devicelist); } /// <summary> /// 鍔犺浇璇ョ被鍨嬭澶囪鍥炬柟娉� /// </summary> /// <param name="devicelist">璁惧鍒楄〃</param> - void ActionDeviceView(List<DeviceType> deviceTypelist, List<DeviceUI> devicelist) + void ActionDeviceView( List<DeviceType> deviceTypelist, List<DeviceUI> devicelist) { middle.RemoveAll(); foreach (var common in devicelist) @@ -506,109 +306,45 @@ { 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.DimmableLight: - { - - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/dimmableLight.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selecteddimmableLight.png"; - } - break; - case DeviceType.WindowCoveringDevice: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/curtain.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedcurtain.png"; - } - break; - case DeviceType.Thermostat: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/ac.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedac.png"; - } - break; - case DeviceType.AirSwitch: - { - deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/airswitch.png"; - deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedairswitch.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); CurrentDeviceStateView(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; } } @@ -628,76 +364,50 @@ { 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 + 160), - Y = Application.GetRealHeight(1920 - 530 - 160), + 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 - { - 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 + + var devicename = 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); + + + + if (actionsInfo.ContainsKey("LinkType")) { - 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 SelectedDeviceStatusaction = "no"; + actionsInfo.Remove("LinkType"); + } + if (actionsInfo.ContainsKey("DeviceAddr")) + { + actionsInfo.Remove("DeviceAddr"); + } + if (actionsInfo.ContainsKey("Epoint")) + { + actionsInfo.Remove("Epoint"); + } + if (actionsInfo.ContainsKey("Time")) + { + actionsInfo.Remove("Time"); + } + if (actionsInfo.ContainsKey("TaskList")) + { + actionsInfo.Remove("TaskList"); + } actionsInfo.Add("LinkType", 0); actionsInfo.Add("DeviceAddr", common.DeviceAddr); actionsInfo.Add("Epoint", common.DeviceEpoint); @@ -722,7 +432,6 @@ } switch (common.Type) { - ///鐏厜 case DeviceType.OnOffOutput: { @@ -745,162 +454,123 @@ switchdictionary.Add("Data1", "0"); switchdictionary.Add("Data2", "0"); taskListInfo.Add(switchdictionary); - + #endregion #region 鐏厜View - #region 寮� - - 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(600), + Height = Application.GetRealHeight(180), + //SelectedBackgroundColor = 0xfffe5e00, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, }; openrowlayout.AddChidren(btnopen); - var openBtnSelected = new SelectedButton(); - openrowlayout.AddChidren(openBtnSelected); - #endregion - #region 鍏� - var closeframelayout = new FrameLayout + var openBtnSelected = new Button { - Height = Application.GetRealHeight(160), - Y = openframelayout.Bottom, + X = Application.GetRealWidth(1000 - 150), + Width = Application.GetMinRealAverage(110), + Height = Application.GetMinRealAverage(110), + UnSelectedImagePath = "Item/YesSelected.png", + Visible = false, + Gravity = Gravity.CenterVertical }; - devicefra.AddChidren(closeframelayout); + openrowlayout.AddChidren(openBtnSelected); + var closerowlayout = new RowLayout { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, + 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(600), + 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 - #region 鍙栧弽 - var takebackframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = closeframelayout.Bottom, - }; - devicefra.AddChidren(takebackframelayout); - var takebackrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - takebackframelayout.AddChidren(takebackrowlayout); - - var btntakeback = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.onoff, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - }; - takebackrowlayout.AddChidren(btntakeback); - - var takebackBtnSelected = new SelectedButton(); - takebackrowlayout.AddChidren(takebackBtnSelected); - - #endregion - #endregion ///纭浜嬩欢 EventHandler<MouseEventArgs> openclick = (sender, e) => { - SelectedDeviceStatusaction = "yes"; openBtnSelected.Visible = true; closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; if (switchdictionary.ContainsKey("Data1")) { switchdictionary.Remove("Data1"); } switchdictionary.Add("Data1", "1");//榛樿鍊� - + LogicIfon.AddDeviceactions(common,actionsInfo); + var logicCommunalPage = new LogicCommunalPage(); + UserView.HomePage.Instance.AddChidren(logicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + logicCommunalPage.Show(() => { }); }; openrowlayout.MouseUpEventHandler += openclick; btnopen.MouseUpEventHandler += openclick; openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; ///鍙栨秷浜嬩欢 EventHandler<MouseEventArgs> closeclick = (sender, e) => { - SelectedDeviceStatusaction = "yes"; openBtnSelected.Visible = false; closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; if (switchdictionary.ContainsKey("Data1")) { switchdictionary.Remove("Data1"); } switchdictionary.Add("Data1", "0");//榛樿鍊� - + LogicIfon.AddDeviceactions(common, actionsInfo); + var logicCommunalPage = new LogicCommunalPage(); + UserView.HomePage.Instance.AddChidren(logicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + logicCommunalPage.Show(() => { }); }; closerowlayout.MouseUpEventHandler += closeclick; btnclose.MouseUpEventHandler += closeclick; closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; - //鍙栧弽 - EventHandler<MouseEventArgs> takebackclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "2");//榛樿鍊� + - }; - takebackrowlayout.MouseUpEventHandler += takebackclick; - btntakeback.MouseUpEventHandler += takebackclick; - takebackBtnSelected.MouseUpEventHandler += takebackclick; - takebackframelayout.MouseUpEventHandler += takebackclick; if (edit && TaskList != null) { foreach (var value in TaskList) @@ -916,21 +586,12 @@ switchdictionary.Add("Data1", "1"); openBtnSelected.Visible = true; closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; } - else if (value["Data1"] == "0") + else { switchdictionary.Add("Data1", "0"); openBtnSelected.Visible = false; closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - } - else if (value["Data1"] == "2") - { - switchdictionary.Add("Data1", "2"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; } break; } @@ -946,290 +607,208 @@ #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- Dictionary<string, string> switchdictionary = new Dictionary<string, string>(); + if (switchdictionary.ContainsKey("TaskType")) + { + switchdictionary.Remove("TaskType"); + } + if (switchdictionary.ContainsKey("Data1")) + { + switchdictionary.Remove("Data1"); + } if (switchdictionary.ContainsKey("Data2")) { switchdictionary.Remove("Data2"); } + switchdictionary.Add("TaskType", "1"); + switchdictionary.Add("Data1", "0"); switchdictionary.Add("Data2", "0"); taskListInfo.Add(switchdictionary); - + //Dictionary<string, string> brightnessdictionary = new Dictionary<string, string>(); + //if (brightnessdictionary.ContainsKey("TaskType")) + //{ + // switchdictionary.Remove("TaskType"); + //} + //if (brightnessdictionary.ContainsKey("Data1")) + //{ + // brightnessdictionary.Remove("Data1"); + //} + //if (brightnessdictionary.ContainsKey("Data2")) + //{ + // switchdictionary.Remove("Data2"); + //} + //brightnessdictionary.Add("TaskType", "3"); + //brightnessdictionary.Add("Data1", "0"); + //brightnessdictionary.Add("Data2", "0"); + //taskListInfo.Add(brightnessdictionary); #endregion #region 鐏厜View - devicefra.Y = Application.GetRealHeight(1920 - 160 * 3 - 210 - 160); - devicefra.Height = Application.GetRealHeight(160 * 3 + 210 + 160); - - #region 寮� - - var openframelayout = new FrameLayout + devicefra.Y = Application.GetRealHeight(1920 - 30 - 900); + devicefra.Height = Application.GetRealHeight(900); + var OnOffOutputfra = new FrameLayout { - Height = Application.GetRealHeight(160 + 160), - Y = timetype.Bottom + Application.GetRealHeight(20), + Y = Application.GetRealHeight(180), + Height = Application.GetRealHeight(180 * 3 + 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.LogicBackgroundColor, + 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(600), + 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 horizontalSeekBarRow = new RowLayout - { - Y = openrowlayout.Bottom, - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(160), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - openframelayout.AddChidren(horizontalSeekBarRow); - var horizontalSeekBarVol = new HorizontalSeekBar - { - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(80), - Radius = (uint)Application.GetRealHeight(25), - Y = Application.GetRealHeight(25), - //Gravity = Gravity.CenterVertical, - ProgressColor = ZigbeeColor.Current.LogicProgressColorSelected, - Max = 100, - SleepTime = 1000, - ThumbRadius = 9, - IsCanMove = false - }; - horizontalSeekBarRow.AddChidren(horizontalSeekBarVol); - - #endregion - - #region 鍏� - 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.LogicRowLayoutLineColor, + 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(600), + 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 - #region 鍙栧弽 - var takebackframelayout = new FrameLayout + var customrowlayout = new RowLayout { - Height = Application.GetRealHeight(160), - Y = closeframelayout.Bottom, + Height = Application.GetRealHeight(180), + Y = closerowlayout.Bottom, }; - devicefra.AddChidren(takebackframelayout); - var takebackrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - takebackframelayout.AddChidren(takebackrowlayout); + OnOffOutputfra.AddChidren(customrowlayout); - var btntakeback = new Button + var Btncustom = new Button { - //Text = "鍏�", - TextID = MyInternationalizationString.onoff, - Width = Application.GetRealWidth(600), + //Text = "鑷畾涔変寒搴�", + TextID = MyInternationalizationString.custombrightness, TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - }; - takebackrowlayout.AddChidren(btntakeback); - - var takebackBtnSelected = new SelectedButton(); - takebackrowlayout.AddChidren(takebackBtnSelected); - - #endregion - - - #endregion - - int Progressvalue = 100; - horizontalSeekBarVol.ProgressChanged += (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - Progressvalue = horizontalSeekBarVol.Progress; - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("TaskType", "3"); - //鏈�澶т寒搴﹀�兼槸254闇�瑕佽浆鎹紱 - var lightbrightnessvalue = (254 * horizontalSeekBarVol.Progress) / 100; - switchdictionary.Add("Data1", lightbrightnessvalue.ToString()); + X = Application.GetRealWidth(40), + Width = Application.GetRealWidth(600), + Height = Application.GetRealHeight(180), + TextColor = ZigbeeColor.Current.LogicTextBlackColor, }; + customrowlayout.AddChidren(Btncustom); + #endregion + ///纭浜嬩欢 EventHandler<MouseEventArgs> openclick = (sender, e) => { - SelectedDeviceStatusaction = "yes"; - horizontalSeekBarVol.IsCanMove = true; - horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColorSelected; openBtnSelected.Visible = true; closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; - horizontalSeekBarVol.Progress = Progressvalue; - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } if (switchdictionary.ContainsKey("Data1")) { switchdictionary.Remove("Data1"); } - switchdictionary.Add("TaskType", "3"); - //鏈�澶т寒搴﹀�兼槸254闇�瑕佽浆鎹紱 - var lightbrightnessvalue = (254 * horizontalSeekBarVol.Progress) / 100; - switchdictionary.Add("Data1", lightbrightnessvalue.ToString()); + switchdictionary.Add("Data1", "1");//榛樿鍊� + LogicIfon.AddDeviceactions(common, actionsInfo); + var logicCommunalPage = new LogicCommunalPage(); + UserView.HomePage.Instance.AddChidren(logicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + logicCommunalPage.Show(() => { }); }; openrowlayout.MouseUpEventHandler += openclick; btnopen.MouseUpEventHandler += openclick; openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; ///鍙栨秷浜嬩欢 EventHandler<MouseEventArgs> closeclick = (sender, e) => { - SelectedDeviceStatusaction = "yes"; - horizontalSeekBarVol.IsCanMove = false; - horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColor; openBtnSelected.Visible = false; closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } if (switchdictionary.ContainsKey("Data1")) { switchdictionary.Remove("Data1"); } - switchdictionary.Add("TaskType", "1"); switchdictionary.Add("Data1", "0");//榛樿鍊� - + LogicIfon.AddDeviceactions(common, actionsInfo); + var logicCommunalPage = new LogicCommunalPage(); + UserView.HomePage.Instance.AddChidren(logicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + logicCommunalPage.Show(() => { }); }; closerowlayout.MouseUpEventHandler += closeclick; btnclose.MouseUpEventHandler += closeclick; closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; - //鍙栧弽 - EventHandler<MouseEventArgs> takebackclick = (sender, e) => + ///鑷畾涔変寒搴︿簨浠� + EventHandler<MouseEventArgs> customclick = (sender, e) => { - SelectedDeviceStatusaction = "yes"; - horizontalSeekBarVol.IsCanMove = false; - horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColor; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("TaskType", "1"); - switchdictionary.Add("Data1", "2");//榛樿鍊� + var setDeviceState = new SetDeviceState(); + UserView.HomePage.Instance.AddChidren(setDeviceState); + UserView.HomePage.Instance.PageIndex += 1; + setDeviceState.Show(common, Btncustom.Text, edit); }; - takebackrowlayout.MouseUpEventHandler += takebackclick; - btntakeback.MouseUpEventHandler += takebackclick; - takebackBtnSelected.MouseUpEventHandler += takebackclick; - takebackframelayout.MouseUpEventHandler += takebackclick; + customrowlayout.MouseUpEventHandler += customclick; + Btncustom.MouseUpEventHandler += customclick; if (edit && TaskList != null) { foreach (var value in TaskList) { - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } if (value["TaskType"] == "1") { - switchdictionary.Add("TaskType", "1"); - if (value["Data1"] == "0") + if (switchdictionary.ContainsKey("Data1")) + { + switchdictionary.Remove("Data1"); + } + if (value["Data1"] == "1") + { + switchdictionary.Add("Data1", "1"); + openBtnSelected.Visible = true; + closeBtnSelected.Visible = false; + } + else { switchdictionary.Add("Data1", "0"); openBtnSelected.Visible = false; closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - horizontalSeekBarVol.IsCanMove = false; - horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColor; } - else if (value["Data1"] == "2") - { - switchdictionary.Add("Data1", "2"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - horizontalSeekBarVol.IsCanMove = false; - horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColor; - } - + break; } - else if (value["TaskType"] == "3") - { - switchdictionary.Add("TaskType", "3"); - switchdictionary.Add("Data1", value["Data1"]); - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; - horizontalSeekBarVol.IsCanMove = true; - horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColorSelected; - horizontalSeekBarVol.Progress = int.Parse(value["Data1"])*100/254; - Progressvalue = horizontalSeekBarVol.Progress; - - } - break; } } @@ -1245,201 +824,198 @@ { switchdictionary.Remove("TaskType"); } + if (switchdictionary.ContainsKey("Data1")) + { + switchdictionary.Remove("Data1"); + } + if (switchdictionary.ContainsKey("Data2")) + { + switchdictionary.Remove("Data2"); + } switchdictionary.Add("TaskType", "6"); - + switchdictionary.Add("Data1", "1"); + switchdictionary.Add("Data2", "0"); taskListInfo.Add(switchdictionary); - #endregion - devicefra.Y = Application.GetRealHeight(1920 - 160 * 2 - 210 - 160); - devicefra.Height = Application.GetRealHeight(160 * 2 + 210 + 160); + //Dictionary<string, string> brightnessdictionary = new Dictionary<string, string>(); + //if (brightnessdictionary.ContainsKey("TaskType")) + //{ + // brightnessdictionary.Remove("TaskType"); + //} + //if (brightnessdictionary.ContainsKey("Data2")) + //{ + // brightnessdictionary.Remove("Data2"); + //} + //if (brightnessdictionary.ContainsKey("Data1")) + //{ + // brightnessdictionary.Remove("Data1"); + //} + //brightnessdictionary.Add("TaskType", "6"); + //brightnessdictionary.Add("Data1", "5"); + //brightnessdictionary.Add("Data2", "0"); + //taskListInfo.Add(brightnessdictionary); + #endregion + #region 绐楀笜View - - #region 寮� - - var openframelayout = new FrameLayout + devicefra.Y = Application.GetRealHeight(1920 - 30 - 900); + devicefra.Height = Application.GetRealHeight(900); + var windowCoveringfra = new FrameLayout { - Height = Application.GetRealHeight(160 + 160), - Y = timetype.Bottom + Application.GetRealHeight(20), + Y = Application.GetRealHeight(180), + Height = Application.GetRealHeight(180 * 3 + 30), }; - devicefra.AddChidren(openframelayout); + devicefra.AddChidren(windowCoveringfra); var openrowlayout = new RowLayout { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor, + Height = Application.GetRealHeight(180), }; - openframelayout.AddChidren(openrowlayout); + windowCoveringfra.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 horizontalSeekBarRow = new RowLayout - { - Y = openrowlayout.Bottom, - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(160), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - openframelayout.AddChidren(horizontalSeekBarRow); - var horizontalSeekBarVol = new HorizontalSeekBar - { - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(80), - Radius = (uint)Application.GetRealHeight(25), - Y = Application.GetRealHeight(25), - //Gravity = Gravity.CenterVertical, - ProgressColor = ZigbeeColor.Current.LogicProgressColorSelected, - Max = 100, - SleepTime = 1000, - ThumbRadius = 9, - IsCanMove = false - }; - horizontalSeekBarRow.AddChidren(horizontalSeekBarVol); - - #endregion - - #region 鍏� - 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.LogicBlankBackgroundColor, + Y = openrowlayout.Bottom, + Height = Application.GetRealHeight(180), }; - closeframelayout.AddChidren(closerowlayout); + windowCoveringfra.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(); - closerowlayout.AddChidren(closeBtnSelected); - #endregion - - - - #endregion - int Progressvalue = 100; - horizontalSeekBarVol.ProgressChanged += (sender, e) => + var closeBtnSelected = new Button { - SelectedDeviceStatusaction = "yes"; - Progressvalue = horizontalSeekBarVol.Progress; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("Data1", "5"); - switchdictionary.Add("Data2", horizontalSeekBarVol.Progress.ToString()); + 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); + + + var customrowlayout = new RowLayout + { + Height = Application.GetRealHeight(180), + Y = closerowlayout.Bottom, + }; + windowCoveringfra.AddChidren(customrowlayout); + + var Btncustom = new Button + { + //Text = "鑷畾涔夌櫨鍒嗘瘮", + TextID = MyInternationalizationString.custompercentage, + TextAlignment = TextAlignment.CenterLeft, + X = Application.GetRealWidth(40), + Width = Application.GetRealWidth(600), + Height = Application.GetRealHeight(180), + TextColor = ZigbeeColor.Current.LogicTextBlackColor, }; - ///纭浜嬩欢 + customrowlayout.AddChidren(Btncustom); + #endregion + + ///鐐瑰嚮纭浜嬩欢 EventHandler<MouseEventArgs> openclick = (sender, e) => { - SelectedDeviceStatusaction = "yes"; - horizontalSeekBarVol.IsCanMove = true; - horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColorSelected; + openBtnSelected.Visible = true; closeBtnSelected.Visible = false; - horizontalSeekBarVol.Progress = Progressvalue; if (switchdictionary.ContainsKey("Data1")) { switchdictionary.Remove("Data1"); } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("Data1", "5"); - switchdictionary.Add("Data2", horizontalSeekBarVol.Progress.ToString()); + switchdictionary.Add("Data1", "0"); + + LogicIfon.AddDeviceactions(common, actionsInfo); + var logicCommunalPage = new LogicCommunalPage(); + UserView.HomePage.Instance.AddChidren(logicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + logicCommunalPage.Show(() => { }); }; openrowlayout.MouseUpEventHandler += openclick; btnopen.MouseUpEventHandler += openclick; openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; - ///鍙栨秷浜嬩欢 + ///鐐瑰嚮鍙栨秷浜嬩欢 EventHandler<MouseEventArgs> closeclick = (sender, e) => { - SelectedDeviceStatusaction = "yes"; - horizontalSeekBarVol.IsCanMove = false; - horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColor; openBtnSelected.Visible = false; closeBtnSelected.Visible = true; - if (switchdictionary.ContainsKey("Data1")) { switchdictionary.Remove("Data1"); } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("Data2", "0"); - switchdictionary.Add("Data1", "1");//榛樿鍊� + switchdictionary.Add("Data1", "1"); + LogicIfon.AddDeviceactions(common, actionsInfo); + var logicCommunalPage = new LogicCommunalPage(); + UserView.HomePage.Instance.AddChidren(logicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + logicCommunalPage.Show(() => { }); }; closerowlayout.MouseUpEventHandler += closeclick; btnclose.MouseUpEventHandler += closeclick; closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; + ///鑷畾涔変寒搴︿簨浠� + EventHandler<MouseEventArgs> customclick = (sender, e) => + { + var setDeviceState = new SetDeviceState(); + UserView.HomePage.Instance.AddChidren(setDeviceState); + UserView.HomePage.Instance.PageIndex += 1; + setDeviceState.Show(common, Btncustom.Text, edit); - - + }; + customrowlayout.MouseUpEventHandler += customclick; + Btncustom.MouseUpEventHandler += customclick; if (edit && TaskList != null) { foreach (var value in TaskList) { if (value["TaskType"] == "6") { - if (value["Data1"] == "5") + if (value["Data1"] == "0") { if (switchdictionary.ContainsKey("Data1")) { switchdictionary.Remove("Data1"); } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("Data1", "5"); - switchdictionary.Add("Data2", value["Data2"]); - horizontalSeekBarVol.IsCanMove = true; - horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColorSelected; + switchdictionary.Add("Data1", "0"); openBtnSelected.Visible = true; closeBtnSelected.Visible = false; - horizontalSeekBarVol.Progress = int.Parse(value["Data2"]); - Progressvalue = horizontalSeekBarVol.Progress; } else if (value["Data1"] == "1") { @@ -1450,8 +1026,6 @@ switchdictionary.Add("Data1", "1"); openBtnSelected.Visible = false; closeBtnSelected.Visible = true; - horizontalSeekBarVol.IsCanMove = false; - horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColor; } } @@ -1460,645 +1034,28 @@ } } break; - ///绌烘皵寮�鍏� - case DeviceType.AirSwitch: { - { - - #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- - Dictionary<string, string> switchdictionary = new Dictionary<string, string>(); - if (switchdictionary.ContainsKey("TaskType")) - { - switchdictionary.Remove("TaskType"); - } - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (switchdictionary.ContainsKey("Data2")) - { - switchdictionary.Remove("Data2"); - } - switchdictionary.Add("TaskType", "1"); - switchdictionary.Add("Data1", "0"); - switchdictionary.Add("Data2", "0"); - taskListInfo.Add(switchdictionary); - - #endregion - - #region 绌烘皵鐏厜View - - #region 寮� - - var openframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - devicefra.AddChidren(openframelayout); - - var openrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - openframelayout.AddChidren(openrowlayout); - - var btnopen = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.open, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - }; - openrowlayout.AddChidren(btnopen); - - var openBtnSelected = new SelectedButton(); - openrowlayout.AddChidren(openBtnSelected); - #endregion - #region 鍏� - 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.LogicRowLayoutLineColor, - }; - closeframelayout.AddChidren(closerowlayout); - - var btnclose = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.close, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - }; - closerowlayout.AddChidren(btnclose); - - var closeBtnSelected = new SelectedButton(); - closerowlayout.AddChidren(closeBtnSelected); - #endregion - #region 鍙栧弽 - var takebackframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = closeframelayout.Bottom, - }; - devicefra.AddChidren(takebackframelayout); - var takebackrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - takebackframelayout.AddChidren(takebackrowlayout); - - var btntakeback = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.onoff, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - }; - takebackrowlayout.AddChidren(btntakeback); - - var takebackBtnSelected = new SelectedButton(); - takebackrowlayout.AddChidren(takebackBtnSelected); - - #endregion - - - #endregion - - ///纭浜嬩欢 - EventHandler<MouseEventArgs> openclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "1");//榛樿鍊� - - - }; - openrowlayout.MouseUpEventHandler += openclick; - btnopen.MouseUpEventHandler += openclick; - openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; - ///鍙栨秷浜嬩欢 - EventHandler<MouseEventArgs> closeclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "0");//榛樿鍊� - - }; - closerowlayout.MouseUpEventHandler += closeclick; - btnclose.MouseUpEventHandler += closeclick; - closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; - //鍙栧弽 - EventHandler<MouseEventArgs> takebackclick = (sender, e) => - { - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - switchdictionary.Add("Data1", "2");//榛樿鍊� - - }; - takebackrowlayout.MouseUpEventHandler += takebackclick; - btntakeback.MouseUpEventHandler += takebackclick; - takebackBtnSelected.MouseUpEventHandler += takebackclick; - takebackframelayout.MouseUpEventHandler += takebackclick; - if (edit && TaskList != null) - { - foreach (var value in TaskList) - { - if (value["TaskType"] == "1") - { - if (switchdictionary.ContainsKey("Data1")) - { - switchdictionary.Remove("Data1"); - } - if (value["Data1"] == "1") - { - switchdictionary.Add("Data1", "1"); - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = false; - } - else if (value["Data1"] == "0") - { - switchdictionary.Add("Data1", "0"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - takebackBtnSelected.Visible = false; - } - else if (value["Data1"] == "2") - { - switchdictionary.Add("Data1", "2"); - openBtnSelected.Visible = false; - closeBtnSelected.Visible = false; - takebackBtnSelected.Visible = true; - } - break; - } - - } - } - - } - } - break; - - case DeviceType.Thermostat: - { - - #region ----鍒濆鍖栬澶囧姛鑳芥暟鎹�---- - Dictionary<string, string> switchdictionary = new Dictionary<string, string>(); - Dictionary<string, string> temperaturedictionary = new Dictionary<string, string>(); - Dictionary<string, string> modedictionary = new Dictionary<string, string>(); - Dictionary<string, string> speeddictionary = new Dictionary<string, string>(); - taskListInfo.Add(switchdictionary); - taskListInfo.Add(temperaturedictionary); - taskListInfo.Add(modedictionary); - taskListInfo.Add(speeddictionary); - dictionary(switchdictionary, "TaskType", "1"); - dictionary(switchdictionary, "Data2", "0"); - dictionary(temperaturedictionary, "TaskType", "5"); - dictionary(modedictionary, "TaskType", "5"); - dictionary(modedictionary, "Data1", "3"); - dictionary(speeddictionary, "TaskType", "5"); - dictionary(speeddictionary, "Data1", "6"); - - #endregion - - #region 绌鸿皟View - - devicefra.Y = Application.GetRealHeight(1920 - 600 - 210 - 160*2); - devicefra.Height = Application.GetRealHeight(600+ 210 + 160*2); - - #region 寮� - - var openframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = timetype.Bottom + Application.GetRealHeight(20), - }; - devicefra.AddChidren(openframelayout); - - var openrowlayout = new RowLayout - { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(130), - X = Application.GetRealWidth(80), - LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - openframelayout.AddChidren(openrowlayout); - - var btnopen = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.open, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - }; - openrowlayout.AddChidren(btnopen); - - var openBtnSelected = new SelectedButton(); - openrowlayout.AddChidren(openBtnSelected); - #endregion - - #region 绌鸿皟鐘舵�乂iew - var PickerViewfra = new FrameLayout - { - Y = openframelayout.Bottom, - Height = Application.GetRealHeight(600), - }; - devicefra.AddChidren(PickerViewfra); - - - var pausePickerViewfra= new FrameLayout - { - Y = openframelayout.Bottom, - Height = Application.GetRealHeight(600), - }; - devicefra.AddChidren(pausePickerViewfra); - - - - var mUIPickerView = new UIPickerView - { - Height = Application.GetRealHeight(600-5), - }; - PickerViewfra.AddChidren(mUIPickerView); - var line = new Button - { - Y = Application.GetRealHeight(600-5), - Width = Application.GetRealWidth(920), - Height = Application.GetRealHeight(5), - X = Application.GetRealWidth(80), - BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor, - }; - PickerViewfra.AddChidren(line); - - var mList1 = new List<string>(); - var mList2 = new List<string> { - Language.StringByID(MyInternationalizationString.logiccool), - Language.StringByID(MyInternationalizationString.logicheat), - Language.StringByID(MyInternationalizationString.logicauto), - Language.StringByID(MyInternationalizationString.logicdry), - Language.StringByID(MyInternationalizationString.logicfanonly), - }; - var mList3 = new List<string>{ - Language.StringByID(MyInternationalizationString.logiclow), - Language.StringByID(MyInternationalizationString.logicmedium), - Language.StringByID(MyInternationalizationString.logichigh), - }; - for (int i = 16; i < 33; i++) - { - mList1.Add(i.ToString() +" " + "鈩�"); - } - mUIPickerView.setNPicker(mList1, mList2, mList3); - ///榛樿鐘舵�� - - - #endregion - - #region 鍏� - var closeframelayout = new FrameLayout - { - Height = Application.GetRealHeight(160), - Y = PickerViewfra.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, - }; - closeframelayout.AddChidren(closerowlayout); - - var btnclose = new Button - { - //Text = "鍏�", - TextID = MyInternationalizationString.close, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, - }; - closerowlayout.AddChidren(btnclose); - - var closeBtnSelected = new SelectedButton(); - closerowlayout.AddChidren(closeBtnSelected); - #endregion - - - - mUIPickerView.OnSelectChangeEvent += (s1, s2, s3) => - { - if (openBtnSelected.Visible) - { - SelectedDeviceStatusaction = "yes"; - var temperature = mList1[s1].Split(' ')[0]; - var modestring = mList2[s2].Split(' ')[0]; - var speedstring = mList3[s3].Split(' ')[0]; - ModeState(modestring, temperaturedictionary, modedictionary); - var a = int.Parse(temperature) * 100; - dictionary(temperaturedictionary, "Data2", a.ToString()); - - SpeedState(speedstring, speeddictionary); - - - } - }; - - #endregion - //榛樿26,鑷姩,涓 - int indextemperature = 10, indexmode = 2, indexspeed = 1; - if (edit && TaskList != null) - { - foreach (var value in TaskList) - { - if (value["TaskType"] == "1") - { - dictionary(switchdictionary, "Data1", value["Data1"]); - if (value["Data1"] == "1") - { - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - pausePickerViewfra.Height = Application.GetRealHeight(0); - } - else if (value["Data1"] == "0") - { - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - pausePickerViewfra.Height = Application.GetRealHeight(600); - } - - } - else if (value["TaskType"] == "5") - { - if (value["Data1"] == "3") - {//3---璁剧疆宸ヤ綔妯″紡(1:鑷姩;3:鍒跺喎;4:鍒剁儹;7:閫侀;8:闄ゆ箍) - dictionary(modedictionary, "Data2", value["Data2"]); - string modetext = ""; - switch (value["Data2"]) - { - case "3": - { - modetext = Language.StringByID(MyInternationalizationString.logiccool); - //indexmode = 0; - } - break; - case "4": - { - modetext = Language.StringByID(MyInternationalizationString.logicheat); - // indexmode = 1; - } - break; - case "1": - { - modetext = Language.StringByID(MyInternationalizationString.logicauto); - // indexmode = 2; - } - break; - case "8": - { - modetext = Language.StringByID(MyInternationalizationString.logicdry); - // indexmode = 3; - } - break; - case "7": - { - modetext = Language.StringByID(MyInternationalizationString.logicfanonly); - //indexmode = 4; - } - break; - } - indexmode = mList2.IndexOf(modetext); - } - else if (value["Data1"] == "6") - {//6---璁剧疆椋庢墖妯″紡(1:浣庨;2:涓;3:楂橀;) - dictionary(speeddictionary, "Data2", value["Data2"]); - string speedtext = ""; - switch (value["Data2"]) - { - case "1": - { - speedtext = Language.StringByID(MyInternationalizationString.logiclow); - //indexspeed = 0; - } - break; - - case "2": - { - speedtext = Language.StringByID(MyInternationalizationString.logicmedium); - // indexspeed = 1; - } - break; - case "3": - { - speedtext = Language.StringByID(MyInternationalizationString.logichigh); - // indexspeed = 2; - } - break; - - } - indexspeed = mList3.IndexOf(speedtext); - } - //4---璁剧疆鍔犵儹搴︽暟;5---璁剧疆鍒跺喎銆侀櫎婀垮害鏁�;7---璁剧疆鑷姩搴︽暟 - else if (value["Data1"] == "4" || value["Data1"] == "5" || value["Data1"] == "7") - { - var s = int.Parse(value["Data2"]) / 100; - indextemperature = mList1.IndexOf(s.ToString() + " " + "鈩�"); - dictionary(temperaturedictionary, "Data1", value["Data1"]); - dictionary(temperaturedictionary, "Data2", value["Data2"]); - } - - } - } - } - ///鏇存柊鏈�鏂扮┖璋冪姸鎬侊紱 - mUIPickerView.setCurrentItems(indextemperature, indexmode, indexspeed); - - ///纭浜嬩欢 - EventHandler<MouseEventArgs> openclick = (sender, e) => - { - pausePickerViewfra.Height = Application.GetRealHeight(0); - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = true; - closeBtnSelected.Visible = false; - dictionary(switchdictionary, "Data1", "1"); - var temperature = mList1[indextemperature].Split(' ')[0]; - var modestring = mList2[indexmode].Split(' ')[0]; - var speedstring = mList3[indexspeed].Split(' ')[0]; - - ModeState(modestring, temperaturedictionary, modedictionary); - var a = int.Parse(temperature) * 100; - dictionary(temperaturedictionary, "Data2", a.ToString()); - SpeedState(speedstring, speeddictionary); - - }; - openrowlayout.MouseUpEventHandler += openclick; - btnopen.MouseUpEventHandler += openclick; - openBtnSelected.MouseUpEventHandler += openclick; - openframelayout.MouseUpEventHandler += openclick; - - ///鍙栨秷浜嬩欢 - EventHandler<MouseEventArgs> closeclick = (sender, e) => - { - pausePickerViewfra.Height = Application.GetRealHeight(600); - - SelectedDeviceStatusaction = "yes"; - openBtnSelected.Visible = false; - closeBtnSelected.Visible = true; - dictionary(switchdictionary, "Data1", "0"); - }; - closerowlayout.MouseUpEventHandler += closeclick; - btnclose.MouseUpEventHandler += closeclick; - closeBtnSelected.MouseUpEventHandler += closeclick; - closeframelayout.MouseUpEventHandler += closeclick; - } - break; - - } - Btncomplete.MouseUpEventHandler += (sender, e) => + + var cancel = new Button { - - if (SelectedDeviceStatusaction == "yes") - { - LogicIfon.AddDeviceactions(common, actionsInfo); - } - else - { - if (!edit) - { - var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt), - Language.StringByID(MyInternationalizationString.selectdevicestatuscondition), - Language.StringByID(MyInternationalizationString.complete)); - alert.Show(); - return; - } - - } - flMain.RemoveFromParent(); - var logicCommunalPage = new LogicCommunalPage(); - UserView.HomePage.Instance.AddChidren(logicCommunalPage); - UserView.HomePage.Instance.PageIndex += 1; - logicCommunalPage.Show(() => { }); + 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; + }; + + } - - public static void dictionary(Dictionary<string, string> deviceactionsInfo, string Key, string Value) - { - if (deviceactionsInfo.ContainsKey(Key)) - { - deviceactionsInfo.Remove(Key); - } - deviceactionsInfo.Add(Key, Value); - } - /// <summary> - /// 绌鸿皟妯″紡鐨勭姸鎬� - /// </summary> - /// <param name="modestring"></param> - /// <param name="temperaturedictionary"></param> - /// <param name="modedictionary"></param> - public static void ModeState(string modestring,Dictionary<string,string> temperaturedictionary, Dictionary<string, string> modedictionary) - { - - if (modestring == Language.StringByID(MyInternationalizationString.logiccool)) - { - dictionary(modedictionary, "Data2", "3"); - dictionary(temperaturedictionary, "Data1", "5"); - } - else if (modestring == Language.StringByID(MyInternationalizationString.logicheat)) - { - - dictionary(modedictionary, "Data2", "4"); - dictionary(temperaturedictionary, "Data1", "4"); - } - else if (modestring == Language.StringByID(MyInternationalizationString.logicauto)) - { - - dictionary(modedictionary, "Data2", "1"); - dictionary(temperaturedictionary, "Data1", "7"); - } - else if (modestring == Language.StringByID(MyInternationalizationString.logicdry)) - { - - dictionary(modedictionary, "Data2", "8"); - dictionary(temperaturedictionary, "Data1", "5"); - } - else if (modestring == Language.StringByID(MyInternationalizationString.logicfanonly)) - { - dictionary(temperaturedictionary, "Data1", "20"); - dictionary(modedictionary, "Data2", "7"); - } - - } - /// <summary> - /// 椋庨�熺殑妯″紡 - /// </summary> - /// <param name="speedstring"></param> - /// <param name="speeddictionary"></param> - public static void SpeedState(string speedstring, Dictionary<string, string> speeddictionary) { - - if (speedstring == Language.StringByID(MyInternationalizationString.logiclow)) - { - - dictionary(speeddictionary, "Data2", "1"); - - } - else if (speedstring == Language.StringByID(MyInternationalizationString.logicmedium)) - { - - dictionary(speeddictionary, "Data2", "2"); - - } - else if (speedstring == Language.StringByID(MyInternationalizationString.logichigh)) - { - - dictionary(speeddictionary, "Data2", "3"); - } - - } - } } -- Gitblit v1.8.0