using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Threading.Tasks;
|
using ZigBee.Device;
|
|
namespace Shared.Phone.UserCenter.DevicePanel
|
{
|
/// <summary>
|
/// 控制面板的背光设置界面★
|
/// </summary>
|
public class PanelBackLightSettionForm : EditorCommonForm
|
{
|
#region ■ 变量声明___________________________
|
|
/// <summary>
|
/// 面板的回路
|
/// </summary>
|
private Panel panelDevice = null;
|
/// <summary>
|
/// 亮度调节的信息
|
/// </summary>
|
private Panel.PanelSwitchLevelInfo linghtLevelInfo = null;
|
/// <summary>
|
/// 节能模式
|
/// </summary>
|
private Panel.PanelSaveEnergyModeInfo energyModeInfo = null;
|
/// <summary>
|
/// 按键的颜色数据
|
/// </summary>
|
private Panel.KeyColorData keyColorData = null;
|
|
#endregion
|
|
#region ■ 初始化_____________________________
|
|
/// <summary>
|
/// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
/// </summary>
|
/// <param name="i_listdevice">面板设备的全部回路</param>
|
public void ShowForm(Panel i_panel)
|
{
|
this.ScrollEnabled = false;
|
|
this.panelDevice = i_panel;
|
|
//设置标题信息
|
base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uBackLight));
|
|
HdlThreadLogic.Current.RunThread(() =>
|
{
|
//初始化中部控件
|
this.InitMiddleFrame();
|
});
|
}
|
|
/// <summary>
|
/// 初始化中部信息
|
/// </summary>
|
private void InitMiddleFrame()
|
{
|
//获取设备初始数据
|
var result = this.GetDeviceDefultData();
|
if (result == false)
|
{
|
return;
|
}
|
HdlThreadLogic.Current.RunMain(() =>
|
{
|
//清空bodyFrame
|
this.ClearBodyFrame();
|
|
//各种背光灯的容器
|
var frameLinght = new FrameLayout();
|
frameLinght.Height = Application.GetRealHeight(1003);
|
frameLinght.Y = Application.GetRealHeight(170);
|
bodyFrameLayout.AddChidren(frameLinght);
|
|
//添加节能模式
|
this.AddEnergyConservationRow(frameLinght);
|
//添加点击前,亮度进度条
|
this.AddBeforeClickProgress(frameLinght);
|
//添加点击后,亮度进度条
|
this.AddAfterClickProgress(frameLinght);
|
|
//保存
|
var btnSave = new BottomClickButton();
|
btnSave.TextID = R.MyInternationalizationString.uSave;
|
bodyFrameLayout.AddChidren(btnSave);
|
btnSave.ButtonClickEvent += (sender, e) =>
|
{
|
//保存面板数据
|
this.SavePanelData();
|
};
|
//如果当前是展示模板,则不能编辑
|
if (Common.Config.Instance.Home.IsShowTemplate == true)
|
{
|
btnSave.CanClick = false;
|
}
|
});
|
}
|
|
#endregion
|
|
#region ■ 节能模式行_________________________
|
|
/// <summary>
|
/// 添加节能模式行
|
/// </summary>
|
/// <param name="frameLinght">各种背光灯的容器(控件伸缩使用)</param>
|
private void AddEnergyConservationRow(FrameLayout frameLinght)
|
{
|
//缩小:170 扩大:429
|
var frameBack = new FrameRowControl();
|
frameBack.BackgroundColor = UserCenterColor.Current.White;
|
frameBack.UseClickStatu = false;
|
frameBack.Height = Application.GetRealHeight(170);
|
bodyFrameLayout.AddChidren(frameBack);
|
|
//当前亮度(先声明,为了对应IOS的折叠后,没有完全遮挡的问题)
|
var btnProgressView1 = new NormalViewControl(200, 49, true);
|
var btnProgress1 = new NormalViewControl(200, 49, true);
|
|
//节能模式
|
frameBack.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uEnergyConservationMode), 400);
|
//开关控件
|
var btnSwitch = frameBack.AddMostRightSwitchIcon();
|
btnSwitch.ButtonClickEvent += (sender, e) =>
|
{
|
btnSwitch.IsSelected = !btnSwitch.IsSelected;
|
energyModeInfo.enable = btnSwitch.IsSelected;
|
//展开或者缩小的高度
|
var value = Application.GetRealHeight(259);
|
if (btnSwitch.IsSelected == true)
|
{
|
frameBack.Height += value;
|
frameLinght.Y += value;
|
btnProgressView1.Visible = true;
|
btnProgress1.Visible = true;
|
}
|
else
|
{
|
frameBack.Height -= value;
|
frameLinght.Y -= value;
|
btnProgressView1.Visible = false;
|
btnProgress1.Visible = false;
|
}
|
};
|
if (energyModeInfo.enable == true)
|
{
|
btnSwitch.IsSelected = true;
|
}
|
|
//当前亮度
|
btnProgressView1.X = HdlControlResourse.XXLeft;
|
btnProgressView1.Y = Application.GetRealHeight(164);
|
btnProgressView1.TextSize = 12;
|
btnProgressView1.TextColor = UserCenterColor.Current.TextGrayColor1;
|
btnProgressView1.TextID = R.MyInternationalizationString.uNowLuminance;
|
frameBack.AddChidren(btnProgressView1);
|
btnProgressView1.Visible = false;
|
btnProgress1.X = Application.GetRealWidth(222);
|
btnProgress1.Y = Application.GetRealHeight(164);
|
btnProgress1.TextSize = 12;
|
btnProgress1.TextColor = UserCenterColor.Current.TextGrayColor1;
|
btnProgress1.Text = energyModeInfo.level + "%";
|
frameBack.AddChidren(btnProgress1);
|
btnProgress1.Visible = false;
|
|
//进度条
|
var seekBar1 = new SeekBarControl();
|
seekBar1.Y = Application.GetRealHeight(253);
|
seekBar1.ProgressBarColor = 0xff3e99f4;
|
frameBack.AddChidren(seekBar1);
|
seekBar1.ProgressChangedEvent += (div, value) =>
|
{
|
btnProgress1.Text = value + "%";
|
//数据变更
|
energyModeInfo.level = value;
|
};
|
seekBar1.Progress = energyModeInfo.level;
|
|
var btnTemp1 = new NormalViewControl(200, 49, true);
|
btnTemp1.X = HdlControlResourse.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, 49, true);
|
btnTemp2.X = frameLinght.Width - Application.GetRealWidth(200 + 49);
|
btnTemp2.Y = Application.GetRealHeight(325);
|
btnTemp2.TextAlignment = TextAlignment.CenterRight;
|
btnTemp2.TextSize = 12;
|
btnTemp2.TextColor = UserCenterColor.Current.TextGrayColor3;
|
btnTemp2.Text = "100%";
|
frameBack.AddChidren(btnTemp2);
|
|
if (energyModeInfo.enable == true)
|
{
|
//展开或者缩小的高度
|
var value = Application.GetRealHeight(259);
|
frameBack.Height += value;
|
frameLinght.Y += value;
|
|
btnProgressView1.Visible = true;
|
btnProgress1.Visible = true;
|
}
|
//如果当前是展示模板,则不能编辑
|
if (Common.Config.Instance.Home.IsShowTemplate == true)
|
{
|
btnSwitch.CanClick = false;
|
seekBar1.Enable = false;
|
}
|
}
|
|
#endregion
|
|
#region ■ 点击前_____________________________
|
|
/// <summary>
|
/// 添加点击前的背光灯进度条
|
/// </summary>
|
/// <param name="frameLinght">各种背光灯的容器</param>
|
private void AddBeforeClickProgress(FrameLayout frameLinght)
|
{
|
//点击前
|
var btnClick = new NormalViewControl(600, 49, true);
|
btnClick.X = HdlControlResourse.XXLeft;
|
btnClick.Y = Application.GetRealHeight(35);
|
btnClick.TextSize = 12;
|
btnClick.TextColor = UserCenterColor.Current.TextGrayColor3;
|
btnClick.TextID = R.MyInternationalizationString.uBeforeClick;
|
frameLinght.AddChidren(btnClick);
|
//背景
|
var frameBack = new FrameLayout();
|
frameBack.Y = Application.GetRealHeight(107);
|
frameBack.Height = Application.GetRealHeight(395);
|
frameBack.BackgroundColor = UserCenterColor.Current.White;
|
frameLinght.AddChidren(frameBack);
|
//当前亮度
|
var btnProgressView1 = new NormalViewControl(200, 49, true);
|
btnProgressView1.X = HdlControlResourse.XXLeft;
|
btnProgressView1.Y = Application.GetRealHeight(52);
|
btnProgressView1.TextSize = 12;
|
btnProgressView1.TextColor = UserCenterColor.Current.TextGrayColor1;
|
btnProgressView1.TextID = R.MyInternationalizationString.uNowLuminance;
|
frameBack.AddChidren(btnProgressView1);
|
var btnProgress1 = new NormalViewControl(200, 49, true);
|
btnProgress1.X = Application.GetRealWidth(222);
|
btnProgress1.Y = Application.GetRealHeight(52);
|
btnProgress1.TextSize = 12;
|
btnProgress1.TextColor = UserCenterColor.Current.TextGrayColor1;
|
btnProgress1.Text = linghtLevelInfo.panelBacklightLevel + "%";
|
frameBack.AddChidren(btnProgress1);
|
|
//进度条
|
var seekBar1 = new SeekBarControl();
|
seekBar1.Y = Application.GetRealHeight(147);
|
frameBack.AddChidren(seekBar1);
|
seekBar1.ProgressChangedEvent += (div, value) =>
|
{
|
btnProgress1.Text = value + "%";
|
//数据变更
|
linghtLevelInfo.panelBacklightLevel = value;
|
};
|
seekBar1.Progress = linghtLevelInfo.panelBacklightLevel;
|
|
var btnTemp1 = new NormalViewControl(200, 49, true);
|
btnTemp1.X = HdlControlResourse.XXLeft;
|
btnTemp1.Y = Application.GetRealHeight(216);
|
btnTemp1.TextSize = 12;
|
btnTemp1.TextColor = UserCenterColor.Current.TextGrayColor3;
|
btnTemp1.Text = "0%";
|
frameBack.AddChidren(btnTemp1);
|
|
var btnTemp2 = new NormalViewControl(200, 49, true);
|
btnTemp2.X = frameLinght.Width - Application.GetRealWidth(200 + 49);
|
btnTemp2.Y = Application.GetRealHeight(216);
|
btnTemp2.TextAlignment = TextAlignment.CenterRight;
|
btnTemp2.TextSize = 12;
|
btnTemp2.TextColor = UserCenterColor.Current.TextGrayColor3;
|
btnTemp2.Text = "100%";
|
frameBack.AddChidren(btnTemp2);
|
|
var frameColor = new FrameLayoutStatuControl();
|
frameColor.UseClickStatu = false;
|
frameColor.Width = Application.GetRealHeight(262);
|
frameColor.Height = this.GetPictrueRealSize(79);
|
frameColor.Y = Application.GetRealHeight(26);
|
frameColor.X = frameLinght.Width - HdlControlResourse.XXLeft - Application.GetRealHeight(262);
|
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;
|
btnColorView.Y = Application.GetRealHeight(5);
|
btnColorView.TextColor = UserCenterColor.Current.TextGrayColor1;
|
btnColorView.TextID = R.MyInternationalizationString.uColor;
|
frameColor.AddChidren(btnColorView, ChidrenBindMode.BindEvent);
|
|
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 frameColorLine = new FrameLayoutStatuControl();
|
frameColorLine.UseClickStatu = false;
|
frameColorLine.Height = this.GetPictrueRealSize(79);
|
frameColorLine.Width = this.GetPictrueRealSize(79);
|
frameColorLine.X = btnColorView.Right + Application.GetRealHeight(18);
|
frameColorLine.Radius = (uint)this.GetPictrueRealSize(79) / 2;
|
frameColorLine.BorderWidth = 1;
|
frameColorLine.BorderColor = 0xffcccccc;
|
frameColor.AddChidren(frameColorLine, ChidrenBindMode.NotBind);
|
|
//分两步计算,不然有可能它得出的结果有误差导致不居中
|
int btnColorWidth = frameColorLine.Height - this.GetPictrueRealSize(7) - this.GetPictrueRealSize(7);
|
var btnColor = new NormalViewControl(btnColorWidth, btnColorWidth, false);
|
btnColor.Gravity = Gravity.Center;
|
btnColor.Radius = (uint)btnColorWidth / 2;
|
btnColor.BackgroundColor = backColor;
|
frameColorLine.AddChidren(btnColor, ChidrenBindMode.NotBind);
|
frameColor.ChangedChidrenBindMode(frameColorLine, ChidrenBindMode.BindEvent);
|
|
//变更滑动条的颜色
|
seekBar1.ProgressBarColor = backColor;
|
|
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 - this.GetPictrueRealSize(58);
|
frameColor.AddChidren(btnRight, ChidrenBindMode.BindEvent);
|
btnRight.Y += this.GetPictrueRealSize(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;
|
};
|
};
|
//如果当前是展示模板,则不能编辑
|
if (Common.Config.Instance.Home.IsShowTemplate == true)
|
{
|
frameColor.CanClick = false;
|
seekBar1.Enable = false;
|
}
|
}
|
|
#endregion
|
|
#region ■ 点击后_____________________________
|
|
/// <summary>
|
/// 添加点击后的背光灯进度条
|
/// </summary>
|
/// <param name="frameLinght">各种背光灯的容器</param>
|
private void AddAfterClickProgress(FrameLayout frameLinght)
|
{
|
//点击后
|
var btnClick = new NormalViewControl(600, 49, true);
|
btnClick.X = HdlControlResourse.XXLeft;
|
btnClick.Y = Application.GetRealHeight(536);
|
btnClick.TextSize = 12;
|
btnClick.TextColor = UserCenterColor.Current.TextGrayColor3;
|
btnClick.TextID = R.MyInternationalizationString.uAfterClick;
|
frameLinght.AddChidren(btnClick);
|
//背景
|
var frameBack = new FrameLayout();
|
frameBack.Y = Application.GetRealHeight(608);
|
frameBack.Height = Application.GetRealHeight(395);
|
frameBack.BackgroundColor = UserCenterColor.Current.White;
|
frameLinght.AddChidren(frameBack);
|
//当前亮度
|
var btnProgressView1 = new NormalViewControl(200, 49, true);
|
btnProgressView1.X = HdlControlResourse.XXLeft;
|
btnProgressView1.Y = Application.GetRealHeight(52);
|
btnProgressView1.TextSize = 12;
|
btnProgressView1.TextColor = UserCenterColor.Current.TextGrayColor1;
|
btnProgressView1.TextID = R.MyInternationalizationString.uNowLuminance;
|
frameBack.AddChidren(btnProgressView1);
|
var btnProgress1 = new NormalViewControl(200, 49, true);
|
btnProgress1.X = Application.GetRealWidth(222);
|
btnProgress1.Y = Application.GetRealHeight(52);
|
btnProgress1.TextSize = 12;
|
btnProgress1.TextColor = UserCenterColor.Current.TextGrayColor1;
|
btnProgress1.Text = linghtLevelInfo.panelDirectionsLevel + "%";
|
frameBack.AddChidren(btnProgress1);
|
|
//进度条
|
var seekBar1 = new SeekBarControl();
|
seekBar1.Y = Application.GetRealHeight(147);
|
frameBack.AddChidren(seekBar1);
|
seekBar1.ProgressChangedEvent += (div, value) =>
|
{
|
btnProgress1.Text = value + "%";
|
//数据变更
|
linghtLevelInfo.panelDirectionsLevel = value;
|
};
|
seekBar1.Progress = linghtLevelInfo.panelDirectionsLevel;
|
|
var btnTemp1 = new NormalViewControl(200, 49, true);
|
btnTemp1.X = HdlControlResourse.XXLeft;
|
btnTemp1.Y = Application.GetRealHeight(216);
|
btnTemp1.TextSize = 12;
|
btnTemp1.TextColor = UserCenterColor.Current.TextGrayColor3;
|
btnTemp1.Text = "0%";
|
frameBack.AddChidren(btnTemp1);
|
|
var btnTemp2 = new NormalViewControl(200, 49, true);
|
btnTemp2.X = frameLinght.Width - Application.GetRealWidth(200 + 49);
|
btnTemp2.Y = Application.GetRealHeight(216);
|
btnTemp2.TextAlignment = TextAlignment.CenterRight;
|
btnTemp2.TextSize = 12;
|
btnTemp2.TextColor = UserCenterColor.Current.TextGrayColor3;
|
btnTemp2.Text = "100%";
|
frameBack.AddChidren(btnTemp2);
|
|
var frameColor = new FrameLayoutStatuControl();
|
frameColor.UseClickStatu = false;
|
frameColor.Width = Application.GetRealHeight(262);
|
frameColor.Height = this.GetPictrueRealSize(79);
|
frameColor.Y = Application.GetRealHeight(26);
|
frameColor.X = frameLinght.Width - HdlControlResourse.XXLeft - Application.GetRealHeight(262);
|
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;
|
btnColorView.Y = Application.GetRealHeight(5);
|
btnColorView.TextColor = UserCenterColor.Current.TextGrayColor1;
|
btnColorView.TextID = R.MyInternationalizationString.uColor;
|
frameColor.AddChidren(btnColorView, ChidrenBindMode.BindEvent);
|
|
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 frameColorLine = new FrameLayoutStatuControl();
|
frameColorLine.UseClickStatu = false;
|
frameColorLine.Height = this.GetPictrueRealSize(79);
|
frameColorLine.Width = this.GetPictrueRealSize(79);
|
frameColorLine.X = btnColorView.Right + Application.GetRealHeight(18);
|
frameColorLine.Radius = (uint)this.GetPictrueRealSize(79) / 2;
|
frameColorLine.BorderWidth = 1;
|
frameColorLine.BorderColor = 0xffcccccc;
|
frameColor.AddChidren(frameColorLine, ChidrenBindMode.NotBind);
|
|
//分两步计算,不然有可能它得出的结果有误差导致不居中
|
int btnColorWidth = frameColorLine.Height - this.GetPictrueRealSize(7) - this.GetPictrueRealSize(7);
|
var btnColor = new NormalViewControl(btnColorWidth, btnColorWidth, false);
|
btnColor.Gravity = Gravity.Center;
|
btnColor.Radius = (uint)btnColorWidth / 2;
|
btnColor.BackgroundColor = backColor;
|
frameColorLine.AddChidren(btnColor, ChidrenBindMode.NotBind);
|
frameColor.ChangedChidrenBindMode(frameColorLine, ChidrenBindMode.BindEvent);
|
|
//变更滑动条的颜色
|
seekBar1.ProgressBarColor = backColor;
|
|
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 - this.GetPictrueRealSize(58);
|
frameColor.AddChidren(btnRight, ChidrenBindMode.BindEvent);
|
btnRight.Y += this.GetPictrueRealSize(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.OpenColorR = Convert.ToString(Rcolor, 16);
|
this.keyColorData.OpenColorG = Convert.ToString(Gcolor, 16);
|
this.keyColorData.OpenColorB = Convert.ToString(Bcolor, 16);
|
|
btnColor.BackgroundColor = this.GetColorByRGB((byte)Rcolor, (byte)Gcolor, (byte)Bcolor);
|
//变更滑动条的颜色
|
seekBar1.ProgressBarColor = btnColor.BackgroundColor;
|
};
|
};
|
//如果当前是展示模板,则不能编辑
|
if (Common.Config.Instance.Home.IsShowTemplate == true)
|
{
|
frameColor.CanClick = false;
|
seekBar1.Enable = false;
|
}
|
}
|
|
#endregion
|
|
#region ■ 获取初始数据_______________________
|
|
/// <summary>
|
/// 获取设备初始数据
|
/// </summary>
|
/// <returns></returns>
|
private bool GetDeviceDefultData()
|
{
|
//开启进度条
|
this.ShowProgressBar();
|
//亮度调节(他们说随便拿一路回路就行了)
|
linghtLevelInfo = HdlDevicePanelLogic.Current.GetDeviceLightSettion(panelDevice);
|
if (linghtLevelInfo == null)
|
{
|
//关闭进度条
|
this.CloseProgressBar(ShowReLoadMode.YES);
|
return false;
|
}
|
//节能模式(他们说随便拿一路回路就行了)
|
energyModeInfo = HdlDevicePanelLogic.Current.GetDeviceEnergyConservationMode(panelDevice);
|
if (energyModeInfo == null)
|
{
|
//关闭进度条
|
this.CloseProgressBar(ShowReLoadMode.YES);
|
return false;
|
}
|
keyColorData = HdlDevicePanelLogic.Current.GetPanelEpointColorInfo(panelDevice);
|
if (this.keyColorData == null)
|
{
|
//关闭进度条
|
this.CloseProgressBar(ShowReLoadMode.YES);
|
return false;
|
}
|
//关闭进度条
|
this.CloseProgressBar();
|
|
return true;
|
}
|
|
#endregion
|
|
#region ■ 保存数据___________________________
|
|
/// <summary>
|
/// 保存面板数据
|
/// </summary>
|
private void SavePanelData()
|
{
|
//亮度调节更改(他们说随便一个回路就行)
|
var result = HdlDevicePanelLogic.Current.SetDeviceLightSettion(panelDevice, linghtLevelInfo.panelDirectionsLevel, linghtLevelInfo.panelBacklightLevel);
|
if (result == false)
|
{
|
this.CloseProgressBar();
|
return;
|
}
|
//节能模式修改(他们说随便一个回路就行)
|
result = HdlDevicePanelLogic.Current.SetDeviceEnergyConservationMode(panelDevice, energyModeInfo.enable, energyModeInfo.time, energyModeInfo.level);
|
if (result == false)
|
{
|
return;
|
}
|
//设置按键面板指定端点的【指示灯开关颜色】的信息
|
result = HdlDevicePanelLogic.Current.SetPanelEpointColorInfo(panelDevice, this.keyColorData);
|
if (result == false)
|
{
|
return;
|
}
|
//关闭自身
|
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
|
}
|
}
|