using System;
|
using System.Collections.Generic;
|
using HDL_ON.Entity;
|
using HDL_ON.UI.CSS;
|
using Shared;
|
|
namespace HDL_ON.UI
|
{
|
public partial class GroupControlPage_V2 : FrameLayout
|
{
|
FrameLayout bodyView;
|
GroupControl function;
|
|
FrameLayout controlView;
|
|
Button btnFunctionName;
|
Button btnFromFoorAndRoom;
|
Button btnCollection;
|
|
Button btnCollection_Out;
|
Button btnFunctionName_Out;
|
Button btnFromFloor_Out;
|
|
public GroupControlPage_V2(GroupControl groupControl)
|
{
|
bodyView = this;
|
function = groupControl;
|
if (function == null)
|
{
|
function = new GroupControl();
|
}
|
}
|
|
public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut)
|
{
|
btnCollection_Out = btnCollectionIcon;
|
btnFunctionName_Out = btnFunctionNameOut;
|
btnFromFloor_Out = btnFromFloorOut;
|
bodyView.BackgroundColor = CSS_Color.BackgroundColor;
|
|
controlView = new FrameLayout()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Y = Application.GetRealHeight(88),
|
Width = Application.GetRealWidth(327),
|
Height = Application.GetRealHeight(526),
|
BackgroundImagePath = "Public/Fragmentbg.png",
|
};
|
bodyView.AddChidren(controlView);
|
|
btnFunctionName = new Button()
|
{
|
X = Application.GetRealWidth(16),
|
Y = Application.GetRealHeight(14),
|
Width = Application.GetRealWidth(270),
|
Height = Application.GetRealHeight(37),
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
|
Text = function.name,
|
};
|
controlView.AddChidren(btnFunctionName);
|
|
btnFromFoorAndRoom = new Button()
|
{
|
X = Application.GetRealWidth(16),
|
Y = btnFunctionName.Bottom,
|
Width = Application.GetRealWidth(270),
|
Height = Application.GetRealHeight(21),
|
TextColor = CSS_Color.PromptingColor1,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
Text = function.GetRoomListName()
|
};
|
controlView.AddChidren(btnFromFoorAndRoom);
|
|
btnCollection = new Button()
|
{
|
X = Application.GetRealWidth(273),
|
Y = Application.GetRealHeight(14),
|
Width = Application.GetMinRealAverage(40),
|
Height = Application.GetMinRealAverage(40),
|
SelectedImagePath = "Collection/CollectionIcon.png",
|
UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
|
IsSelected = function.collect
|
};
|
controlView.AddChidren(btnCollection);
|
btnCollection.MouseUpEventHandler += (sender, e) => {
|
btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
|
function.CollectFunction();
|
};
|
|
|
|
//回退刷新信息事件
|
new TopViewDiv(bodyView, Language.StringByID(StringId.CombinedDimming)).LoadTopView_SettingIcon( () => {
|
var page = new AddGroupControlPage(function,
|
(newGC) => {
|
try
|
{
|
Application.RunOnMainThread(() =>
|
{
|
if (newGC != null)
|
{
|
btnFunctionName.Text = btnFunctionName_Out.Text = function.name;
|
function.roomIds = newGC.uids;
|
btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = newGC.GetUidListName();
|
}
|
});
|
}
|
catch (Exception ex)
|
{
|
MainPage.Log($"刷新群控房间信息异常:{ex.Message}");
|
}
|
},()=> {
|
try
|
{
|
this.RemoveFromParent();
|
UI.HomePage.RefreshFunctionView();
|
UI.RoomPage.bodyView?.ReLoadPage();
|
UI.FunctionPage.bodyView?.ReLoadPage();
|
}
|
catch (Exception ex)
|
{
|
MainPage.Log($"群控刷新界面异常:\r\n{ex.Message}");
|
}
|
});
|
MainPage.BasePageView.AddChidren(page);
|
page.LoadPage();
|
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
|
|
});
|
|
ShowContentView();
|
}
|
|
private void ShowContentView()
|
{
|
var hadDimming = false;
|
var hadCCT = false;
|
var hadRGB = false;
|
var hadColorful = false;
|
|
foreach (var temp in function.sids)
|
{
|
if (temp.spk == SPK.LightRGB)
|
{
|
if (!hadColorful)
|
{
|
var lightGroupControl = FunctionList.List.GetLightList().Find((obj) => obj.sid == temp.sid);
|
if (lightGroupControl != null)
|
{
|
if (lightGroupControl.GetAttribute(FunctionAttributeKey.Colorful) != null)
|
{
|
hadColorful = true;
|
}
|
}
|
}
|
hadRGB = true;
|
}
|
else if (temp.spk == SPK.LightCCT)
|
{
|
hadCCT = true;
|
}
|
else if (temp.spk == SPK.LightDimming)
|
{
|
hadDimming = true;
|
}
|
|
if (hadDimming && hadCCT && hadRGB && hadColorful)
|
{
|
break;
|
}
|
}
|
|
//属性设置区域
|
var attrView = new VerticalScrolViewLayout()
|
{
|
Y = Application.GetRealHeight(52),
|
Width = Application.GetRealWidth(343),
|
ScrollEnabled = false,
|
};
|
//属性设置区域高度
|
int attrViewHight = Application.GetRealHeight(18 + 22);
|
|
|
controlView.AddChidren(attrView);
|
attrView.AddChidren(new Button() { Height = Application.GetRealHeight(18) });
|
|
|
if (hadRGB)
|
{
|
hadCCT = true;
|
LoadRgbAttrView(hadCCT,hadColorful);
|
}
|
else if (hadCCT)
|
{
|
LoadCctAttrView(attrView);
|
}
|
else if (hadDimming)
|
{
|
LoadDimmingAttrView(attrView);
|
}
|
|
|
|
|
var btnSwitch = new Button()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Y = Application.GetRealHeight(466),
|
Width = Application.GetMinRealAverage(32),
|
Height = Application.GetMinRealAverage(32),
|
UnSelectedImagePath = "Public/PowerClose.png",
|
SelectedImagePath = "Public/PowerOpen.png",
|
};
|
controlView.AddChidren(btnSwitch);
|
btnSwitch.MouseUpEventHandler = (sender, e) => {
|
if (btnSwitch.IsSelected)
|
{
|
btnSwitch.IsSelected = false;
|
var d = new Dictionary<string, string>();
|
d.Add(FunctionAttributeKey.OnOff, "off");
|
function.Control(d);
|
}
|
else
|
{
|
btnSwitch.IsSelected = true;
|
var d = new Dictionary<string, string>();
|
d.Add(FunctionAttributeKey.OnOff, "on");
|
function.Control(d);
|
}
|
};
|
|
|
}
|
|
/// <summary>
|
/// 加载调光属性设置控件
|
/// </summary>
|
/// <param name="attrView"></param>
|
void LoadDimmingAttrView(VerticalScrolViewLayout attrView)
|
{
|
var dimmingView = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(54 + 11)
|
};
|
attrView.AddChidren(dimmingView);
|
|
#region 亮度调节
|
var btnBrightnessText = new Button()
|
{
|
X = Application.GetRealWidth(35),
|
Y = Application.GetRealHeight(1),
|
Width = Application.GetRealWidth(224),
|
Height = Application.GetRealHeight(25),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
TextID = StringId.Brightness,
|
};
|
btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + function.GetAttrState(FunctionAttributeKey.Brightness) + "%";
|
dimmingView.AddChidren(btnBrightnessText);
|
|
|
var btnMinValuesText = new Button()
|
{
|
X = Application.GetRealWidth(35),
|
Y = btnBrightnessText.Bottom,
|
Width = Application.GetRealWidth(40),
|
Height = Application.GetRealHeight(21),
|
Text = "0%",
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.PromptingColor1,
|
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
};
|
dimmingView.AddChidren(btnMinValuesText);
|
|
var dimmerBar = new DiyImageSeekBar()
|
{
|
X = Application.GetRealWidth(45 + 10),
|
Y = Application.GetRealHeight(11),
|
Width = Application.GetRealWidth(220),
|
Height = Application.GetRealHeight(54),
|
SeekBarViewHeight = Application.GetRealHeight(8),
|
ThumbImagePath = "Public/ThumbImage.png",
|
ThumbImageHeight = Application.GetRealHeight(54),
|
ProgressTextColor = CSS_Color.FirstLevelTitleColor,
|
ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
ProgressBarColor = CSS_Color.AuxiliaryColor1,
|
MaxValue = 100,
|
SeekBarPadding = Application.GetRealWidth(20),
|
IsProgressTextShow = false,
|
ProgressChangeDelayTime = 0,
|
};
|
dimmingView.AddChidren(dimmerBar);
|
dimmerBar.OnProgressChangedEvent = (sender, e) =>
|
{
|
btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + e + "%";
|
};
|
dimmerBar.OnStopTrackingTouchEvent = (sender, e) =>
|
{
|
btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + e + "%";
|
|
var d = new Dictionary<string, string>();
|
d.Add(FunctionAttributeKey.Brightness, e.ToString());
|
function.Control(d);
|
};
|
|
|
var btnMaxValuesText = new Button()
|
{
|
X = dimmerBar.Right,
|
Y = btnBrightnessText.Bottom,
|
Width = Application.GetRealWidth(55),
|
Height = Application.GetRealHeight(21),
|
Text = "100%",
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.PromptingColor1,
|
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
};
|
dimmingView.AddChidren(btnMaxValuesText);
|
#endregion
|
|
}
|
|
/// <summary>
|
/// 加载cct属性设置控件
|
/// </summary>
|
/// <param name="attrView"></param>
|
void LoadCctAttrView(VerticalScrolViewLayout attrView)
|
{
|
#region 色温
|
var cctView = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(75 + 11)
|
};
|
attrView.AddChidren(cctView);
|
|
|
//色温
|
var btnTempClolor = new Button();
|
btnTempClolor.X = Application.GetRealWidth(35);
|
btnTempClolor.Y = Application.GetRealHeight(1);
|
btnTempClolor.Width = Application.GetRealWidth(224);
|
btnTempClolor.Height = Application.GetRealHeight(42);
|
btnTempClolor.TextAlignment = TextAlignment.CenterLeft;
|
btnTempClolor.TextColor = CSS_Color.FirstLevelTitleColor;
|
btnTempClolor.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
|
btnTempClolor.TextID = StringId.ColorTemperature;
|
cctView.AddChidren(btnTempClolor);
|
|
//2700K
|
var btnTempClolorMin = new Button()
|
{
|
X = Application.GetRealWidth(35),
|
Y = btnTempClolor.Bottom,
|
Width = Application.GetRealWidth(40),
|
Height = Application.GetRealHeight(21),
|
};
|
btnTempClolorMin.Width = Application.GetRealWidth(54);
|
btnTempClolorMin.Height = Application.GetRealHeight(21);
|
btnTempClolorMin.Text = "2700K";
|
btnTempClolorMin.TextAlignment = TextAlignment.CenterLeft;
|
btnTempClolorMin.TextColor = CSS_Color.PromptingColor1;
|
btnTempClolorMin.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
|
cctView.AddChidren(btnTempClolorMin);
|
|
//滑动条的背景图片
|
var btnColorTemplatrueBack = new Button()
|
{
|
X = Application.GetRealWidth(55 + 22 + 15),
|
Y = Application.GetRealHeight(11),
|
Width = Application.GetRealWidth(180),
|
Height = Application.GetRealHeight(54),
|
};
|
btnColorTemplatrueBack.UnSelectedImagePath = "FunctionIcon/Light/ColorTemperatureBar.png";
|
btnColorTemplatrueBack.Height = Application.GetRealHeight(8);
|
btnColorTemplatrueBack.Gravity = Gravity.CenterHorizontal;
|
cctView.AddChidren(btnColorTemplatrueBack);
|
//滑动条控件
|
var barColorTemplatrue = new CCTSeekBarControl()
|
{
|
X = Application.GetRealWidth(55 + 22),
|
Y = Application.GetRealHeight(11),
|
Width = Application.GetRealWidth(220),
|
Height = Application.GetRealHeight(54),
|
};
|
barColorTemplatrue.MinValue = 27;
|
barColorTemplatrue.MaxValue = 65;
|
barColorTemplatrue.ProgressBarColor = 0x00000000;//全部透明
|
barColorTemplatrue.ProgressBarUnEnableColor = 0x00000000;
|
barColorTemplatrue.SeekBarBackgroundColor = 0x00000000;
|
cctView.AddChidren(barColorTemplatrue);
|
barColorTemplatrue.Y = btnTempClolorMin.Y - (barColorTemplatrue.Height - btnTempClolorMin.Height) / 2;
|
//设置初始值
|
btnTempClolor.Text = Language.StringByID(StringId.ColorTemperature) + " " + (barColorTemplatrue.Progress * 100 + "K");
|
barColorTemplatrue.OnProgressChangedEvent = (sender, e) =>
|
{
|
btnTempClolor.Text = Language.StringByID(StringId.ColorTemperature) + " " + (barColorTemplatrue.Progress * 100 + "K");
|
};
|
barColorTemplatrue.OnStopTrackingTouchEvent = (sender, e) =>
|
{
|
var d = new Dictionary<string, string>();
|
d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString());
|
function.Control(d);
|
};
|
//变更背景图的Y轴坐标
|
btnColorTemplatrueBack.Y = barColorTemplatrue.Y + (barColorTemplatrue.Height - btnColorTemplatrueBack.Height) / 2;
|
|
//6500K
|
var btnTempClolorMax = new Button();
|
btnTempClolorMax.Y = btnTempClolorMin.Y;
|
btnTempClolorMax.X = barColorTemplatrue.Right - Application.GetRealWidth(30);
|
btnTempClolorMax.Width = Application.GetRealWidth(54);
|
btnTempClolorMax.Height = Application.GetRealHeight(21);
|
btnTempClolorMax.Text = "6500K";
|
btnTempClolorMax.TextAlignment = TextAlignment.CenterRight;
|
btnTempClolorMax.TextColor = CSS_Color.PromptingColor1;
|
btnTempClolorMax.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
|
cctView.AddChidren(btnTempClolorMax);
|
|
#endregion
|
}
|
|
/// <summary>
|
/// 加载rgb属性设置控件
|
/// </summary>
|
/// <param name="attrView"></param>
|
void LoadRgbAttrView(bool hadCCT,bool hadColorful)
|
{
|
Light lightTemp = new Light();
|
int magriHeight = 0;
|
if (hadCCT && hadColorful)
|
{
|
magriHeight = 80;
|
}
|
|
var btnCurColor = new Button()
|
{
|
X = Application.GetRealWidth(16),
|
Y = Application.GetRealHeight(74),
|
Width = Application.GetMinRealAverage(24),
|
Height = Application.GetMinRealAverage(24),
|
Radius = (uint)Application.GetMinRealAverage(8),
|
BorderColor = CSS_Color.PromptingColor2,
|
BorderWidth = 1,
|
BackgroundColor = (uint)(0xFF000000 + lightTemp.GetRGBcolor(function.GetAttrState(FunctionAttributeKey.RGB)))
|
};
|
controlView.AddChidren(btnCurColor);
|
|
|
//色盘的桌布控件(限制那个白色滑动球使用)
|
var framePickerBack = new FrameLayout();
|
framePickerBack.Gravity = Gravity.CenterHorizontal;
|
framePickerBack.Y = btnFromFoorAndRoom.Bottom + Application.GetRealHeight(1);
|
framePickerBack.Width = Application.GetMinRealAverage(216 - magriHeight);
|
framePickerBack.Height = Application.GetMinRealAverage(216 - magriHeight);
|
//framePickerBack.BackgroundColor = 0xFFFF0000;
|
controlView.AddChidren(framePickerBack);
|
|
var colorPicker = new ColorPicker()
|
{
|
Gravity = Gravity.Center,
|
ColorImagePath = "FunctionIcon/Light/ColorWheel.png",
|
};
|
framePickerBack.AddChidren(colorPicker);
|
//if (function.trait_on_off.curValue.ToString() == "off")
|
//{
|
// colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheelGray.png";
|
//}
|
//colorPicker.MouseDownEventHandler = (sender, e) => {
|
// MainPage.BasePageView.ScrollEnabled = false;
|
//};
|
//colorPicker.MouseUpEventHandler = (sender, e) => {
|
// MainPage.BasePageView.ScrollEnabled = true;
|
//};
|
|
//白点控件
|
var diameter = Application.GetRealWidth(12);
|
var btnWhiteRound = new Button()
|
{
|
Width = diameter,
|
Height = diameter,
|
Radius = (uint)Application.GetRealWidth(6),
|
BorderWidth = (uint)Application.GetRealWidth(1),
|
BorderColor = CSS_Color.MainBackgroundColor,
|
Enable = false,
|
};
|
btnWhiteRound.Visible = false;
|
framePickerBack.AddChidren(btnWhiteRound);
|
|
#region 亮度调节
|
var btnBrightnessText = new Button()
|
{
|
X = Application.GetRealWidth(35),
|
Y = Application.GetRealHeight(308 - magriHeight),
|
Width = Application.GetRealWidth(224),
|
Height = Application.GetRealHeight(21),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
TextID = StringId.Brightness,
|
};
|
controlView.AddChidren(btnBrightnessText);
|
|
var btnMinValuesText = new Button()
|
{
|
X = Application.GetRealWidth(35),
|
Y = btnBrightnessText.Bottom,
|
Width = Application.GetRealWidth(30),
|
Height = Application.GetRealHeight(21),
|
Text = "0%",
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.PromptingColor1,
|
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
};
|
controlView.AddChidren(btnMinValuesText);
|
|
var dimmerBar = new DiyImageSeekBar()
|
{
|
X = Application.GetRealWidth(35 + 22),
|
Y = Application.GetRealHeight(312 - magriHeight),
|
Width = Application.GetRealWidth(210),
|
Height = Application.GetRealHeight(54),
|
SeekBarViewHeight = Application.GetRealHeight(8),
|
ThumbImagePath = "Public/ThumbImage.png",
|
ThumbImageHeight = Application.GetRealHeight(54),
|
ProgressTextColor = CSS_Color.FirstLevelTitleColor,
|
ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
ProgressBarColor = CSS_Color.AuxiliaryColor1,
|
MaxValue = 100,
|
Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)),
|
SeekBarPadding = Application.GetRealWidth(20),
|
};
|
controlView.AddChidren(dimmerBar);
|
|
var btnMaxValuesText = new Button()
|
{
|
X = dimmerBar.Right,
|
Y = btnBrightnessText.Bottom,
|
Width = Application.GetRealWidth(45),
|
Height = Application.GetRealHeight(21),
|
Text = "100%",
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.PromptingColor1,
|
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
};
|
controlView.AddChidren(btnMaxValuesText);
|
#endregion
|
|
int heightMore = 375 - magriHeight-20;
|
|
if (hadCCT)
|
{
|
#region 色温
|
var cctView = new FrameLayout()
|
{
|
Y = Application.GetRealHeight(heightMore),
|
Height = Application.GetRealHeight(75 + 11)
|
};
|
controlView.AddChidren(cctView);
|
|
|
//色温
|
var btnTempClolor = new Button();
|
btnTempClolor.X = Application.GetRealWidth(35);
|
btnTempClolor.Y = Application.GetRealHeight(1);
|
btnTempClolor.Width = Application.GetRealWidth(224);
|
btnTempClolor.Height = Application.GetRealHeight(42);
|
btnTempClolor.TextAlignment = TextAlignment.CenterLeft;
|
btnTempClolor.TextColor = CSS_Color.FirstLevelTitleColor;
|
btnTempClolor.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
|
btnTempClolor.TextID = StringId.ColorTemperature;
|
cctView.AddChidren(btnTempClolor);
|
|
//2700K
|
var btnTempClolorMin = new Button()
|
{
|
X = Application.GetRealWidth(35),
|
Y = btnTempClolor.Bottom,
|
Width = Application.GetRealWidth(40),
|
Height = Application.GetRealHeight(21),
|
};
|
btnTempClolorMin.Width = Application.GetRealWidth(54);
|
btnTempClolorMin.Height = Application.GetRealHeight(21);
|
btnTempClolorMin.Text = "2700K";
|
btnTempClolorMin.TextAlignment = TextAlignment.CenterLeft;
|
btnTempClolorMin.TextColor = CSS_Color.PromptingColor1;
|
btnTempClolorMin.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
|
cctView.AddChidren(btnTempClolorMin);
|
|
//滑动条的背景图片
|
var btnColorTemplatrueBack = new Button()
|
{
|
X = Application.GetRealWidth(55 + 22 + 15+5),
|
Y = Application.GetRealHeight(11),
|
Width = Application.GetRealWidth(170),
|
Height = Application.GetRealHeight(54),
|
};
|
btnColorTemplatrueBack.UnSelectedImagePath = "FunctionIcon/Light/ColorTemperatureBar.png";
|
btnColorTemplatrueBack.Height = Application.GetRealHeight(8);
|
btnColorTemplatrueBack.Gravity = Gravity.CenterHorizontal;
|
cctView.AddChidren(btnColorTemplatrueBack);
|
//滑动条控件
|
var barColorTemplatrue = new CCTSeekBarControl()
|
{
|
X = Application.GetRealWidth(55 + 25),
|
Y = Application.GetRealHeight(11),
|
Width = Application.GetRealWidth(215),
|
Height = Application.GetRealHeight(52),
|
};
|
barColorTemplatrue.MinValue = 27;
|
barColorTemplatrue.MaxValue = 65;
|
barColorTemplatrue.ProgressBarColor = 0x00000000;//全部透明
|
barColorTemplatrue.ProgressBarUnEnableColor = 0x00000000;
|
barColorTemplatrue.SeekBarBackgroundColor = 0x00000000;
|
cctView.AddChidren(barColorTemplatrue);
|
barColorTemplatrue.Y = btnTempClolorMin.Y - (barColorTemplatrue.Height - btnTempClolorMin.Height) / 2;
|
//设置初始值
|
btnTempClolor.Text = Language.StringByID(StringId.ColorTemperature) + " " + (barColorTemplatrue.Progress * 100 + "K");
|
barColorTemplatrue.OnProgressChangedEvent = (sender, e) =>
|
{
|
btnTempClolor.Text = Language.StringByID(StringId.ColorTemperature) + " " + (barColorTemplatrue.Progress * 100 + "K");
|
};
|
barColorTemplatrue.OnStopTrackingTouchEvent = (sender, e) =>
|
{
|
var d = new Dictionary<string, string>();
|
d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString());
|
function.Control(d);
|
};
|
//变更背景图的Y轴坐标
|
btnColorTemplatrueBack.Y = barColorTemplatrue.Y + (barColorTemplatrue.Height - btnColorTemplatrueBack.Height) / 2;
|
|
//6500K
|
var btnTempClolorMax = new Button();
|
btnTempClolorMax.Y = btnTempClolorMin.Y;
|
btnTempClolorMax.X = barColorTemplatrue.Right - Application.GetRealWidth(30);
|
btnTempClolorMax.Width = Application.GetRealWidth(54);
|
btnTempClolorMax.Height = Application.GetRealHeight(21);
|
btnTempClolorMax.Text = "6500K";
|
btnTempClolorMax.TextAlignment = TextAlignment.CenterRight;
|
btnTempClolorMax.TextColor = CSS_Color.PromptingColor1;
|
btnTempClolorMax.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
|
cctView.AddChidren(btnTempClolorMax);
|
|
#endregion
|
|
|
heightMore = 70;
|
|
}
|
|
if (hadColorful)
|
{
|
#region 炫彩功能
|
|
var btnGradualChangeText = new Button()
|
{
|
X = Application.GetRealWidth(35),
|
Y = Application.GetRealHeight(375 + heightMore - magriHeight),
|
Width = Application.GetRealWidth(224),
|
Height = Application.GetRealHeight(21),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
TextID = StringId.ColorfulFunction,
|
};
|
controlView.AddChidren(btnGradualChangeText);
|
|
var btnGradualChangeMinValuesText = new Button()
|
{
|
X = Application.GetRealWidth(35),
|
Y = btnGradualChangeText.Bottom + Application.GetRealHeight(10),
|
Width = Application.GetRealWidth(22),
|
Height = Application.GetRealHeight(21),
|
UnSelectedImagePath = "Public/Edit.png",
|
};
|
controlView.AddChidren(btnGradualChangeMinValuesText);
|
btnGradualChangeMinValuesText.MouseUpEventHandler = (sender, e) => {
|
var rgbView = new ColorfulInfoPage(function);
|
MainPage.BasePageView.AddChidren(rgbView);
|
rgbView.LoadPage();
|
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
|
};
|
|
var barColorful = new FrameLayout()
|
{
|
X = btnGradualChangeMinValuesText.Right + Application.GetRealWidth(15+5),
|
Y = Application.GetRealHeight(412 + heightMore - magriHeight),
|
Width = Application.GetRealWidth(170),
|
Height = Application.GetRealHeight(8),
|
BackgroundImagePath = "FunctionIcon/Light/ColorfulBar.png",
|
};
|
controlView.AddChidren(barColorful);
|
|
var btnGradualChangeMaxValuesText = new Button()
|
{
|
X = barColorful.Right + Application.GetRealWidth(8),
|
Y = btnGradualChangeText.Bottom + Application.GetRealHeight(10),
|
Width = Application.GetRealWidth(38),
|
Height = Application.GetRealHeight(24),
|
UnSelectedImagePath = "Public/Switch.png"
|
};
|
controlView.AddChidren(btnGradualChangeMaxValuesText);
|
#endregion
|
|
|
}
|
|
|
|
}
|
|
|
/// <summary>
|
/// 检测点击点
|
/// </summary>
|
/// <param name="circleR">圆的半径</param>
|
/// <param name="circleX">圆心X轴</param>
|
/// <param name="circleY">圆心Y轴</param>
|
/// <param name="pointX">点击点的X轴</param>
|
/// <param name="pointY">点击点的Y轴</param>
|
/// <returns></returns>
|
private bool CheckPoint(int circleR, int circleX, int circleY, int pointX, int pointY)
|
{
|
int dwidth = circleX - pointX;
|
if (dwidth < 0) { dwidth *= -1; }
|
|
int dHeight = circleY - pointY;
|
if (dHeight < 0) { dHeight *= -1; }
|
|
//根据三角函数,求三角形的斜边长
|
int dlength = dwidth * dwidth + dHeight * dHeight;
|
//半径长度(不开方,所以是按平方算)
|
circleR *= circleR;
|
if (dlength < circleR)
|
{
|
//如果组成的三角形并没有长过半径,则代表还在圆内(不允许点边界)
|
return true;
|
}
|
return false;
|
}
|
|
}
|
}
|