WJC
2019-11-01 6f16607efe766271c69a4f3f96fb928fe25f112c
ZigbeeApp/Shared/Phone/Device/Category/Category.cs
@@ -829,6 +829,7 @@
            else if (automationBtn.IsSelected)
            {
                ShowAutotion();
            }
        }
@@ -1862,7 +1863,6 @@
        {
            functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
            var bjFrameLayout = new FrameLayout
            {
                Width = Application.GetRealWidth(1080 - 58),
@@ -2014,7 +2014,7 @@
                    Yheight = 0;
                }
                logicScrolView.Y = scenehorizontalScrol.Bottom + Yheight;
                logicScrolView.Height = functionSceneBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30) - Yheight;
                logicScrolView.Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30) - Yheight;
                Automationview(logicScrolView);
            };
@@ -2040,6 +2040,7 @@
            //自动化
            Automationview(logicScrolView);
            CommonPage.Loading.Hide();
        }
        /// <summary>
@@ -2051,32 +2052,26 @@
            refresview.RemoveAll();
            foreach (var logic in Common.Logic.LogicList)
            {
                var bjRow = new RowLayout
                {
                    Width = Application.GetRealWidth(1080 - 58),
                    Height = Application.GetRealHeight(220),
                    LineColor = ZigbeeColor.Current.LogicBackgroundColor,
                    BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
                };
                refresview.AddChidren(bjRow);
                var logicRowlayout = new RowLayout
                {
                    Y = Application.GetRealHeight(220 - 190),
                    Height = Application.GetRealHeight(190),
                    Width = Application.GetRealWidth(1080 - 58 - 46),
                    LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
                    X = Application.GetRealWidth(46),
                    Height = Application.GetRealHeight(190 + 30),
                    Width = Application.GetRealWidth(1080),
                    LineColor = ZigbeeColor.Current.LogicBackgroundColor,
                    BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
                };
                bjRow.AddChidren(logicRowlayout);
                refresview.AddChidren(logicRowlayout);
                var logicnameBtn = new Button
                {
                    Height = Application.GetRealHeight(58),
                    Width = Application.GetRealWidth(350),
                    Text = logic.LogicName,
                    X = Application.GetRealWidth(12),
                    X = Application.GetRealWidth(12 + 46),
                    Y = Application.GetRealHeight(30),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                };
@@ -2089,8 +2084,8 @@
                    Height = Application.GetMinRealAverage(63),
                    UnSelectedImagePath = "ZigeeLogic/logicclose.png",
                    SelectedImagePath = "ZigeeLogic/logicopen.png",
                    X = logicRowlayout.Width - Application.GetRealWidth(104 + 58),
                    Y = Application.GetRealHeight(58 + 30 + 9),
                    X = logicRowlayout.Width - Application.GetRealWidth(104 + 58 + 58),
                    Y = Application.GetRealHeight(58 + 30 + 9 + 30),
                };
                logicRowlayout.AddChidren(logicswitchBtn);
@@ -2167,91 +2162,32 @@
                    alert.Show();
                };
            }
        }
        #region ◆ 控制状态_________________________
        /// <summary>
        /// 显示设备控制状态
        /// </summary>
        /// <param name="command">Command.</param>
        /// <param name="objValue">Object value.</param>
        private void UpdateDeviceControllStatu(string command, object objValue)
        {
            if (command != "DeviceDefaultAck" || objValue == null)
            {
                return;
            }
            var tempDevice = (CommonDevice)objValue;
            if (null == commonDeviceList.Find((obj) => obj.DeviceEpoint == tempDevice.DeviceEpoint && obj.DeviceAddr == tempDevice.DeviceAddr))
            {
                return;
            }
            //标记已经发送控制命令到网关
            sendedControlCommand = true;
            //DeviceUI.ShowStatuTip(R.MyInternationalizationString.Success);
        }
        /// <summary>
        /// 移除全部更新控制设备的action
        /// </summary>
        private void RemoveAllUpdateControlDeviceStatuAction()
        {
            foreach (var gateway in zbGatewayList)
            {
                //移除action
                if (gateway != null)
                var line = new Button
                {
                    gateway.ReportAction -= UpdateDeviceControllStatu;
                }
                    Y = Application.GetRealHeight(215),
                    Height = Application.GetRealHeight(5),
                    Width = Application.GetRealWidth(1080 - 58),
                    BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
                    X = Application.GetRealWidth(58),
                };
                logicRowlayout.AddChidren(line);
            }
        }
        }
        /// <summary>
        /// 移除单个控制设备的更新状态action
        /// 显示图标的颜色
        /// </summary>
        /// <param name="gateway">Gateway.</param>
        private void RemoveUpdateControlDeviceStatuAction(ZbGateway gateway)
        {
            //移除action
            if (gateway != null)
            {
                gateway.ReportAction -= UpdateDeviceControllStatu;
            }
        }
        /// <summary>
        /// 添加需要监控回调状态的网关和设备
        /// </summary>
        /// <param name="gatewayList">Gateway list.</param>
        /// <param name="gateway">Gateway.</param>
        /// <param name="deviceList">Device list.</param>
        /// <param name="common">Common.</param>
        private void AddZbGateway(List<ZbGateway> gatewayList, ZbGateway gateway, List<CommonDevice> deviceList, CommonDevice common)
        {
            if (null == gatewayList.Find((obj) => obj.getGatewayBaseInfo.gwID == gateway.getGatewayBaseInfo.gwID))
            {
                gatewayList.Add(gateway);
            }
            if (null == commonDeviceList.Find((obj) => obj.DeviceEpoint == common.DeviceEpoint && obj.DeviceAddr == common.DeviceAddr))
            {
                commonDeviceList.Add(common);
            }
        }
        #endregion
        /// <param name="logic"></param>
        /// <param name="logicRowlayout"></param>
        /// <param name="intvalue"></param>
        private void StatusColor(Common.Logic logic, RowLayout logicRowlayout, int intvalue)
        {
            var logictimeBtn = new Button
            {
                Height = Application.GetRealHeight(58),
                Width = logicRowlayout.Width - Application.GetRealWidth(58 + 12 + 350),
                Width = logicRowlayout.Width - Application.GetRealWidth(58 + 12 + 350 + 58),
                Y = Application.GetRealHeight(30),
                X = Application.GetRealWidth(365),
                TextAlignment = TextAlignment.CenterRight,
                TextColor = ZigbeeColor.Current.LogicListWeekTextColor,
@@ -2542,8 +2478,8 @@
                {
                    Width = Application.GetRealWidth(82),
                    Height = Application.GetRealHeight(82),
                    X = Application.GetRealWidth(12 + (12 + 82 + 45 + 12) * i),
                    Y = Application.GetRealHeight(58 + 30),
                    X = Application.GetRealWidth(58) + Application.GetRealWidth(12 + (12 + 82 + 45 + 12) * i),
                    Y = Application.GetRealHeight(58 + 30 + 30),
                    Radius = (uint)Application.GetRealHeight(41),
                    BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
                };
@@ -2561,7 +2497,7 @@
                var connectIconBtn = new Button
                {
                    Y = typebjBtn.Y + Application.GetRealHeight(35),
                    X = Application.GetRealWidth((12 + 82 + 12) + (12 + 45 + 82 + 12) * i),
                    X = Application.GetRealWidth(58) + Application.GetRealWidth((12 + 82 + 12) + (12 + 45 + 82 + 12) * i),
                    Width = Application.GetRealWidth(48),
                    Height = Application.GetRealHeight(15),
                    UnSelectedImagePath = "ZigeeLogic/connect.png",
@@ -2639,5 +2575,79 @@
            }
        }
        #endregion
        #region ◆ 控制状态_________________________
        /// <summary>
        /// 显示设备控制状态
        /// </summary>
        /// <param name="command">Command.</param>
        /// <param name="objValue">Object value.</param>
        private void UpdateDeviceControllStatu(string command, object objValue)
        {
            if (command != "DeviceDefaultAck" || objValue == null)
            {
                return;
            }
            var tempDevice = (CommonDevice)objValue;
            if (null == commonDeviceList.Find((obj) => obj.DeviceEpoint == tempDevice.DeviceEpoint && obj.DeviceAddr == tempDevice.DeviceAddr))
            {
                return;
            }
            //标记已经发送控制命令到网关
            sendedControlCommand = true;
            //DeviceUI.ShowStatuTip(R.MyInternationalizationString.Success);
        }
        /// <summary>
        /// 移除全部更新控制设备的action
        /// </summary>
        private void RemoveAllUpdateControlDeviceStatuAction()
        {
            foreach (var gateway in zbGatewayList)
            {
                //移除action
                if (gateway != null)
                {
                    gateway.ReportAction -= UpdateDeviceControllStatu;
                }
            }
        }
        /// <summary>
        /// 移除单个控制设备的更新状态action
        /// </summary>
        /// <param name="gateway">Gateway.</param>
        private void RemoveUpdateControlDeviceStatuAction(ZbGateway gateway)
        {
            //移除action
            if (gateway != null)
            {
                gateway.ReportAction -= UpdateDeviceControllStatu;
            }
        }
        /// <summary>
        /// 添加需要监控回调状态的网关和设备
        /// </summary>
        /// <param name="gatewayList">Gateway list.</param>
        /// <param name="gateway">Gateway.</param>
        /// <param name="deviceList">Device list.</param>
        /// <param name="common">Common.</param>
        private void AddZbGateway(List<ZbGateway> gatewayList, ZbGateway gateway, List<CommonDevice> deviceList, CommonDevice common)
        {
            if (null == gatewayList.Find((obj) => obj.getGatewayBaseInfo.gwID == gateway.getGatewayBaseInfo.gwID))
            {
                gatewayList.Add(gateway);
            }
            if (null == commonDeviceList.Find((obj) => obj.DeviceEpoint == common.DeviceEpoint && obj.DeviceAddr == common.DeviceAddr))
            {
                commonDeviceList.Add(common);
            }
        }
        #endregion
    }
}