New file |
| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Text;
|
| | | using ZigBee.Device;
|
| | |
|
| | | namespace Shared.Phone.UserCenter.DevicePanel
|
| | | {
|
| | | /// <summary>
|
| | | /// 方悦环境面板的亮度调节界面
|
| | | /// </summary>
|
| | | public class PanelFangyueEnvironmentLightSettionForm : EditorCommonForm
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 设备的某一回路
|
| | | /// </summary>
|
| | | private CommonDevice deviceObj = null;
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
| | | /// </summary>
|
| | | /// <param name="i_device">设备的某一回路</param>
|
| | | public void ShowForm(CommonDevice i_device)
|
| | | {
|
| | | //左滑使能不可
|
| | | this.ScrollEnabled = false;
|
| | |
|
| | | this.deviceObj = i_device;
|
| | |
|
| | | //设置头部信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uLightRegulation));
|
| | |
|
| | | //初始化中部信息
|
| | | this.InitMiddleFrame();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化中部信息
|
| | | /// </summary>
|
| | | private void InitMiddleFrame()
|
| | | {
|
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame();
|
| | |
|
| | | //添加屏幕亮度级别控件
|
| | | this.AddScreenBrightnesLevelControl();
|
| | |
|
| | | //添加背光灯亮度控件
|
| | | this.AddBackLightControl();
|
| | |
|
| | | //添加节能模式控件
|
| | | this.AddEnergyConservationControl();
|
| | |
|
| | | //保存
|
| | | var btnSave = new BottomClickButton();
|
| | | btnSave.TextID = R.MyInternationalizationString.uSave;
|
| | | bodyFrameLayout.AddChidren(btnSave);
|
| | | btnSave.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //保存配置
|
| | | this.SaveSettionData();
|
| | | };
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 屏幕亮度级别_______________________
|
| | |
|
| | | /// <summary>
|
| | | /// 添加屏幕亮度级别控件
|
| | | /// </summary>
|
| | | private void AddScreenBrightnesLevelControl()
|
| | | {
|
| | | var frameBack = new FrameLayout();
|
| | | frameBack.Height = Application.GetRealHeight(429);
|
| | | frameBack.BackgroundColor = UserCenterColor.Current.White;
|
| | | bodyFrameLayout.AddChidren(frameBack);
|
| | |
|
| | | //屏幕亮度级别
|
| | | var btnLevelView = new NormalViewControl(400, 60, true);
|
| | | btnLevelView.X = ControlCommonResourse.XXLeft;
|
| | | btnLevelView.Y = Application.GetRealHeight(54);
|
| | | btnLevelView.TextID = R.MyInternationalizationString.uScreenBrightnesLevel;
|
| | | frameBack.AddChidren(btnLevelView);
|
| | |
|
| | | //?级
|
| | | string strRank = Language.StringByID(R.MyInternationalizationString.uRank);
|
| | | var btnLevel = new NormalViewControl(167, 60, true);
|
| | | btnLevel.X = Application.GetRealWidth(855);
|
| | | btnLevel.Y = Application.GetRealHeight(54);
|
| | | btnLevel.TextAlignment = TextAlignment.CenterRight;
|
| | | btnLevel.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | btnLevel.Text = "3" + strRank;
|
| | | frameBack.AddChidren(btnLevel);
|
| | |
|
| | | //当前亮度
|
| | | var btnProgressView1 = new NormalViewControl(200, 50, true);
|
| | | btnProgressView1.X = ControlCommonResourse.XXLeft;
|
| | | btnProgressView1.Y = Application.GetRealHeight(157);
|
| | | btnProgressView1.TextSize = 12;
|
| | | btnProgressView1.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | btnProgressView1.TextID = R.MyInternationalizationString.uNowLuminance;
|
| | | frameBack.AddChidren(btnProgressView1);
|
| | | var btnProgress1 = new NormalViewControl(200, 50, true);
|
| | | btnProgress1.X = Application.GetRealWidth(222);
|
| | | btnProgress1.Y = Application.GetRealHeight(157);
|
| | | btnProgress1.TextSize = 12;
|
| | | btnProgress1.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | btnProgress1.Text = "4";
|
| | | frameBack.AddChidren(btnProgress1);
|
| | |
|
| | | //进度条
|
| | | var seekBar1 = new SeekBarControl();
|
| | | seekBar1.MaxValue = 5;
|
| | | seekBar1.ProgressBarColor = 0xff3e99f4;
|
| | | seekBar1.Y = Application.GetRealHeight(253);
|
| | | frameBack.AddChidren(seekBar1);
|
| | | seekBar1.ProgressChangedEvent += (div, value) =>
|
| | | {
|
| | | btnProgress1.Text = value.ToString();
|
| | | //数据变更
|
| | | };
|
| | | //seekBar1.Progress = linghtLevelInfo.panelBacklightLevel;
|
| | |
|
| | | var btnTemp1 = new NormalViewControl(200, 50, true);
|
| | | btnTemp1.X = ControlCommonResourse.XXLeft;
|
| | | btnTemp1.Y = Application.GetRealHeight(322);
|
| | | btnTemp1.TextSize = 12;
|
| | | btnTemp1.TextColor = UserCenterColor.Current.TextGrayColor3;
|
| | | btnTemp1.Text = "0";
|
| | | frameBack.AddChidren(btnTemp1);
|
| | |
|
| | | var btnTemp2 = new NormalViewControl(100, 50, true);
|
| | | btnTemp2.X = frameBack.Width - ControlCommonResourse.XXLeft - Application.GetRealWidth(100);
|
| | | btnTemp2.Y = Application.GetRealHeight(322);
|
| | | btnTemp2.TextAlignment = TextAlignment.CenterRight;
|
| | | btnTemp2.TextSize = 12;
|
| | | btnTemp2.TextColor = UserCenterColor.Current.TextGrayColor3;
|
| | | btnTemp2.Text = "5";
|
| | | frameBack.AddChidren(btnTemp2);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 背光灯亮度_________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 添加背光灯亮度控件
|
| | | /// </summary>
|
| | | private void AddBackLightControl()
|
| | | {
|
| | | //背景
|
| | | var frameBack = new FrameLayout();
|
| | | frameBack.Y = Application.GetRealHeight(490);
|
| | | frameBack.Height = Application.GetRealHeight(429);
|
| | | frameBack.BackgroundColor = UserCenterColor.Current.White;
|
| | | bodyFrameLayout.AddChidren(frameBack);
|
| | |
|
| | | //背光灯亮度
|
| | | var btnLevelView = new NormalViewControl(400, 60, true);
|
| | | btnLevelView.X = ControlCommonResourse.XXLeft;
|
| | | btnLevelView.Y = Application.GetRealHeight(54);
|
| | | btnLevelView.TextID = R.MyInternationalizationString.uBacklightBrightness;
|
| | | frameBack.AddChidren(btnLevelView);
|
| | |
|
| | | //当前亮度
|
| | | var btnProgressView1 = new NormalViewControl(200, 50, true);
|
| | | btnProgressView1.X = ControlCommonResourse.XXLeft;
|
| | | btnProgressView1.Y = Application.GetRealHeight(157);
|
| | | btnProgressView1.TextSize = 12;
|
| | | btnProgressView1.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | btnProgressView1.TextID = R.MyInternationalizationString.uNowLuminance;
|
| | | frameBack.AddChidren(btnProgressView1);
|
| | | var btnProgress1 = new NormalViewControl(200, 50, true);
|
| | | btnProgress1.X = Application.GetRealWidth(222);
|
| | | btnProgress1.Y = Application.GetRealHeight(157);
|
| | | btnProgress1.TextSize = 12;
|
| | | btnProgress1.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | btnProgress1.Text = "70%";
|
| | | frameBack.AddChidren(btnProgress1);
|
| | |
|
| | | //进度条
|
| | | var seekBar1 = new SeekBarControl();
|
| | | seekBar1.Y = Application.GetRealHeight(253);
|
| | | frameBack.AddChidren(seekBar1);
|
| | | seekBar1.ProgressChangedEvent += (div, value) =>
|
| | | {
|
| | | btnProgress1.Text = value + "%";
|
| | | //数据变更
|
| | | };
|
| | | //seekBar1.Progress = linghtLevelInfo.panelBacklightLevel;
|
| | |
|
| | | var btnTemp1 = new NormalViewControl(200, 50, true);
|
| | | btnTemp1.X = ControlCommonResourse.XXLeft;
|
| | | btnTemp1.Y = Application.GetRealHeight(322);
|
| | | btnTemp1.TextSize = 12;
|
| | | btnTemp1.TextColor = UserCenterColor.Current.TextGrayColor3;
|
| | | btnTemp1.Text = "0%";
|
| | | frameBack.AddChidren(btnTemp1);
|
| | |
|
| | | var btnTemp2 = new NormalViewControl(200, 50, true);
|
| | | btnTemp2.X = frameBack.Width - ControlCommonResourse.XXLeft - Application.GetRealWidth(200);
|
| | | btnTemp2.Y = Application.GetRealHeight(322);
|
| | | btnTemp2.TextAlignment = TextAlignment.CenterRight;
|
| | | btnTemp2.TextSize = 12;
|
| | | btnTemp2.TextColor = UserCenterColor.Current.TextGrayColor3;
|
| | | btnTemp2.Text = "100%";
|
| | | frameBack.AddChidren(btnTemp2);
|
| | |
|
| | | var frameColor = new FrameLayoutControl();
|
| | | frameColor.UseClickStatu = false;
|
| | | frameColor.Width = Application.GetRealHeight(262);
|
| | | frameColor.Height = Application.GetMinRealAverage(79);
|
| | | frameColor.Y = Application.GetRealHeight(26);
|
| | | frameColor.X = frameBack.Width - ControlCommonResourse.XXLeft - Application.GetRealHeight(262);
|
| | | frameBack.AddChidren(frameColor);
|
| | | //颜色
|
| | | var btnColorView = new NormalViewControl(Application.GetRealHeight(110), Application.GetMinRealAverage(50), false);
|
| | | btnColorView.Gravity = Gravity.CenterVertical;
|
| | | btnColorView.TextAlignment = TextAlignment.CenterRight;
|
| | | btnColorView.TextSize = 12;
|
| | | btnColorView.Y = Application.GetRealHeight(5);
|
| | | btnColorView.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | btnColorView.TextID = R.MyInternationalizationString.uColor;
|
| | | frameColor.AddChidren(btnColorView, ChidrenBindMode.BindEventOnly);
|
| | |
|
| | | int R1 = Convert.ToInt32("d8", 16);
|
| | | int G1 = Convert.ToInt32("95", 16);
|
| | | int B1 = Convert.ToInt32("e3", 16);
|
| | | uint backColor = this.GetColorByRGB((byte)R1, (byte)G1, (byte)B1);
|
| | |
|
| | | //颜色外框
|
| | | var frameColorLine = new FrameLayoutControl();
|
| | | frameColorLine.UseClickStatu = false;
|
| | | frameColorLine.Height = Application.GetMinRealAverage(79);
|
| | | frameColorLine.Width = Application.GetMinRealAverage(79);
|
| | | frameColorLine.Radius = (uint)Application.GetMinRealAverage(79) / 2;
|
| | | frameColorLine.BorderWidth = 1;
|
| | | frameColorLine.BorderColor = 0xffcccccc;
|
| | | frameColor.AddChidren(frameColorLine, ChidrenBindMode.NotBind);
|
| | |
|
| | | //分两步计算,不然有可能它得出的结果有误差导致不居中
|
| | | int btnColorWidth = frameColorLine.Height - Application.GetMinRealAverage(7) - Application.GetMinRealAverage(7);
|
| | | var btnColor = new NormalViewControl(btnColorWidth, btnColorWidth, false);
|
| | | btnColor.Gravity = Gravity.Center;
|
| | | btnColor.Radius = (uint)btnColorWidth / 2;
|
| | | btnColor.BackgroundColor = UserCenterColor.Current.ErrorColor;
|
| | | frameColorLine.AddChidren(btnColor, ChidrenBindMode.NotBind);
|
| | | frameColor.ChangedChidrenBindMode(frameColorLine, ChidrenBindMode.BindEventOnly);
|
| | |
|
| | | //变更滑动条的颜色
|
| | | seekBar1.ProgressBarColor = backColor;
|
| | |
|
| | | var btnRight = new NormalViewControl(Application.GetMinRealAverage(58), Application.GetMinRealAverage(58), false);
|
| | | btnRight.UnSelectedImagePath = "Item/RightNext.png";
|
| | | btnRight.Y = Application.GetRealHeight(5);
|
| | | btnRight.X = frameColor.Width - Application.GetMinRealAverage(58);
|
| | | frameColor.AddChidren(btnRight, ChidrenBindMode.BindEventOnly);
|
| | | btnRight.Y += Application.GetMinRealAverage(8);
|
| | |
|
| | | frameColor.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var form = new PanelColorSelectForm();
|
| | | form.AddForm(R1, G1, B1);
|
| | | form.FinishSelectColorEvent += (Rcolor, Gcolor, Bcolor) =>
|
| | | {
|
| | | R1 = Rcolor;
|
| | | G1 = Gcolor;
|
| | | B1 = Bcolor;
|
| | |
|
| | | //this.keyColorData.CloseColorR = Convert.ToString(Rcolor, 16);
|
| | | //this.keyColorData.CloseColorG = Convert.ToString(Gcolor, 16);
|
| | | //this.keyColorData.CloseColorB = Convert.ToString(Bcolor, 16);
|
| | |
|
| | | btnColor.BackgroundColor = this.GetColorByRGB((byte)Rcolor, (byte)Gcolor, (byte)Bcolor);
|
| | | //变更滑动条的颜色
|
| | | seekBar1.ProgressBarColor = btnColor.BackgroundColor;
|
| | | };
|
| | | };
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 节能模式___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 添加节能模式控件
|
| | | /// </summary>
|
| | | private void AddEnergyConservationControl()
|
| | | {
|
| | | //缩小:170 扩大:429
|
| | | var frameBack = new FrameRowControl();
|
| | | frameBack.Y = Application.GetRealHeight(976);
|
| | | frameBack.BackgroundColor = UserCenterColor.Current.White;
|
| | | frameBack.UseClickStatu = false;
|
| | | frameBack.Height = Application.GetRealHeight(170);
|
| | | bodyFrameLayout.AddChidren(frameBack);
|
| | |
|
| | | //节能模式
|
| | | frameBack.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uEnergyConservationMode), 400);
|
| | | //开关控件
|
| | | var btnSwitch = frameBack.AddMostRightSwitchIcon();
|
| | | btnSwitch.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected;
|
| | | //展开或者缩小的高度
|
| | | var value = Application.GetRealHeight(259);
|
| | | if (btnSwitch.IsSelected == true)
|
| | | {
|
| | | frameBack.Height += value;
|
| | | }
|
| | | else
|
| | | {
|
| | | frameBack.Height -= value;
|
| | | }
|
| | | };
|
| | |
|
| | | //当前亮度
|
| | | var btnProgressView1 = new NormalViewControl(200, 50, true);
|
| | | btnProgressView1.X = ControlCommonResourse.XXLeft;
|
| | | btnProgressView1.Y = Application.GetRealHeight(162);
|
| | | btnProgressView1.TextSize = 12;
|
| | | btnProgressView1.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | btnProgressView1.TextID = R.MyInternationalizationString.uNowLuminance;
|
| | | frameBack.AddChidren(btnProgressView1);
|
| | | var btnProgress1 = new NormalViewControl(200, 50, true);
|
| | | btnProgress1.X = Application.GetRealWidth(222);
|
| | | btnProgress1.Y = Application.GetRealHeight(162);
|
| | | btnProgress1.TextSize = 12;
|
| | | btnProgress1.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | btnProgress1.Text = "50%";
|
| | | frameBack.AddChidren(btnProgress1);
|
| | |
|
| | | //进度条
|
| | | var seekBar1 = new SeekBarControl();
|
| | | seekBar1.Y = Application.GetRealHeight(253);
|
| | | seekBar1.ProgressBarColor = 0xff3e99f4;
|
| | | frameBack.AddChidren(seekBar1);
|
| | | seekBar1.ProgressChangedEvent += (div, value) =>
|
| | | {
|
| | | btnProgress1.Text = value + "%";
|
| | | };
|
| | | //seekBar1.Progress = energyModeInfo.level;
|
| | |
|
| | | var btnTemp1 = new NormalViewControl(200, 50, true);
|
| | | btnTemp1.X = ControlCommonResourse.XXLeft;
|
| | | btnTemp1.Y = Application.GetRealHeight(325);
|
| | | btnTemp1.TextSize = 12;
|
| | | btnTemp1.TextColor = UserCenterColor.Current.TextGrayColor3;
|
| | | btnTemp1.Text = "0%";
|
| | | frameBack.AddChidren(btnTemp1);
|
| | |
|
| | | var btnTemp2 = new NormalViewControl(200, 50, true);
|
| | | btnTemp2.X = frameBack.Width - ControlCommonResourse.XXLeft - Application.GetRealWidth(200);
|
| | | btnTemp2.Y = Application.GetRealHeight(325);
|
| | | btnTemp2.TextAlignment = TextAlignment.CenterRight;
|
| | | btnTemp2.TextSize = 12;
|
| | | btnTemp2.TextColor = UserCenterColor.Current.TextGrayColor3;
|
| | | btnTemp2.Text = "100%";
|
| | | frameBack.AddChidren(btnTemp2);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 保存配置___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 保存配置
|
| | | /// </summary>
|
| | | private void SaveSettionData()
|
| | | {
|
| | | this.CloseForm();
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 一般方法___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 将RGB转换为颜色
|
| | | /// </summary>
|
| | | /// <param name="R"></param>
|
| | | /// <param name="G"></param>
|
| | | /// <param name="B"></param>
|
| | | /// <returns></returns>
|
| | | private uint GetColorByRGB(byte R, byte G, byte B)
|
| | | {
|
| | | return (uint)(0xFF000000 + R * 256 * 256 + G * 256 + B);
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | | }
|