黄学彪
2019-11-18 16604a593202f2f87adf71abd57d036fe7da3b52
ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs
@@ -72,10 +72,6 @@
        /// </summary>
        private Button currentModeBtn;
        /// <summary>
        /// 当前温度
        /// </summary>
        private Button currentTemperatureBtn;
        /// <summary>
        /// 添加温度
        /// </summary>
        private Button addTemperatureBtn;
@@ -112,6 +108,11 @@
        /// 传过来的ac
        /// </summary>
        private ZigBee.Device.AC ac;
        /// <summary>
        /// mArcScaleSeekBar
        /// </summary>
        private ArcScaleSeekBar mArcScaleSeekBar = new ArcScaleSeekBar { };
        #endregion
        #region ◆ 接口___________________________
@@ -174,7 +175,7 @@
                                    ac.currentCoolingSetpoint = curTemp;
                                    if (ac.currentSystemMode == 3 || ac.currentSystemMode == 8)
                                    {
                                        currentTemperatureBtn.Text = $"{ac.currentCoolingSetpoint} ℃";
                                        mArcScaleSeekBar.Progress = ac.currentCoolingSetpoint;
                                    }
                                    ac.LastDateTime = DateTime.Now;
@@ -184,7 +185,7 @@
                                    ac.currentHeatingSetpoint = curTemp;
                                    if (ac.currentSystemMode == 4)
                                    {
                                        currentTemperatureBtn.Text = $"{ac.currentHeatingSetpoint} ℃";
                                        mArcScaleSeekBar.Progress = ac.currentHeatingSetpoint;
                                    }
                                    ac.LastDateTime = DateTime.Now;
                                    break;
@@ -193,7 +194,7 @@
                                    ac.currentAutoSetpoint = curTemp;
                                    if (ac.currentSystemMode == 1)
                                    {
                                        currentTemperatureBtn.Text = $"{ac.currentAutoSetpoint} ℃";
                                        mArcScaleSeekBar.Progress = ac.currentAutoSetpoint;
                                    }
                                    ac.LastDateTime = DateTime.Now;
                                    break;
@@ -210,7 +211,8 @@
                                        modeBtn.SelectedImagePath = ACControlBase.GetModeSelectedImagePathByModeId(ac.currentSystemMode);
                                        modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByModeId(ac.currentSystemMode);
                                        currentModeBtn.Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode);
                                        currentTemperatureBtn.Text = $"{ACControlBase.GetCurrentModeTemperature(ac)} ℃";
                                        mArcScaleSeekBar.Progress = ACControlBase.GetCurrentModeTemperature(ac);
                                        fanModeBtn.IsSelected = false;
                                        FanSwingModeBtn.IsSelected = false;
@@ -222,8 +224,8 @@
                                        modeBtn.SelectedImagePath = ACControlBase.GetModeSelectedImagePathByModeId(ac.currentSystemMode);
                                        modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByModeId(ac.currentSystemMode);
                                        currentModeBtn.Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode);
                                        currentTemperatureBtn.Text = $"{ACControlBase.GetCurrentModeTemperature(ac)} ℃";
                                        mArcScaleSeekBar.Progress = ACControlBase.GetCurrentModeTemperature(ac);
                                        fanModeBtn.IsSelected = true;
                                        FanSwingModeBtn.IsSelected = true;
                                    }
@@ -250,7 +252,7 @@
                                    fanModeBtn.UnSelectedImagePath = ACControlBase.GetFanModeUnSelectedImagePathByFanModeId(ac.currentFanMode);
                                    break;
                                case 4096:
                                    //风扇当前的扫风模式
                                    //风扇当前的扫风模式
                                    ac.currentFanSwingMode = attriButeList[0].AttriButeData;
                                    ac.LastDateTime = DateTime.Now;
                                    FanSwingModeBtn.IsSelected = true;
@@ -331,6 +333,7 @@
        {
            BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
            ZigBee.Device.ZbGateway.StatusList.Add(this);
            HomePage.Instance.ScrollEnabled = false;
        }
        #endregion
@@ -346,6 +349,7 @@
            //action();
            //action = null;
            RemoveUpdateControlDeviceStatuAction();
            HomePage.Instance.ScrollEnabled = true;
            base.RemoveFromParent();
        }
@@ -435,15 +439,6 @@
                RemoveFromParent();
            };
            var sharedBtn = new Button
            {
                X = Application.GetRealWidth(850),
                Width = Application.GetMinReal(69),
                Height = Application.GetMinReal(69),
                Gravity = Gravity.CenterVertical,
                UnSelectedImagePath = "Item/Shared.png"
            };
            top.topView.AddChidren(sharedBtn);
            var moreBtn = new Button
            {
@@ -516,72 +511,71 @@
            };
            itemView.AddChidren(indoorTemperatureBtn);
            var controlBG = new FrameLayout()
            mArcScaleSeekBar = new ArcScaleSeekBar
            {
                Y = Application.GetRealHeight(412),
                Height = Application.GetMinRealAverage(547),
                Width = Application.GetMinRealAverage(671),
                Width = Application.GetRealWidth(671),
                Height = Application.GetRealHeight(671),
                Gravity = Gravity.CenterHorizontal,
                BackgroundImagePath = "AC/Group.png"
                MinValue=ACControlBase.Temperature_Low,
                MaxValue=ACControlBase.Temperature_High,
                Progress=ACControlBase.GetCurrentModeTemperature(ac)
            };
            itemView.AddChidren(controlBG);
            var controlBG2 = new Button()
            itemView.AddChidren(mArcScaleSeekBar);
            mArcScaleSeekBar.OnStopTrackingTouchEvent += (sender, e) =>
            {
                Y = Application.GetRealHeight(873),
                Height = Application.GetMinRealAverage(121),
                Width = Application.GetMinRealAverage(351),
                UnSelectedImagePath = "AC/Path.png",
                Gravity = Gravity.CenterHorizontal
                //cool  //dry
                if (ac.currentSystemMode == 3 || ac.currentSystemMode == 8)
                {
                    ac.currentCoolingSetpoint = e;
                    ac.SetCoolingTemperatureAsync(ac.currentCoolingSetpoint * 100);
                }
                //heat
                else if (ac.currentSystemMode == 4)
                {
                    ac.currentHeatingSetpoint = e;
                    ac.SetHeatingTemperatureAsync(ac.currentHeatingSetpoint * 100);
                }
                //auto
                else if (ac.currentSystemMode == 1)
                {
                    ac.currentAutoSetpoint = e;
                    ac.SetAutoTemperatureAsync(ac.currentAutoSetpoint * 100);
                }
            };
            itemView.AddChidren(controlBG2);
            //当前模式
            currentModeBtn = new Button()
            {
                Y = Application.GetRealHeight(187),
                Y = Application.GetRealHeight(599),
                Height = Application.GetRealHeight(80),
                Width = Application.GetRealWidth(200),
                TextColor = ZigbeeColor.Current.GXCTextBlackColor,
                Gravity = Gravity.CenterHorizontal,
                Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode)
            };
            controlBG.AddChidren(currentModeBtn);
            itemView.AddChidren(currentModeBtn);
            //降低温度
            reduceTemperatureBtn = new Button()
            {
                X = Application.GetRealWidth(112),
                Y = Application.GetRealHeight(268),
                X = Application.GetRealWidth(268),
                Y = Application.GetRealHeight(680),
                Width = Application.GetMinRealAverage(80),
                Height = Application.GetMinRealAverage(80),
                UnSelectedImagePath = "AC/Reduce.png"
            };
            controlBG.AddChidren(reduceTemperatureBtn);
            //温度
            currentTemperatureBtn = new Button()
            {
                //X = Application.GetRealWidth(239),
                Y = Application.GetRealHeight(248),
                Width = Application.GetRealWidth(180),
                Height = Application.GetRealHeight(100),
                TextColor = ZigbeeColor.Current.GXCTextBlackColor,
                TextSize = 15,
                Text = $"{ACControlBase.GetCurrentModeTemperature(ac)} °C",
                Gravity = Gravity.CenterHorizontal
            };
            controlBG.AddChidren(currentTemperatureBtn);
            itemView.AddChidren(reduceTemperatureBtn);
            //添加温度
            addTemperatureBtn = new Button()
            {
                X = Application.GetRealWidth(472),
                Y = Application.GetRealHeight(268),
                X = Application.GetRealWidth(628),
                Y = Application.GetRealHeight(680),
                Width = Application.GetMinRealAverage(80),
                Height = Application.GetMinRealAverage(80),
                UnSelectedImagePath = "AC/Add.png"
            };
            controlBG.AddChidren(addTemperatureBtn);
            itemView.AddChidren(addTemperatureBtn);
            //扫风
            FanSwingModeBtn = new Button()
@@ -595,7 +589,7 @@
                IsSelected = ACControlBase.IsOpen(ac)
            };
            itemView.AddChidren(FanSwingModeBtn);
            //模式
            modeBtn = new Button()
            {
@@ -1075,7 +1069,7 @@
            modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByMode(acMode);
            currentModeBtn.Text = ACControlBase.GetModeNameByMode(acMode);
            ac.currentSystemMode = (int)acMode;
            currentTemperatureBtn.Text = $"{ACControlBase.GetCurrentModeTemperature(ac)} °C";
            mArcScaleSeekBar.Progress = ACControlBase.GetCurrentModeTemperature(ac);
            ac.SetSystemModeAsync(acMode);
@@ -1325,7 +1319,8 @@
                }
                ac.currentCoolingSetpoint += 1;
                ac.SetCoolingTemperatureAsync(ac.currentCoolingSetpoint * 100);
                currentTemperatureBtn.Text = $"{ac.currentCoolingSetpoint} °C";
                //currentTemperatureBtn.Text = $"{ac.currentCoolingSetpoint} °C";
                mArcScaleSeekBar.Progress = ac.currentCoolingSetpoint;
            }
            //heat
            else if (ac.currentSystemMode == 4)
@@ -1336,7 +1331,8 @@
                }
                ac.currentHeatingSetpoint += 1;
                ac.SetHeatingTemperatureAsync(ac.currentHeatingSetpoint * 100);
                currentTemperatureBtn.Text = $"{ac.currentHeatingSetpoint} °C";
                //currentTemperatureBtn.Text = $"{ac.currentHeatingSetpoint} °C";
                mArcScaleSeekBar.Progress = ac.currentHeatingSetpoint;
            }
            //auto
            else if (ac.currentSystemMode == 1)
@@ -1347,9 +1343,9 @@
                }
                ac.currentAutoSetpoint += 1;
                ac.SetAutoTemperatureAsync(ac.currentAutoSetpoint * 100);
                currentTemperatureBtn.Text = $"{ac.currentAutoSetpoint} °C";
                //currentTemperatureBtn.Text = $"{ac.currentAutoSetpoint} °C";
                mArcScaleSeekBar.Progress = ac.currentAutoSetpoint;
            }
        }
@@ -1379,7 +1375,8 @@
                ac.currentCoolingSetpoint -= 1;
                ac.SetCoolingTemperatureAsync(ac.currentCoolingSetpoint * 100);
                currentTemperatureBtn.Text = $"{ac.currentCoolingSetpoint} °C";
                //currentTemperatureBtn.Text = $"{ac.currentCoolingSetpoint} °C";
                mArcScaleSeekBar.Progress = ac.currentCoolingSetpoint;
            }
            //heat
            else if (ac.currentSystemMode == 4)
@@ -1391,7 +1388,8 @@
                ac.currentHeatingSetpoint -= 1;
                ac.SetHeatingTemperatureAsync(ac.currentHeatingSetpoint * 100);
                currentTemperatureBtn.Text = $"{ac.currentHeatingSetpoint} °C";
                //currentTemperatureBtn.Text = $"{ac.currentHeatingSetpoint} °C";
                mArcScaleSeekBar.Progress = ac.currentHeatingSetpoint;
            }
            //auto
            else if (ac.currentSystemMode == 1)
@@ -1403,14 +1401,15 @@
                ac.currentAutoSetpoint -= 1;
                ac.SetAutoTemperatureAsync(ac.currentAutoSetpoint * 100);
                currentTemperatureBtn.Text = $"{ac.currentAutoSetpoint} °C";
                //currentTemperatureBtn.Text = $"{ac.currentAutoSetpoint} °C";
                mArcScaleSeekBar.Progress = ac.currentAutoSetpoint;
            }
        }
        #endregion
        #region ◆ 控制反馈_________________________