| | |
| | | using System.Collections.Generic;
|
| | | using System.Text;
|
| | | using System.Threading.Tasks;
|
| | | using ZigBee.Device; |
| | | namespace Shared.Phone.UserCenter.DevicePanel |
| | | { |
| | | public class PanelBackLighWithSensorForm : EditorCommonForm |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | using ZigBee.Device;
|
| | | namespace Shared.Phone.UserCenter.DevicePanel
|
| | | {
|
| | | public class PanelBackLighWithSensorForm : EditorCommonForm
|
| | | {
|
| | | #region ■ 变量声明___________________________ |
| | | /// <summary>
|
| | | /// 列表控件
|
| | | /// </summary>
|
| | | private VerticalScrolViewLayout listview = null; |
| | | |
| | | private VerticalScrolViewLayout listview = null;
|
| | |
|
| | | /// <summary>
|
| | | /// 面板的回路
|
| | | /// </summary>
|
| | |
| | | if (result == false)
|
| | | {
|
| | | return;
|
| | | } |
| | | |
| | | //清空bodyFrame |
| | | this.ClearBodyFrame(); |
| | | |
| | | }
|
| | |
|
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame();
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | listview = new VerticalScrolViewLayout(); |
| | | listview.Height = Application.GetRealHeight(1981 - 184); |
| | | bodyFrameLayout.AddChidren(listview); |
| | | |
| | | //添加节能模式 |
| | | this.AddEnergyConservationRow(); |
| | | //添加点击前,亮度进度条 |
| | | listview = new VerticalScrolViewLayout();
|
| | | listview.Height = Application.GetRealHeight(1981 - 184);
|
| | | bodyFrameLayout.AddChidren(listview);
|
| | |
|
| | | //添加节能模式
|
| | | this.AddEnergyConservationRow();
|
| | | //添加点击前,亮度进度条
|
| | | this.AddBeforeClickProgress();
|
| | | //添加点击后,亮度进度条
|
| | | this.AddAfterClickProgress(); |
| | | |
| | | this.FinishInitControl(listview, energyModeInfo.enable); |
| | | this.AddAfterClickProgress();
|
| | |
|
| | | //保存 |
| | | var btnSave = new BottomClickButton(); |
| | | btnSave.TextID = R.MyInternationalizationString.uSave; |
| | | bodyFrameLayout.AddChidren(btnSave); |
| | | btnSave.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //保存面板数据 |
| | | this.SavePanelData(); |
| | | }; |
| | | this.FinishInitControl(listview, energyModeInfo.enable);
|
| | |
|
| | | //保存
|
| | | var btnSave = new BottomClickButton();
|
| | | btnSave.TextID = R.MyInternationalizationString.uSave;
|
| | | bodyFrameLayout.AddChidren(btnSave);
|
| | | btnSave.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //保存面板数据
|
| | | this.SavePanelData();
|
| | | };
|
| | | });
|
| | | }
|
| | |
|
| | |
| | | btnSwitch.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected;
|
| | | energyModeInfo.enable = btnSwitch.IsSelected; |
| | | //展开或者缩小的高度 |
| | | energyModeInfo.enable = btnSwitch.IsSelected;
|
| | | //展开或者缩小的高度
|
| | | var value = Application.GetRealHeight(443);
|
| | | if (btnSwitch.IsSelected == true)
|
| | | {
|
| | | frameBack.Height += value; |
| | | frameBack.Height += value;
|
| | | }
|
| | | else
|
| | | {
|
| | | frameBack.Height -= value; |
| | | } |
| | | //容器补充 |
| | | frameBack.Height -= value;
|
| | | }
|
| | | //容器补充
|
| | | this.FinishInitControl(listview, energyModeInfo.enable);
|
| | | };
|
| | | if (energyModeInfo.enable == true)
|
| | |
| | | frameBack.Height += value;
|
| | | }
|
| | |
|
| | | //添加接近感应 |
| | | this.AddProximitySensorsRow(frameBack); |
| | | } |
| | | |
| | | //添加接近感应
|
| | | this.AddProximitySensorsRow(frameBack);
|
| | | }
|
| | |
|
| | | #endregion
|
| | | |
| | |
|
| | | #region ■ 接近感应___________________________
|
| | | |
| | |
|
| | | /// <summary>
|
| | | /// 接近感应行
|
| | | /// </summary>
|
| | | private void AddProximitySensorsRow(FrameRowControl frameRowControl)
|
| | | { |
| | | //接近感应行 |
| | | {
|
| | | //接近感应行
|
| | | var frameBack = new FrameRowControl();
|
| | | frameBack.BackgroundColor = UserCenterColor.Current.White;
|
| | | frameBack.UseClickStatu = false;
|
| | |
| | | //接近感应
|
| | | frameBack.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.ProximitySensors), 400);
|
| | | //开关控件
|
| | | var btnSwitch = frameBack.AddMostRightSwitchIcon(); |
| | | |
| | | btnSwitch.ButtonClickEvent += (sender, e) => |
| | | { |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | proximitySensorsInfo.enable = btnSwitch.IsSelected; |
| | | }; |
| | | var btnSwitch = frameBack.AddMostRightSwitchIcon();
|
| | |
|
| | | btnSwitch.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected;
|
| | | proximitySensorsInfo.enable = btnSwitch.IsSelected;
|
| | | };
|
| | | if (proximitySensorsInfo.enable == true)
|
| | | {
|
| | | btnSwitch.IsSelected = true;
|
| | | } |
| | | } |
| | | }
|
| | | }
|
| | | #endregion
|
| | | |
| | |
|
| | | #region ■ 点击前_____________________________
|
| | | |
| | |
|
| | | /// <summary>
|
| | | /// 添加点击前的背光灯进度条
|
| | | /// </summary>
|
| | |
| | | {
|
| | | //点击前
|
| | | var btnClick = new NormalViewControl(600, 107, true);
|
| | | btnClick.X = ControlCommonResourse.XXLeft; |
| | | btnClick.X = ControlCommonResourse.XXLeft;
|
| | | btnClick.TextSize = 12;
|
| | | btnClick.TextColor = UserCenterColor.Current.TextGrayColor3;
|
| | | btnClick.TextID = R.MyInternationalizationString.uBeforeClick;
|
| | |
| | | btnTemp2.Text = "100%";
|
| | | frameBack.AddChidren(btnTemp2);
|
| | |
|
| | | var frameColor = new FrameLayoutControl();
|
| | | var frameColor = new FrameLayoutStatuControl();
|
| | | frameColor.UseClickStatu = false;
|
| | | frameColor.Width = Application.GetRealHeight(262);
|
| | | frameColor.Height = Application.GetMinRealAverage(79);
|
| | | frameColor.Height = this.GetPictrueRealSize(79);
|
| | | frameColor.Y = Application.GetRealHeight(26);
|
| | | frameColor.X = listview.Width - ControlCommonResourse.XXLeft - Application.GetRealHeight(262);
|
| | | frameBack.AddChidren(frameColor);
|
| | |
|
| | | //颜色
|
| | | var btnColorView = new NormalViewControl(Application.GetRealHeight(110), Application.GetMinRealAverage(49), false);
|
| | | var btnColorView = new NormalViewControl(Application.GetRealHeight(110), this.GetPictrueRealSize(49), false);
|
| | | btnColorView.Gravity = Gravity.CenterVertical;
|
| | | btnColorView.TextAlignment = TextAlignment.CenterRight;
|
| | | btnColorView.TextSize = 12;
|
| | |
| | | int R1 = Convert.ToInt32(this.keyColorData.CloseColorR, 16);
|
| | | int G1 = Convert.ToInt32(this.keyColorData.CloseColorG, 16);
|
| | | int B1 = Convert.ToInt32(this.keyColorData.CloseColorB, 16);
|
| | | uint backColor = this.GetColorByRGB((byte)R1, (byte)G1, (byte)B1); |
| | | |
| | | //颜色外框 |
| | | var btnColorLine = new FrameLayoutControl(); |
| | | uint backColor = this.GetColorByRGB((byte)R1, (byte)G1, (byte)B1);
|
| | |
|
| | | //颜色外框 |
| | | var btnColorLine = new FrameLayoutStatuControl();
|
| | | btnColorLine.Width = Application.GetRealHeight(79);
|
| | | btnColorLine.Height = Application.GetMinRealAverage(79); |
| | | btnColorLine.Height = this.GetPictrueRealSize(79);
|
| | | btnColorLine.X = btnColorView.Right + Application.GetRealHeight(18);
|
| | | btnColorLine.Radius = (uint)Application.GetMinRealAverage(79) / 2;
|
| | | btnColorLine.Radius = (uint)this.GetPictrueRealSize(79) / 2;
|
| | | btnColorLine.BorderWidth = 1;
|
| | | btnColorLine.BorderColor = 0xffcccccc; |
| | | btnColorLine.BorderColor = 0xffcccccc;
|
| | | frameColor.AddChidren(btnColorLine, ChidrenBindMode.BindEventOnly);
|
| | |
|
| | | var btnColor = new NormalViewControl(Application.GetMinRealAverage(69), Application.GetMinRealAverage(69), false);
|
| | | var btnColor = new NormalViewControl(this.GetPictrueRealSize(69), this.GetPictrueRealSize(69), false);
|
| | | btnColor.Gravity = Gravity.Center;
|
| | | btnColor.Radius = (uint)Application.GetMinRealAverage(69) / 2;
|
| | | btnColor.Radius = (uint)this.GetPictrueRealSize(69) / 2;
|
| | | btnColor.BackgroundColor = backColor;
|
| | | btnColorLine.AddChidren(btnColor, ChidrenBindMode.BindEventOnly);
|
| | |
|
| | | //变更滑动条的颜色
|
| | | seekBar1.ProgressBarColor = backColor;
|
| | |
|
| | | var btnRight = new NormalViewControl(Application.GetMinRealAverage(58), Application.GetMinRealAverage(58), false);
|
| | | var btnRight = new NormalViewControl(this.GetPictrueRealSize(58), this.GetPictrueRealSize(58), false);
|
| | | btnRight.UnSelectedImagePath = "Item/RightNext.png";
|
| | | btnRight.Y = Application.GetRealHeight(5);
|
| | | btnRight.X = frameColor.Width - Application.GetMinRealAverage(58);
|
| | | btnRight.X = frameColor.Width - this.GetPictrueRealSize(58);
|
| | | frameColor.AddChidren(btnRight, ChidrenBindMode.BindEventOnly);
|
| | | btnRight.Y += Application.GetMinRealAverage(8);
|
| | | btnRight.Y += this.GetPictrueRealSize(8);
|
| | |
|
| | | frameColor.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | |
| | | btnTemp2.Text = "100%";
|
| | | frameBack.AddChidren(btnTemp2);
|
| | |
|
| | | var frameColor = new FrameLayoutControl();
|
| | | var frameColor = new FrameLayoutStatuControl();
|
| | | frameColor.UseClickStatu = false;
|
| | | frameColor.Width = Application.GetRealHeight(262);
|
| | | frameColor.Height = Application.GetMinRealAverage(79);
|
| | | frameColor.Height = this.GetPictrueRealSize(79);
|
| | | frameColor.Y = Application.GetRealHeight(26);
|
| | | frameColor.X = listview.Width - ControlCommonResourse.XXLeft - Application.GetRealHeight(262);
|
| | | frameBack.AddChidren(frameColor); |
| | | |
| | | //颜色 |
| | | var btnColorView = new NormalViewControl(Application.GetRealHeight(110), Application.GetMinRealAverage(49), false);
|
| | | frameBack.AddChidren(frameColor);
|
| | |
|
| | | //颜色
|
| | | var btnColorView = new NormalViewControl(Application.GetRealHeight(110), this.GetPictrueRealSize(49), false);
|
| | | btnColorView.Gravity = Gravity.CenterVertical;
|
| | | btnColorView.TextAlignment = TextAlignment.CenterRight;
|
| | | btnColorView.TextSize = 12;
|
| | |
| | | int R1 = Convert.ToInt32(this.keyColorData.OpenColorR, 16);
|
| | | int G1 = Convert.ToInt32(this.keyColorData.OpenColorG, 16);
|
| | | int B1 = Convert.ToInt32(this.keyColorData.OpenColorB, 16);
|
| | | uint backColor = this.GetColorByRGB((byte)R1, (byte)G1, (byte)B1); |
| | | |
| | | //颜色外框 |
| | | var btnColorLine = new FrameLayoutControl(); |
| | | uint backColor = this.GetColorByRGB((byte)R1, (byte)G1, (byte)B1);
|
| | |
|
| | | //颜色外框
|
| | | var btnColorLine = new FrameLayoutStatuControl();
|
| | | btnColorLine.Width = Application.GetRealHeight(79);
|
| | | btnColorLine.Height = Application.GetMinRealAverage(79); |
| | | btnColorLine.Height = this.GetPictrueRealSize(79);
|
| | | btnColorLine.X = btnColorView.Right + Application.GetRealHeight(18);
|
| | | btnColorLine.Radius = (uint)Application.GetMinRealAverage(79) / 2;
|
| | | btnColorLine.Radius = (uint)this.GetPictrueRealSize(79) / 2;
|
| | | btnColorLine.BorderWidth = 1;
|
| | | btnColorLine.BorderColor = 0xffcccccc; |
| | | frameColor.AddChidren(btnColorLine, ChidrenBindMode.BindEventOnly); |
| | | |
| | | var btnColor = new NormalViewControl(Application.GetMinRealAverage(69), Application.GetMinRealAverage(69), false); |
| | | btnColorLine.BorderColor = 0xffcccccc;
|
| | | frameColor.AddChidren(btnColorLine, ChidrenBindMode.BindEventOnly);
|
| | |
|
| | | var btnColor = new NormalViewControl(this.GetPictrueRealSize(69), this.GetPictrueRealSize(69), false);
|
| | | btnColor.Gravity = Gravity.Center;
|
| | | btnColor.Radius = (uint)Application.GetMinRealAverage(69) / 2;
|
| | | btnColor.Radius = (uint)this.GetPictrueRealSize(69) / 2;
|
| | | btnColor.BackgroundColor = backColor;
|
| | | btnColorLine.AddChidren(btnColor, ChidrenBindMode.BindEventOnly);
|
| | |
|
| | | //变更滑动条的颜色
|
| | | seekBar1.ProgressBarColor = backColor;
|
| | |
|
| | | var btnRight = new NormalViewControl(Application.GetMinRealAverage(58), Application.GetMinRealAverage(58), false);
|
| | | var btnRight = new NormalViewControl(this.GetPictrueRealSize(58), this.GetPictrueRealSize(58), false);
|
| | | btnRight.UnSelectedImagePath = "Item/RightNext.png";
|
| | | btnRight.Y = Application.GetRealHeight(5);
|
| | | btnRight.X = frameColor.Width - Application.GetMinRealAverage(58);
|
| | | btnRight.X = frameColor.Width - this.GetPictrueRealSize(58);
|
| | | frameColor.AddChidren(btnRight, ChidrenBindMode.BindEventOnly);
|
| | | btnRight.Y += Application.GetMinRealAverage(8);
|
| | | btnRight.Y += this.GetPictrueRealSize(8);
|
| | |
|
| | | frameColor.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | |
| | | }
|
| | |
|
| | | //节能模式修改(他们说随便一个回路就行)
|
| | | //设备同事说默认去秒时间,这样接近感应功能才合理
|
| | | energyModeInfo.time = 1;
|
| | | //肖志豪给按键控制面板(四开八控)设备,说默认15秒时间,这样接近感应功能才合理
|
| | | energyModeInfo.time = 15;
|
| | | result = await HdlDevicePanelLogic.Current.SetDeviceEnergyConservationMode(panelDevice, energyModeInfo.enable, energyModeInfo.time, energyModeInfo.level);
|
| | | if (result == false)
|
| | | {
|
| | | this.CloseProgressBar();
|
| | | return;
|
| | | }
|
| | | //接近修改(他们说随便一个回路就行)
|
| | | //接近传感设置 (肖志豪给按键控制面板(四开八控)设备,传感距离和触发延迟时间默认用最大值)
|
| | | result = await HdlDevicePanelLogic.Current.SetProximitySensorStatus(panelDevice, proximitySensorsInfo.enable);
|
| | | if (result == false)
|
| | | {
|
| | |
| | | private uint GetColorByRGB(byte R, byte G, byte B)
|
| | | {
|
| | | return (uint)(0xFF000000 + R * 256 * 256 + G * 256 + B);
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | | } |
| | | }
|