From db45c85a6ddebc5018b32a9d9dc04f839db3fa76 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期二, 28 九月 2021 15:59:34 +0800
Subject: [PATCH] 组合调光
---
HDL_ON/Entity/Function/Scene.cs | 28
HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs | 9
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs | 9
HDL-ON_Android/Properties/AndroidManifest.xml | 2
HDL_ON/Entity/Function/Light.cs | 14
HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs | 468 +++++-----
HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs | 4
HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorWaterImmersionPage.cs | 4
DLL/Linphone/iOS/Shared.IOS.HDLLinphoneSDK.dll | 0
HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs | 2
HDL_ON/UI/UI2/2-Classification/SceneControlZone.cs | 131 +++
HDL_ON/HDL_ON.projitems | 1
HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorGasPage.cs | 34
HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs | 1042 ++++++++++++++++++-------
HDL_ON/Entity/Function/Function.cs | 19
HDL_ON/UI/UI2/2-Classification/FunctionPage.cs | 139 +++
HDL_ON/DAL/Server/HttpUtil.cs | 4
HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs | 4
HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs | 381 +++++++++
HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs | 2
.vs/HDL_APP_Project/xs/UserPrefs.xml | 57
HDL_ON/UI/MainPage.cs | 2
HDL_ON/UI/UI1-Login/LoginPage.cs | 4
HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorDoorWinwsPage.cs | 4
24 files changed, 1,745 insertions(+), 619 deletions(-)
diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml
index f9ba83b..198e45f 100644
--- a/.vs/HDL_APP_Project/xs/UserPrefs.xml
+++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,17 +1,18 @@
锘�<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default">
<MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.220222E9-B9CA-4834-9318-2BC22465F050" />
- <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs">
+ <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/DAL/DriverLayer/Control.cs">
<Files>
- <File FileName="HDL_ON/DAL/Server/HttpUtil.cs" Line="20" Column="57" />
+ <File FileName="HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs" Line="469" Column="1" />
<File FileName="HDL_ON/UI/MainPage.cs" Line="28" Column="55" />
- <File FileName="HDL-ON_iOS/Info.plist" />
- <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" Line="759" Column="32" />
- <File FileName="HDL_ON/Common/HDLCommon.cs" Line="395" Column="23" />
- <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePage.cs" Line="758" Column="1" />
- <File FileName="HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs" Line="643" Column="1" />
- <File FileName="HDL_ON/UI/UI0-Public/TopViewDiv.cs" Line="166" Column="46" />
- <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionPage.cs" Line="45" Column="53" />
- <File FileName="HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs" Line="32" Column="16" />
+ <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs" Line="133" Column="31" />
+ <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs" Line="991" Column="44" />
+ <File FileName="HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs" Line="1" Column="1" />
+ <File FileName="HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs" Line="106" Column="55" />
+ <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs" Line="388" Column="58" />
+ <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/NewSceneMenuListPage.cs" Line="177" Column="49" />
+ <File FileName="HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs" Line="230" Column="28" />
+ <File FileName="HDL_ON/DAL/Server/HttpUtil.cs" Line="21" Column="89" />
+ <File FileName="HDL_ON/DAL/DriverLayer/Control.cs" Line="943" Column="1" />
</Files>
<Pads>
<Pad Id="ProjectPad">
@@ -19,31 +20,27 @@
<Node name="HDL_APP_Project" expanded="True">
<Node name="HDL_ON" expanded="True">
<Node name="DAL" expanded="True">
+ <Node name="DriverLayer" expanded="True">
+ <Node name="Control.cs" selected="True" />
+ </Node>
<Node name="Server" expanded="True" />
</Node>
+ <Node name="Entity" expanded="True">
+ <Node name="Function" expanded="True" />
+ </Node>
<Node name="UI" expanded="True">
- <Node name="UI0-Public" expanded="True">
- <Node name="Widget" expanded="True" />
- </Node>
<Node name="UI2" expanded="True">
- <Node name="1-HomePage" expanded="True" />
- <Node name="2-Classification" expanded="True" />
- <Node name="4-PersonalCenter" expanded="True" />
<Node name="FuntionControlView" expanded="True">
- <Node name="Energy" expanded="True" />
- <Node name="EnvironmentalScience" expanded="True" />
- <Node name="Light" expanded="True">
- <Node name="LightScene" expanded="True">
- <Node name="AddLightScene.cs" selected="True" />
- </Node>
- </Node>
+ <Node name="Electrical" expanded="True" />
</Node>
</Node>
</Node>
</Node>
- <Node name="HDL-ON_iOS" expanded="True" />
</Node>
</State>
+ </Pad>
+ <Pad Id="MonoDevelop.Debugger.WatchPad">
+ <State />
</Pad>
</Pads>
</MonoDevelop.Ide.Workbench>
@@ -53,7 +50,7 @@
<String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String>
<String>Shared.IOS/Shared.IOS.csproj</String>
</DisabledProjects>
- <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" />
+ <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.364c4b3158493098" />
<MonoDevelop.Ide.DebuggingService.Breakpoints>
<BreakpointStore>
@@ -64,17 +61,15 @@
<Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs" line="168" column="1" />
<Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/FaceManagement/FacePassagePage.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/FaceManagement/FacePassagePage.cs" line="481" column="1" />
<Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/FaceManagement/FacePassagePage.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/FaceManagement/FacePassagePage.cs" line="541" column="1" />
- <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/Mqtt/MqttClient.cs" relfile="HDL_ON/DAL/Mqtt/MqttClient.cs" line="315" column="1" />
- <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/FunctionList.cs" relfile="HDL_ON/Entity/FunctionList.cs" line="475" column="1" />
- <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/FunctionList.cs" relfile="HDL_ON/Entity/FunctionList.cs" line="474" column="1" />
- <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs" relfile="HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs" line="153" column="1" />
- <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/Function/Scene.cs" relfile="HDL_ON/Entity/Function/Scene.cs" line="338" column="1" />
- <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs" line="244" column="1" />
+ <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/Function/Scene.cs" relfile="HDL_ON/Entity/Function/Scene.cs" line="343" column="1" />
<Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs" line="148" column="1" />
<Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs" line="865" column="1" />
<Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/Server/HttpServerRequest.cs" relfile="HDL_ON/DAL/Server/HttpServerRequest.cs" line="2689" column="1" />
<Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/Server/HttpServerRequest.cs" relfile="HDL_ON/DAL/Server/HttpServerRequest.cs" line="2685" column="1" />
<Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs" line="524" column="1" />
+ <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/Function/Scene.cs" relfile="HDL_ON/Entity/Function/Scene.cs" line="322" column="1" />
+ <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/DriverLayer/Control.cs" relfile="HDL_ON/DAL/DriverLayer/Control.cs" line="943" column="1" />
+ <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs" line="236" column="1" />
</BreakpointStore>
</MonoDevelop.Ide.DebuggingService.Breakpoints>
<MultiItemStartupConfigurations />
diff --git a/DLL/Linphone/iOS/Shared.IOS.HDLLinphoneSDK.dll b/DLL/Linphone/iOS/Shared.IOS.HDLLinphoneSDK.dll
index bde8df9..d97e4df 100644
--- a/DLL/Linphone/iOS/Shared.IOS.HDLLinphoneSDK.dll
+++ b/DLL/Linphone/iOS/Shared.IOS.HDLLinphoneSDK.dll
Binary files differ
diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml
index 13d80a0..a5e0fe8 100644
--- a/HDL-ON_Android/Properties/AndroidManifest.xml
+++ b/HDL-ON_Android/Properties/AndroidManifest.xml
@@ -1,5 +1,5 @@
锘�<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202109261" android:versionName="1.2.202109261" package="com.hdl.onpro">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202109281" android:versionName="1.2.202109281" package="com.hdl.onpro">
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="28" />
<!-- 涔愭鍙瀵硅闇�瑕佺殑鏉冮檺 -->
<!--<uses-permission android:name="android.permission.INTERNET" />-->
diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs
index cf4a06a..d2292ee 100644
--- a/HDL_ON/DAL/Server/HttpUtil.cs
+++ b/HDL_ON/DAL/Server/HttpUtil.cs
@@ -17,8 +17,8 @@
/// 鍥哄畾鍩熷悕,姝e紡鐜
/// 鍏叡鍩熷悕灏辫繎瑙f瀽
/// </summary>
- //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
- public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm
+ public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
+ //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm
/// <summary>
/// RegionMark
/// </summary>
diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs
index 4c47af2..e6e5e74 100644
--- a/HDL_ON/Entity/Function/Function.cs
+++ b/HDL_ON/Entity/Function/Function.cs
@@ -619,6 +619,8 @@
case FunctionAttributeKey.SetTemp:
case FunctionAttributeKey.FanSpeed:
case FunctionAttributeKey.Percent:
+ case FunctionAttributeKey.CCT:
+ case FunctionAttributeKey.RGB:
//case FunctionAttributeKey.FadeTime:
if (attr.curValue.ToString() == "{}")
{
@@ -657,12 +659,13 @@
{
vv = 26;
}
- sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = Convert.ToInt32(vv).ToString() });
+ sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = Convert.ToInt32(vv).ToString(), max = attr.max, min = attr.min });
}
else
{
- sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = attr.curValue.ToString() });
+ sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = attr.curValue.ToString(), max = attr.max, min = attr.min });
}
+
break;
}
}
@@ -924,6 +927,18 @@
/// </summary>
public const string Status = "status";
/// <summary>
+ /// 鐘舵��(鏈夋棤浜�)
+ /// </summary>
+ public const string PeopleStatus = "people_status";
+ /// <summary>
+ /// 鐘舵��(鎶ヨ)
+ /// </summary>
+ public const string AlarmStatus = "alarm_status";
+ /// <summary>
+ /// 鐘舵��(闂悎銆佹墦寮�)
+ /// </summary>
+ public const string ContactStatus = "contact_status";
+ /// <summary>
/// 姣背娉紶鎰熷櫒锛屽姩浣滅姸鎬�
/// </summary>
public const string ActionStatus = "action_state";
diff --git a/HDL_ON/Entity/Function/Light.cs b/HDL_ON/Entity/Function/Light.cs
index 44ee714..021d510 100644
--- a/HDL_ON/Entity/Function/Light.cs
+++ b/HDL_ON/Entity/Function/Light.cs
@@ -11,16 +11,16 @@
/// 鑾峰彇rgb棰滆壊
/// </summary>
/// <returns></returns>
- public int GetRGBcolor(Function function ,string rgbString ="")
+ public int GetRGBcolor(string rgbString)
{
- var color = function.GetAttrState(FunctionAttributeKey.RGB).Split(",");
- if(!string.IsNullOrEmpty(rgbString))
- {
- color = rgbString.Split(",");
- }
+ //var color = function.GetAttrState(FunctionAttributeKey.RGB).Split(",");
+ //if(!string.IsNullOrEmpty(rgbString))
+ //{
+ var color = rgbString.Split(",");
+ //}
if(color.Length!= 3)
{
- color = new string[] {"100", "100", "100" };
+ color = new string[] {"255", "255", "255" };
}
int redColor = 0;
int greenColor = 0;
diff --git a/HDL_ON/Entity/Function/Scene.cs b/HDL_ON/Entity/Function/Scene.cs
index b9d9039..48481ec 100644
--- a/HDL_ON/Entity/Function/Scene.cs
+++ b/HDL_ON/Entity/Function/Scene.cs
@@ -317,6 +317,11 @@
var revPack = pm.EditScene(this);
if (revPack.Code == StateCode.SUCCESS)
{
+ if(MainPage.NoLoginMode)
+ {
+ var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this));
+ Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd);
+ }
var scenes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(revPack.Data.ToString());
var tempScene = scenes.Find((obj) => obj.sid == sid);
if (tempScene != null)
@@ -412,6 +417,7 @@
/// </summary>
public string delay = "0";
+
Function _localFunction;
/// <summary>
/// 鏈湴瀵瑰簲鐨勫姛鑳�
@@ -433,7 +439,7 @@
/// 杞崲鎴愬姛鑳藉璞�
/// </summary>
/// <returns></returns>
- Function ConvertFunctionObject()
+ private Function ConvertFunctionObject()
{
var localFunction = FunctionList.List.GetDeviceFunctionList().Find((obj) => obj.sid == sid);
return localFunction;
@@ -478,12 +484,22 @@
var briState = status.Find((obj) => obj.key == FunctionAttributeKey.Brightness);
if (briState != null)
{
- sceneFunctionInfo += briState.value + "%";
+ sceneFunctionInfo += briState.value + "%" + " ";
}
var perState = status.Find((obj) => obj.key == FunctionAttributeKey.Percent);
if (perState != null)
{
- sceneFunctionInfo += perState.value + "%";
+ sceneFunctionInfo += perState.value + "%" + " ";
+ }
+ var cctState = status.Find((obj) => obj.key == FunctionAttributeKey.CCT);
+ if(cctState != null)
+ {
+ sceneFunctionInfo += cctState.value + "%" + " ";
+ }
+ var rgbState = status.Find((obj) => obj.key == FunctionAttributeKey.RGB);
+ if(rgbState!=null)
+ {
+ //sceneFunctionInfo += new cctState.value + "%" + " ";
}
return sceneFunctionInfo;
}
@@ -498,6 +514,9 @@
{
public string key = "";
public string value = "";
+
+ public int max = 0;
+ public int min = 0;
/// <summary>
/// 灞炴�у悕绉版樉绀烘枃鏈�
@@ -567,6 +586,9 @@
case FunctionAttributeKey.Brightness:
us = "%";
break;
+ case FunctionAttributeKey.CCT:
+ us = "K";
+ break;
}
return us;
}
diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems
index ded84f8..4830611 100644
--- a/HDL_ON/HDL_ON.projitems
+++ b/HDL_ON/HDL_ON.projitems
@@ -485,6 +485,7 @@
<Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\Security.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DAL\ThirdPartySdk\HDLLinphone.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\EnvironmentalScience\A_EnvironmentalDataCenter.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\2-Classification\SceneControlZone.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" />
diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs
index 2d25815..94c758d 100644
--- a/HDL_ON/UI/MainPage.cs
+++ b/HDL_ON/UI/MainPage.cs
@@ -25,7 +25,7 @@
/// <summary>
/// 鐗堟湰鍙�
/// </summary>
- public static string VersionString = "1.2.0926";
+ public static string VersionString = "1.2.0928";
///// <summary>
///// 瀹㈡埛绔被鍨�
///// </summary>
diff --git a/HDL_ON/UI/UI1-Login/LoginPage.cs b/HDL_ON/UI/UI1-Login/LoginPage.cs
index e6c5f40..a04a9ae 100644
--- a/HDL_ON/UI/UI1-Login/LoginPage.cs
+++ b/HDL_ON/UI/UI1-Login/LoginPage.cs
@@ -230,8 +230,8 @@
//etAccount.Text = "15971583093";//楂樿儨
//etAccount.Text = "15217626103";//鏄嗘槑閲戣寕椤圭洰
//etAccount.Text = "18598273624";
- etAccount.Text = "tf@smarttech.com.ua";
- etAccount.Text = "18814122445";//钁f辰鏂� 澶╂渤鍔炲叕瀹�
+ //etAccount.Text = "tf@smarttech.com.ua";
+ //etAccount.Text = "18814122445";//钁f辰鏂� 澶╂渤鍔炲叕瀹�
//etAccount.Text = "18824864143";//"464027401@qq.com"; //"2791308028@qq.com";//13697499568
}
b = !b;
diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
index 74fe7e8..9430eb5 100644
--- a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
+++ b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
@@ -42,7 +42,19 @@
{
Action action = () =>
{
- var skipView = new AddLightScene(new List<Function>(), new Scene() { sceneType = SceneType.LightScene });
+
+ Action<Scene > refreshAction = (outScene) => {
+ if (outScene != null)
+ {
+ functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) });
+
+ var sceneRow = new SceneControlZone(outScene);
+ functionListView.AddChidren(sceneRow);
+ sceneRow.LoadView();
+ }
+ };
+
+ var skipView = new AddLightScene(new List<Function>(), new Scene() { sceneType = SceneType.LightScene }, refreshAction);
MainPage.BasePageView.AddChidren(skipView);
skipView.LoadPage();
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
@@ -97,6 +109,17 @@
if (titleId == StringId.Lights)
{
functionList.AddRange(FunctionList.List.GetLightList());
+ var lightScene = FunctionList.List.scenes.FindAll((obj) => obj.sceneType == SceneType.LightScene);
+
+ foreach (var scene in lightScene)
+ {
+ functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) });
+
+ var sceneRow = new SceneControlZone(scene);
+ functionListView.AddChidren(sceneRow);
+ sceneRow.LoadView();
+ }
+
}
else if (titleId == StringId.AC)
{
@@ -182,6 +205,120 @@
}
+ ///// <summary>
+ ///// 鍔犺浇鍔熻兘绫诲瀷鎺у埗鍗$墖
+ ///// </summary>
+ //public void LoadSceneRow(Scene scene)
+ //{
+ // var bodyDiv = new FrameLayout()
+ // {
+ // Gravity = Gravity.CenterHorizontal,
+ // Width = Application.GetRealWidth(343),
+ // Height = Application.GetRealHeight(116),
+ // Radius = (uint)Application.GetMinRealAverage(12),
+ // BorderColor = 0x00FFFFFF,
+ // BorderWidth = 1,
+ // BackgroundColor = CSS_Color.MainBackgroundColor,
+ // Tag = "Scene-" + scene.sid
+ // };
+ // functionListView.AddChidren(bodyDiv);
+
+ // var btnIcon = new Button()
+ // {
+ // X = Application.GetRealWidth(10),
+ // Y = Application.GetRealHeight(15),
+ // Width = Application.GetRealWidth(32),
+ // Height = Application.GetRealWidth(32),
+ // };
+ // bodyDiv.AddChidren(btnIcon);
+
+ // var btnName = new Button()
+ // {
+ // X = Application.GetRealWidth(8 + 10 + 32),
+ // Y = Application.GetRealHeight(10),
+ // Width = Application.GetRealWidth(200),
+ // Height = Application.GetRealHeight(24),
+ // Text = scene.name,
+ // TextAlignment = TextAlignment.CenterLeft,
+ // TextColor = CSS_Color.FirstLevelTitleColor,
+ // TextSize = CSS_FontSize.TextFontSize,
+ // };
+ // bodyDiv.AddChidren(btnName);
+
+ // var btnFromFloor = new Button()
+ // {
+ // X = Application.GetRealWidth(8 + 10 + 32),
+ // Y = Application.GetRealHeight(10 + 24),
+ // Width = Application.GetRealWidth(200),
+ // Height = Application.GetRealHeight(18),
+ // Text = scene.GetRoomListName(),
+ // TextAlignment = TextAlignment.CenterLeft,
+ // TextColor = CSS_Color.PromptingColor1,
+ // TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+ // };
+ // bodyDiv.AddChidren(btnFromFloor);
+
+ // var btnCollectionIcon = new Button()
+ // {
+ // X = Application.GetRealWidth(299),
+ // Y = Application.GetRealHeight(10),
+ // Width = Application.GetMinRealAverage(40),
+ // Height = Application.GetMinRealAverage(40),
+ // SelectedImagePath = "Collection/CollectionIcon.png",
+ // UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
+ // IsSelected = scene.collect
+ // };
+ // bodyDiv.AddChidren(btnCollectionIcon);
+
+ // btnIcon.UnSelectedImagePath = "FunctionIcon/Scene/SceneIcon.png";
+ // if (scene.sceneType == SceneType.MovieScene)
+ // {
+ // var movieIcon = new Button()
+ // {
+ // X = Application.GetRealWidth(52),
+ // Y = Application.GetRealHeight(14),
+ // Width = Application.GetRealWidth(16),
+ // Height = Application.GetRealWidth(16),
+ // UnSelectedImagePath = "FunctionIcon/Scene/MovieMark.png",
+ // };
+ // bodyDiv.AddChidren(movieIcon);
+ // btnName.X = Application.GetRealWidth(52 + 16);
+ // }
+ // //鍔犺浇鍦烘櫙鎺у埗浜嬩欢
+ // LoadEvent_ControlScene(btnName, btnFromFloor, bodyDiv, scene);
+
+ // LoadEvent_FunctionCollection(btnCollectionIcon, scene);
+ //}
+
+
+ ///// <summary>
+ ///// 鍔犺浇鍔熻兘鏀惰棌鎸夐挳浜嬩欢
+ ///// </summary>
+ //void LoadEvent_FunctionCollection(Button btnCollectionIcon, Scene scene)
+ //{
+ // btnCollectionIcon.MouseUpEventHandler += (sender, e) =>
+ // {
+ // btnCollectionIcon.IsSelected = scene.collect = !btnCollectionIcon.IsSelected;
+ // scene.CollectScene();
+ // };
+ //}
+ ///// <summary>
+ ///// 鍔犺浇鍦烘櫙鎺у埗浜嬩欢
+ ///// </summary>
+ //void LoadEvent_ControlScene(Button btnName, Button btnFromFloor, FrameLayout bodyDiv, Scene scene)
+ //{
+ // EventHandler<MouseEventArgs> upEvent = (sender, e) => {
+ // DriverLayer.Control.Ins.ControlScene(scene);
+ // string msg = scene.name + Language.StringByID(StringId.AlreadyOpened);
+ // new PublicAssmebly().TipMsgAutoClose(msg, false);
+ // };
+ // btnName.MouseUpEventHandler = upEvent;
+ // btnFromFloor.MouseUpEventHandler = upEvent;
+ // bodyDiv.MouseUpEventHandler = upEvent;
+ //}
+
+
+
/// <summary>
/// 浣忓畢鍒楄〃鐐瑰嚮浜嬩欢
/// </summary>
diff --git a/HDL_ON/UI/UI2/2-Classification/SceneControlZone.cs b/HDL_ON/UI/UI2/2-Classification/SceneControlZone.cs
new file mode 100644
index 0000000..5b6e62f
--- /dev/null
+++ b/HDL_ON/UI/UI2/2-Classification/SceneControlZone.cs
@@ -0,0 +1,131 @@
+锘縰sing System;
+using HDL_ON.Entity;
+using HDL_ON.UI.CSS;
+using Shared;
+
+namespace HDL_ON.UI
+{
+ public class SceneControlZone :FrameLayout
+ {
+ Scene scene;
+ Button btnIcon;
+ Button btnName;
+ Button btnFromFloor;
+ Button btnCollectionIcon;
+
+ public SceneControlZone(Scene inParScene)
+ {
+ scene = inParScene;
+ Gravity = Gravity.CenterHorizontal;
+ Width = Application.GetRealWidth(343);
+ Height = Application.GetRealHeight(65);
+ Radius = (uint)Application.GetMinRealAverage(12);
+ BorderColor = 0x00FFFFFF;
+ BorderWidth = 1;
+ BackgroundColor = CSS_Color.MainBackgroundColor;
+ Tag = "Scene-" + scene.sid;
+ }
+
+
+ /// <summary>
+ /// 鍔犺浇鍔熻兘绫诲瀷鎺у埗鍗$墖
+ /// </summary>
+ public void LoadView()
+ {
+ btnIcon = new Button()
+ {
+ X = Application.GetRealWidth(10),
+ Y = Application.GetRealHeight(15),
+ Width = Application.GetRealWidth(32),
+ Height = Application.GetRealWidth(32),
+ };
+ this.AddChidren(btnIcon);
+
+ btnName = new Button()
+ {
+ X = Application.GetRealWidth(8 + 10 + 32),
+ Y = Application.GetRealHeight(10),
+ Width = Application.GetRealWidth(200),
+ Height = Application.GetRealHeight(24),
+ Text = scene.name,
+ TextAlignment = TextAlignment.CenterLeft,
+ TextColor = CSS_Color.FirstLevelTitleColor,
+ TextSize = CSS_FontSize.TextFontSize,
+ };
+ this.AddChidren(btnName);
+
+ btnFromFloor = new Button()
+ {
+ X = Application.GetRealWidth(8 + 10 + 32),
+ Y = Application.GetRealHeight(10 + 24),
+ Width = Application.GetRealWidth(200),
+ Height = Application.GetRealHeight(18),
+ Text = scene.GetRoomListName(),
+ TextAlignment = TextAlignment.CenterLeft,
+ TextColor = CSS_Color.PromptingColor1,
+ TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+ };
+ this.AddChidren(btnFromFloor);
+
+ btnCollectionIcon = new Button()
+ {
+ X = Application.GetRealWidth(299),
+ Y = Application.GetRealHeight(10),
+ Width = Application.GetMinRealAverage(40),
+ Height = Application.GetMinRealAverage(40),
+ SelectedImagePath = "Collection/CollectionIcon.png",
+ UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
+ IsSelected = scene.collect
+ };
+ this.AddChidren(btnCollectionIcon);
+
+ btnIcon.UnSelectedImagePath = "FunctionIcon/Scene/SceneIcon.png";
+ if (scene.sceneType == SceneType.MovieScene)
+ {
+ Button movieIcon = new Button()
+ {
+ X = Application.GetRealWidth(52),
+ Y = Application.GetRealHeight(14),
+ Width = Application.GetRealWidth(16),
+ Height = Application.GetRealWidth(16),
+ UnSelectedImagePath = "FunctionIcon/Scene/MovieMark.png",
+ };
+ this.AddChidren(movieIcon);
+ btnName.X = Application.GetRealWidth(52 + 16);
+ }
+ //鍔犺浇鍦烘櫙鎺у埗浜嬩欢
+ LoadEvent_ControlScene(btnName, btnFromFloor, scene);
+
+ LoadEvent_FunctionCollection(btnCollectionIcon, scene);
+ }
+
+
+ /// <summary>
+ /// 鍔犺浇鍔熻兘鏀惰棌鎸夐挳浜嬩欢
+ /// </summary>
+ void LoadEvent_FunctionCollection(Button btnCollectionIcon, Scene scene)
+ {
+ btnCollectionIcon.MouseUpEventHandler += (sender, e) =>
+ {
+ btnCollectionIcon.IsSelected = scene.collect = !btnCollectionIcon.IsSelected;
+ scene.CollectScene();
+ };
+ }
+ /// <summary>
+ /// 鍔犺浇鍦烘櫙鎺у埗浜嬩欢
+ /// </summary>
+ void LoadEvent_ControlScene(Button btnName, Button btnFromFloor, Scene scene)
+ {
+ EventHandler<MouseEventArgs> upEvent = (sender, e) => {
+ DriverLayer.Control.Ins.ControlScene(scene);
+ string msg = scene.name + Language.StringByID(StringId.AlreadyOpened);
+ new PublicAssmebly().TipMsgAutoClose(msg, false);
+ };
+ btnName.MouseUpEventHandler = upEvent;
+ btnFromFloor.MouseUpEventHandler = upEvent;
+ this.MouseUpEventHandler = upEvent;
+ }
+
+
+ }
+}
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs
index 05c2a9c..5f4966d 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs
@@ -138,6 +138,15 @@
{
continue;
}
+ //濡傛灉鍦烘櫙鏄伅鍏夊満鏅紝鍙兘鍔犺浇鐏厜鍔熻兘
+ if (scene.sceneType == SceneType.LightScene)
+ {
+ if (!SPK.LightSpkList().Contains(function.spk))
+ {
+ continue;
+ }
+ }
+
function.roomIds.Remove(null);
if (scene.functions.Find((obj) => obj.sid == function.sid) != null)
{
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
index 9c69d90..4973f51 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
@@ -64,6 +64,12 @@
case FunctionAttributeKey.FadeTime:
LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.FadeTime));
break;
+ case FunctionAttributeKey.CCT:
+ LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.CCT));
+ break;
+ case FunctionAttributeKey.RGB:
+ LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.RGB));
+ break;
}
}
@@ -270,6 +276,16 @@
Text = sceneStatus.GetValueText(showCode) + sceneStatus.GetUintString()
};
row.AddChidren(btnFunctionText);
+ if (sceneStatus.key == FunctionAttributeKey.RGB)
+ {
+ btnFunctionText.Width = Application.GetRealWidth(28);
+ btnFunctionText.Height = Application.GetRealWidth(28);
+ btnFunctionText.X = Application.GetRealWidth(330 - 28);
+ btnFunctionText.Gravity = Gravity.CenterVertical;
+ btnFunctionText.Radius = (uint)Application.GetRealWidth(8);
+ btnFunctionText.Text = "";
+ btnFunctionText.BackgroundColor = (uint)(0xFF000000 + new Light().GetRGBcolor(sceneStatus.value));
+ }
@@ -330,6 +346,17 @@
break;
case "cct":
+ LoadEditDialog_CCT(sceneStatus, btnFunctionText);
+ break;
+ case FunctionAttributeKey.RGB:
+ btnFunctionText.Width = Application.GetRealWidth(28);
+ btnFunctionText.Height = Application.GetRealWidth(28);
+ btnFunctionText.X = Application.GetRealWidth(330 - 28);
+ btnFunctionText.Gravity = Gravity.CenterVertical;
+ btnFunctionText.Radius = (uint)Application.GetRealWidth(8);
+ btnFunctionText.Text = "";
+
+ LoadEditDialog_RGB(sceneStatus, btnFunctionText);
break;
case FunctionAttributeKey.Percent:
LoadEditDialog_Percent(sceneStatus, btnFunctionText);
@@ -541,7 +568,7 @@
/// <param name="btn"></param>
void LoadEditDialog_Temp(SceneFunctionStatus trait, Button btn)
{
- double temp = 16;
+ double temp = trait.min;
double.TryParse(trait.value, out temp);
trait.value = temp.ToString();
@@ -610,7 +637,7 @@
Height = Application.GetRealHeight(210),
Radius = (uint)Application.GetRealWidth(12),
};
- for (int i = 16; i <= 32; i += 1)
+ for (int i = trait.min; i <= trait.max; i += 1)
{
pickerItems.Add(i.ToString() + trait.GetUintString());
}
@@ -801,6 +828,356 @@
};
}
+ /// <summary>
+ /// 鍔犺浇cct閫夋嫨寮圭獥
+ /// </summary>
+ /// <param name="function"></param>
+ /// <param name="btn"></param>
+ void LoadEditDialog_CCT(SceneFunctionStatus trait, Button btn)
+ {
+ double temp = trait.min;
+ double.TryParse(trait.value, out temp);
+ trait.value = temp.ToString();
+
+ List<string> pickerItems = new List<string>();
+ if (trait == null)
+ {
+ return;
+ }
+
+ Dialog dialog = new Dialog();
+
+ var pView = new FrameLayout()
+ {
+ BackgroundColor = CSS_Color.DialogTransparentColor1,
+ };
+ dialog.AddChidren(pView);
+
+ var optionBaseView = new FrameLayout()
+ {
+ Y = Application.GetRealHeight(456 - 60),
+ Gravity = Gravity.CenterHorizontal,
+ Width = Application.GetRealWidth(343),
+ Height = Application.GetRealHeight(260),
+ AnimateSpeed = 0.3f,
+ Animate = Animate.DownToUp,
+ BackgroundColor = CSS_Color.MainBackgroundColor,
+ Radius = (uint)Application.GetRealWidth(12),
+ };
+ pView.AddChidren(optionBaseView);
+
+ var topView = new FrameLayout()
+ {
+ Gravity = Gravity.CenterHorizontal,
+ Width = Application.GetRealWidth(343),
+ Height = Application.GetRealHeight(40),
+ BackgroundColor = CSS_Color.MainBackgroundColor,
+ Radius = (uint)Application.GetRealWidth(12),
+ };
+ optionBaseView.AddChidren(topView);
+ topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor });
+
+ var btnCancel = new Button()
+ {
+ X = Application.GetRealWidth(21),
+ Width = Application.GetRealWidth(100),
+ TextAlignment = TextAlignment.CenterLeft,
+ TextColor = CSS_Color.PromptingColor1,
+ TextSize = CSS_FontSize.TextFontSize,
+ TextID = StringId.Cancel,
+ };
+ topView.AddChidren(btnCancel);
+
+ var btnConfrim = new Button()
+ {
+ Width = Application.GetRealWidth(320),
+ TextAlignment = TextAlignment.CenterRight,
+ TextColor = CSS_Color.MainColor,
+ TextSize = CSS_FontSize.TextFontSize,
+ TextID = StringId.Confirm,
+ };
+ topView.AddChidren(btnConfrim);
+
+ UIPickerView uIPickerView = new UIPickerView()
+ {
+ Y = Application.GetRealHeight(40),
+ Height = Application.GetRealHeight(210),
+ Radius = (uint)Application.GetRealWidth(12),
+ };
+ for (int i = trait.min; i <= trait.max; i += 100)
+ {
+ pickerItems.Add(i.ToString() + trait.GetUintString());
+ }
+ uIPickerView.setNPicker(pickerItems, null, null);
+ optionBaseView.AddChidren(uIPickerView);
+ uIPickerView.setCurrentItems(pickerItems.IndexOf(trait.value.ToString()), 4, 5);
+
+ string selectItem = pickerItems[0];
+ if (pickerItems.Contains(trait.value + trait.GetUintString()))
+ {
+ selectItem = trait.value.ToString() + trait.GetUintString();
+ }
+
+ dialog.Show();
+
+ pView.MouseUpEventHandler = (sender, e) => {
+ dialog.Close();
+ };
+
+ btnCancel.MouseUpEventHandler = (sender, e) => {
+ dialog.Close();
+ };
+ uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => {
+ selectItem = pickerItems[int1];
+ };
+ btnConfrim.MouseUpEventHandler = (sender, e) => {
+ dialog.Close();
+ btn.Text = selectItem;
+ //sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.value.ToString() ;
+ trait.value = selectItem.Replace(trait.GetUintString(), "");
+ };
+
+ }
+
+
+ /// <summary>
+ /// 鍔犺浇rgb閫夋嫨寮圭獥
+ /// </summary>
+ /// <param name="function"></param>
+ /// <param name="btn"></param>
+ void LoadEditDialog_RGB(SceneFunctionStatus trait, Button btn)
+ {
+ string rgbString = trait.value;
+
+ Light tempLight = new Light();
+
+ if (trait == null)
+ {
+ return;
+ }
+
+ Dialog dialog = new Dialog();
+
+ var bodyView = new FrameLayout();
+ dialog.AddChidren(bodyView);
+
+ var contentView = new FrameLayout()
+ {
+ Gravity = Gravity.Center,
+ BackgroundColor = CSS_Color.MainBackgroundColor,
+ Width = Application.GetRealWidth(343),
+ Height = Application.GetRealHeight(52 + 44 + 18 + 22 + 248),
+ Radius = (uint)Application.GetRealWidth(12),
+ };
+ bodyView.AddChidren(contentView);
+
+ #region 鏍囬鍖�
+ var titleView = new FrameLayout()
+ {
+ Width = Application.GetRealWidth(343),
+ Height = Application.GetRealHeight(52),
+ };
+ contentView.AddChidren(titleView);
+
+ var btnTitle = new Button()
+ {
+ Height = Application.GetRealHeight(52),
+ Gravity = Gravity.Center,
+ TextSize = CSS_FontSize.SubheadingFontSize,
+ TextColor = CSS_Color.MainColor,
+ TextID = StringId.ColorValue,
+ TextAlignment = TextAlignment.Center,
+ };
+ titleView.AddChidren(btnTitle);
+ titleView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor, Y = Application.GetRealHeight(51) });
+
+ #endregion
+
+ int attrViewHight = Application.GetRealHeight(18 + 22+ 248);
+ //灞炴�ц缃尯鍩�
+ var attrView = new FrameLayout()
+ {
+ Y = Application.GetRealHeight(52),
+ Width = Application.GetRealWidth(343),
+ Height = attrViewHight
+ };
+ contentView.AddChidren(attrView);
+ attrView.AddChidren(new Button() { Height = Application.GetRealHeight(18) });
+
+
+
+ #region RGB
+ var rgbView = new FrameLayout()
+ {
+ Height = Application.GetRealHeight(248)
+ };
+ attrView.AddChidren(rgbView);
+
+
+ var btnCurColor = new Button()
+ {
+ X = Application.GetRealWidth(24),
+ Y = Application.GetRealHeight(10),
+ Width = Application.GetMinRealAverage(24),
+ Height = Application.GetMinRealAverage(24),
+ Radius = (uint)Application.GetMinRealAverage(8),
+ BorderColor = CSS_Color.PromptingColor2,
+ BorderWidth = 1,
+ BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(trait.value))
+ };
+ rgbView.AddChidren(btnCurColor);
+
+ //鑹茬洏鐨勬甯冩帶浠�(闄愬埗閭d釜鐧借壊婊戝姩鐞冧娇鐢�)
+ var framePickerBack = new FrameLayout();
+ framePickerBack.Gravity = Gravity.CenterHorizontal;
+ framePickerBack.Y = Application.GetRealHeight(20);
+ framePickerBack.Width = Application.GetMinRealAverage(198);
+ framePickerBack.Height = Application.GetMinRealAverage(198);
+ rgbView.AddChidren(framePickerBack);
+
+ var colorPicker = new ColorPicker()
+ {
+ ColorImagePath = "FunctionIcon/Light/ColorWheel.png",
+ };
+ framePickerBack.AddChidren(colorPicker);
+
+
+
+
+
+
+ //鐧界偣鎺т欢
+ var btnWhiteRound = new Button();
+ btnWhiteRound.Width = Application.GetRealWidth(24);
+ btnWhiteRound.Height = Application.GetRealWidth(24);
+ btnWhiteRound.UnSelectedImagePath = "FunctionIcon/Light/ColorWheelTip.png";
+ btnWhiteRound.Visible = false;
+ framePickerBack.AddChidren(btnWhiteRound);
+
+
+ //褰撳墠鐐瑰嚮鐨勩�愮偣銆戞槸鍚︽纭�
+ bool pointIsRight = false;
+ //鍦嗙殑鍗婂緞(鑰冭檻杈圭晫,闇�瑕佽缃畠鐨勫崐寰勬瘮杈冨皬涓�鐐�)
+ int circleR = colorPicker.Width / 2 - Application.GetRealWidth(12);
+
+
+ colorPicker.ColorChaged += (sender2, e2) => {
+ rgbString = (e2[0] + "," + e2[1] + "," + e2[2]).ToString();
+ //trait.value = rgbString;
+ btnCurColor.BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(rgbString));
+ };
+ colorPicker.MouseDownEventHandler += (sender, e) =>
+ {
+ pointIsRight = this.CheckPoint(circleR, colorPicker.Width / 2, colorPicker.Height / 2, (int)e.X, (int)e.Y);
+ if (pointIsRight == false)
+ {
+ //鐐圭殑鍖哄煙涓嶆槸鍦嗙洏鍐�
+ return;
+ }
+ //鏄剧ず鐧界偣
+ btnWhiteRound.X = (int)e.X - btnWhiteRound.Width / 2;
+ btnWhiteRound.Y = (int)e.Y - btnWhiteRound.Height / 2;
+ if (btnWhiteRound.Visible == false)
+ {
+ btnWhiteRound.Visible = true;
+ }
+ };
+
+ colorPicker.MouseMoveEventHandler += (sender, e) =>
+ {
+ //褰撻紶鏍囩偣涓嬩簨浠跺鐞�
+ colorPicker.MouseDownEventHandler(sender, e);
+ };
+
+
+ #endregion
+
+
+
+
+ #region bottom View
+ var bottomView = new FrameLayout()
+ {
+ Y = Application.GetRealHeight(52) + attrViewHight,
+ Height = Application.GetRealHeight(46),
+ };
+ contentView.AddChidren(bottomView);
+ bottomView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor });
+
+ var btnCancel = new Button()
+ {
+ Width = Application.GetRealWidth(172),
+ Height = Application.GetRealHeight(44),
+ TextAlignment = TextAlignment.Center,
+ TextSize = CSS_FontSize.SubheadingFontSize,
+ TextColor = CSS_Color.TextualColor,
+ TextID = StringId.Cancel,
+ };
+ bottomView.AddChidren(btnCancel);
+ btnCancel.MouseUpEventHandler = (sender, e) => {
+ dialog.Close();
+ };
+
+ var btnComplete = new Button()
+ {
+ X = Application.GetRealWidth(172),
+ Width = Application.GetRealWidth(172),
+ Height = Application.GetRealHeight(46),
+ BackgroundColor = CSS_Color.MainColor,
+ TextColor = CSS_Color.MainBackgroundColor,
+ TextAlignment = TextAlignment.Center,
+ TextSize = CSS_FontSize.SubheadingFontSize,
+ TextID = StringId.Complete
+ };
+ bottomView.AddChidren(btnComplete);
+
+ //渚嬶細鍙充笅鍦嗚 澶у皬涓�50
+ int mRectCornerID = HDLUtils.RectCornerBottomRight;
+ btnComplete.SetCornerWithSameRadius((uint)Application.GetRealWidth(14), mRectCornerID);
+ btnComplete.MouseUpEventHandler = (sender, e) => {
+ dialog.Close();
+ trait.value = rgbString;
+ btn.BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(rgbString));
+ };
+
+ #endregion
+
+
+ dialog.Show();
+
+ }
+
+
+ /// <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;
+ }
+
+
/// <summary>
/// 鍔犺浇鍙樺寲閫熷害閫夋嫨寮圭獥
diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorDoorWinwsPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorDoorWinwsPage.cs
index 57a3ff5..b44e9a5 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorDoorWinwsPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorDoorWinwsPage.cs
@@ -119,6 +119,10 @@
{
Application.RunOnMainThread(() => {
var temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.Status);
+ if (temp == null)
+ {
+ temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.ContactStatus);
+ }
if (temp != null)
{
if (temp.state == "open")
diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorGasPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorGasPage.cs
index 109084a..9057d0f 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorGasPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorGasPage.cs
@@ -118,22 +118,26 @@
/// </summary>
private void RefreshFormStatu()
{
- Application.RunOnMainThread(() => {
- foreach(var temp in device.attributes) {
- if (temp != null)
+ Application.RunOnMainThread(() =>
+ {
+ var temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.Status);
+ if (temp == null)
+ {
+ temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.AlarmStatus);
+ }
+ if (temp != null)
+ {
+ if (temp.state == "alarm")
{
- if (temp.state == "alarm")
- {
- btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/ArmSensorSmokeStateBgIconOn.png";
- btnSuctionView.TextID = StringId.InAlarm;
- btnSuctionView.IsSelected = true;
- }
- else if (temp.state == "normal")
- {
- btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/UnderProtectionBgIcon.png";
- btnSuctionView.TextID = StringId.SensorNormalState;
- btnSuctionView.IsSelected = false;
- }
+ btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/ArmSensorSmokeStateBgIconOn.png";
+ btnSuctionView.TextID = StringId.InAlarm;
+ btnSuctionView.IsSelected = true;
+ }
+ else if (temp.state == "normal")
+ {
+ btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/UnderProtectionBgIcon.png";
+ btnSuctionView.TextID = StringId.SensorNormalState;
+ btnSuctionView.IsSelected = false;
}
}
});
diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs
index 36879be..891b2cf 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs
@@ -114,6 +114,10 @@
{
Application.RunOnMainThread(()=>{
var temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.Status);
+ if(temp== null)
+ {
+ temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.PeopleStatus);
+ }
if (temp != null)
{
if (temp.state == "true")
diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorWaterImmersionPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorWaterImmersionPage.cs
index 074c6ad..a4e92e1 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorWaterImmersionPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorWaterImmersionPage.cs
@@ -117,6 +117,10 @@
{
Application.RunOnMainThread(() => {
var temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.Status);
+ if (temp == null)
+ {
+ temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.AlarmStatus);
+ }
if (temp != null)
{
if (temp.state == "alarm")
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs
index 0afbced..ba2b6df 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs
@@ -238,10 +238,11 @@
if (updataTemp.spk == bodyView.function.spk && updataTemp.sid == bodyView.function.sid)
{
bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = updataTemp.trait_on_off.curValue.ToString() == "on";
- }
- if(updataTemp.GetAttribute("run_status")!=null)
- {
- bodyView.UpdataRunStatus();
+
+ if (updataTemp.GetAttribute("run_status") != null)
+ {
+ bodyView.UpdataRunStatus();
+ }
}
}
catch (Exception ex)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs
index c35417a..ac2dad9 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs
@@ -109,7 +109,7 @@
return;
}
- var temp = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.SetTemp));
+ var temp = (int)Convert.ToDouble(function.GetAttrState(FunctionAttributeKey.SetTemp));
if (temp <= Convert.ToInt32(function.GetAttribute(FunctionAttributeKey.SetTemp).min))
{
return;
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs
index bee290a..5e0b71e 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs
@@ -162,7 +162,7 @@
btnBrightnessText = new Button()
{
Gravity = Gravity.CenterHorizontal,
- Y = ((100 - Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness))) * Application.GetRealHeight(222 - 16) / 100) + Application.GetRealWidth(80),
+ Y = ((100 - Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness))) * Application.GetRealHeight(222 - 16) / 100) + Application.GetRealWidth(80),
Width = Application.GetRealWidth(56),
Height = Application.GetRealWidth(46),
UnSelectedImagePath = "FunctionIcon/Light/BrightnessBg.png",
@@ -176,7 +176,7 @@
//鑹叉俯
var btnTempClolor = new Button();
btnTempClolor.X = Application.GetRealWidth(35);
- btnTempClolor.Y = Application.GetRealHeight(306 +60);
+ btnTempClolor.Y = Application.GetRealHeight(306 + 60);
btnTempClolor.Width = Application.GetRealWidth(224);
btnTempClolor.Height = Application.GetRealHeight(21);
btnTempClolor.TextAlignment = TextAlignment.CenterLeft;
@@ -542,236 +542,236 @@
/// <summary>
/// 宸﹀彸婊戝姩鐨勮繘搴︽潯鎺т欢
/// </summary>
- public class CCTSeekBarControl : DiyImageSeekBar
- {
- #region 鈻� 鍙橀噺澹版槑___________________________
-
- /// <summary>
- /// 杩涘害鍊兼敼鍙�,濡傛灉瑕佽缃垵濮嬭繘搴﹀��,姝ゅ彉閲忚鍦ㄨ缃垵濮嬭繘搴﹀�间箣鍓嶈繘琛岃缃�(绗竴涓弬鏁�0:婊戝姩鐨勬椂鍊�,1:鎵嬫寚寮硅捣鐨勬椂鍊�)
- /// </summary>
- public Action<int, int> ProgressChangedEvent = null;
- /// <summary>
- /// 杩涘害鏉″彲鐢ㄦ椂鐨勮儗鏅壊
- /// </summary>
- private uint ProgressBarEnableColor = 0;
- /// <summary>
- /// 杩涘害鏉′笉鍙敤鏃剁殑鑳屾櫙鑹�(榛樿鐏拌壊)
- /// </summary>
- public uint ProgressBarUnEnableColor = 0xffe8e8e8;
- /// <summary>
- /// 褰撳墠鍙敤鐘舵��
- /// </summary>
- private bool nowEnable = true;
- /// <summary>
- /// 鎺т欢鑳藉惁浣跨敤
- /// </summary>
- public new bool Enable
- {
- set
- {
- //鐘舵�佹病鏈夋敼鍙�
- if (nowEnable == value) { return; }
- nowEnable = value;
-
- this.IsClickable = value;
- if (value == true)
- {
- //鍘熸潵鐨勯鑹�
- base.ProgressBarColor = ProgressBarEnableColor;
- }
- else
- {
- //鐏拌壊
- base.ProgressBarColor = ProgressBarUnEnableColor;
- }
- }
- }
-
- /// <summary>
- /// 杩涘害鏉¢鑹�
- /// </summary>
- public new uint ProgressBarColor
- {
- set
- {
- ProgressBarEnableColor = value;
- base.ProgressBarColor = value;
- }
- }
-
- private int m_SeekBarPadding = Application.GetRealWidth(20);
- /// <summary>
- /// 杩涘害鏉′笌宸﹀彸涓よ竟鐨勮竟妗嗙殑杈硅窛(閲嶅啓搴曞眰灞炴��)
- /// </summary>
- public new int SeekBarPadding
- {
- set
- {
- m_SeekBarPadding = value;
- base.SeekBarPadding = value;
- }
- }
-
- private int m_MaxValue = 0;
- /// <summary>
- /// 杩涘害鏉℃渶澶у��(閲嶅啓搴曞眰灞炴��)
- /// </summary>
- public new int MaxValue
- {
- set
- {
- m_MaxValue = value;
- base.MaxValue = value;
- }
- }
-
- private int m_MinValue = 0;
- /// <summary>
- /// 杩涘害鏉℃渶灏忓��(閲嶅啓搴曞眰灞炴��)
- /// </summary>
- public new int MinValue
- {
- set
- {
- m_MinValue = value;
- base.MinValue = value;
- }
- }
- /// <summary>
- /// 涓婃柟鏄剧ず鐨勬枃鏈�
- /// </summary>
- private Button btnTopView = null;
-
- #endregion
-
- #region 鈻� 鍒濆鍖朹____________________________
-
- /// <summary>
- /// 宸﹀彸婊戝姩鐨勮繘搴︽潯鎺т欢
- /// </summary>
- /// <param name="i_width">瀹藉害,闈炵湡瀹炲��</param>
- public CCTSeekBarControl(int i_width = 210)
- {
- this.Width = Application.GetRealWidth(i_width);
- this.Height = Application.GetRealHeight(54);
- //鍦嗙悆鐨勫搴�
- this.ThumbImageHeight = Application.GetRealHeight(54);
- this.ThumbImagePath = "Public/ThumbImage.png";
- //杩涘害鏉$殑瀹藉害
- this.SeekBarViewHeight = Application.GetRealHeight(8);
- //涓婃柟鏄惁鏄剧ず鏂囨湰
- this.IsProgressTextShow = false;
- this.Gravity = Gravity.CenterHorizontal;
- //杩涘害鏉¢鑹�
- this.ProgressBarColor = CSS_Color.MainColor;
- //宸﹀彸杈硅窛
- this.SeekBarPadding = Application.GetRealWidth(20);
-
- //杩涘害鏉″�兼敼鍙樹簨浠�
- this.OnProgressChangedEvent += this.MyProgressChangedEvent;
- //鎵嬫寚寮硅捣浜嬩欢
- this.OnStopTrackingTouchEvent += this.MyStopTrackingTouchEvent;
- }
-
- #endregion
-
- #region 鈻� 浜嬩欢_______________________________
-
- /// <summary>
- /// 杩涘害鏉″�兼敼鍙樹簨浠�
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="value"></param>
- private void MyProgressChangedEvent(object sender, int value)
- {
- if (this.ProgressChangedEvent == null)
- {
- this.OnProgressChangedEvent -= this.MyProgressChangedEvent;
- return;
- }
-
- this.ProgressChangedEvent(0, value);
- }
-
- /// <summary>
- /// 鎵嬫寚寮硅捣浜嬩欢
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="value"></param>
- private void MyStopTrackingTouchEvent(object sender, int value)
- {
- if (this.ProgressChangedEvent == null)
- {
- this.OnStopTrackingTouchEvent -= this.MyStopTrackingTouchEvent;
- return;
- }
- //寮硅捣浜嬩欢涓嶉渶瑕佸垽鏂椂闂�
- this.ProgressChangedEvent(1, value);
- }
-
- #endregion
-
- #region 鈻� 鑷畾涔変笂鏂规樉绀烘枃鏈琠________________
-
- /// <summary>
- /// 鍦ㄤ笂鏂规樉绀鸿嚜瀹氫箟鏂囨湰
- /// </summary>
- /// <param name="i_width">瀹藉害(鐪熷疄鍊�)</param>
- /// <param name="textSize">鏂囧瓧澶у皬</param>
- /// <param name="textColor">鏂囧瓧棰滆壊</param>
- public void ShowCustomTextView(int i_width, int textSize, uint textColor)
- {
- if (this.btnTopView != null) { return; }
-
- int contrHeight = Application.GetRealHeight(24);
- this.btnTopView = new Button();
- btnTopView.Width = i_width;
- btnTopView.Height = contrHeight;
- btnTopView.TextColor = textColor;
- btnTopView.TextSize = textSize;
- btnTopView.TextAlignment = TextAlignment.Center;
- btnTopView.Y = this.Y - contrHeight + Application.GetRealHeight(20);
- //鍒濆鍖栨椂,X杞村彲浠ヤ笉鐢ㄧ悊浼�
-
- this.Parent.AddChidren(btnTopView);
- }
-
- /// <summary>
- /// 璁剧疆鑷畾涔夋枃鏈俊鎭�
- /// </summary>
- /// <param name="i_text"></param>
- public void SetCustomText(string i_text)
- {
- if (this.btnTopView == null) { return; }
-
- this.btnTopView.Text = i_text;
- //婊戞潯鏈�宸﹁竟鐨勮窛绂�
- int XX = this.X + this.m_SeekBarPadding;
- //褰撳墠婊戞潯鎵�鍦ㄧ殑澶ц嚧鐧惧垎姣�
- int tempValue = this.Progress - this.m_MinValue;
- if (tempValue < 0) { tempValue = 0; }
- decimal persent = (decimal)tempValue / (this.m_MaxValue - this.m_MinValue);
- //褰撳墠婊戞潯鎵�鍦ㄧ殑澶ц嚧浣嶇疆
- XX += (int)((this.Width - this.m_SeekBarPadding * 2) * persent);
- //鍥犱负瑕佸眳涓�,鎵�浠ュ噺鎺夎嚜瀹氫箟鎺т欢鐨勫搴︾殑涓�鑸�
- XX = XX - this.btnTopView.Width / 2;
-
- this.btnTopView.X = XX;
- }
-
- #endregion
-
- #region 鈻� 涓�鑸柟娉昣__________________________
-
- /// <summary>
- /// 鎺т欢鎽ф瘉
- /// </summary>
- public override void RemoveFromParent()
- {
- this.ProgressChangedEvent = null;
- base.RemoveFromParent();
- }
-
- #endregion
+ public class CCTSeekBarControl : DiyImageSeekBar
+ {
+ #region 鈻� 鍙橀噺澹版槑___________________________
+
+ /// <summary>
+ /// 杩涘害鍊兼敼鍙�,濡傛灉瑕佽缃垵濮嬭繘搴﹀��,姝ゅ彉閲忚鍦ㄨ缃垵濮嬭繘搴﹀�间箣鍓嶈繘琛岃缃�(绗竴涓弬鏁�0:婊戝姩鐨勬椂鍊�,1:鎵嬫寚寮硅捣鐨勬椂鍊�)
+ /// </summary>
+ public Action<int, int> ProgressChangedEvent = null;
+ /// <summary>
+ /// 杩涘害鏉″彲鐢ㄦ椂鐨勮儗鏅壊
+ /// </summary>
+ private uint ProgressBarEnableColor = 0;
+ /// <summary>
+ /// 杩涘害鏉′笉鍙敤鏃剁殑鑳屾櫙鑹�(榛樿鐏拌壊)
+ /// </summary>
+ public uint ProgressBarUnEnableColor = 0xffe8e8e8;
+ /// <summary>
+ /// 褰撳墠鍙敤鐘舵��
+ /// </summary>
+ private bool nowEnable = true;
+ /// <summary>
+ /// 鎺т欢鑳藉惁浣跨敤
+ /// </summary>
+ public new bool Enable
+ {
+ set
+ {
+ //鐘舵�佹病鏈夋敼鍙�
+ if (nowEnable == value) { return; }
+ nowEnable = value;
+
+ this.IsClickable = value;
+ if (value == true)
+ {
+ //鍘熸潵鐨勯鑹�
+ base.ProgressBarColor = ProgressBarEnableColor;
+ }
+ else
+ {
+ //鐏拌壊
+ base.ProgressBarColor = ProgressBarUnEnableColor;
+ }
+ }
+ }
+
+ /// <summary>
+ /// 杩涘害鏉¢鑹�
+ /// </summary>
+ public new uint ProgressBarColor
+ {
+ set
+ {
+ ProgressBarEnableColor = value;
+ base.ProgressBarColor = value;
+ }
+ }
+
+ private int m_SeekBarPadding = Application.GetRealWidth(20);
+ /// <summary>
+ /// 杩涘害鏉′笌宸﹀彸涓よ竟鐨勮竟妗嗙殑杈硅窛(閲嶅啓搴曞眰灞炴��)
+ /// </summary>
+ public new int SeekBarPadding
+ {
+ set
+ {
+ m_SeekBarPadding = value;
+ base.SeekBarPadding = value;
+ }
+ }
+
+ private int m_MaxValue = 0;
+ /// <summary>
+ /// 杩涘害鏉℃渶澶у��(閲嶅啓搴曞眰灞炴��)
+ /// </summary>
+ public new int MaxValue
+ {
+ set
+ {
+ m_MaxValue = value;
+ base.MaxValue = value;
+ }
+ }
+
+ private int m_MinValue = 0;
+ /// <summary>
+ /// 杩涘害鏉℃渶灏忓��(閲嶅啓搴曞眰灞炴��)
+ /// </summary>
+ public new int MinValue
+ {
+ set
+ {
+ m_MinValue = value;
+ base.MinValue = value;
+ }
+ }
+ /// <summary>
+ /// 涓婃柟鏄剧ず鐨勬枃鏈�
+ /// </summary>
+ private Button btnTopView = null;
+
+ #endregion
+
+ #region 鈻� 鍒濆鍖朹____________________________
+
+ /// <summary>
+ /// 宸﹀彸婊戝姩鐨勮繘搴︽潯鎺т欢
+ /// </summary>
+ /// <param name="i_width">瀹藉害,闈炵湡瀹炲��</param>
+ public CCTSeekBarControl(int i_width = 210)
+ {
+ ProgressChangeDelayTime = 30;
+ this.Width = Application.GetRealWidth(i_width);
+ this.Height = Application.GetRealHeight(54);
+ //鍦嗙悆鐨勫搴�
+ this.ThumbImageHeight = Application.GetRealHeight(54);
+ this.ThumbImagePath = "Public/ThumbImage.png";
+ //杩涘害鏉$殑瀹藉害
+ this.SeekBarViewHeight = Application.GetRealHeight(8);
+ //涓婃柟鏄惁鏄剧ず鏂囨湰
+ this.IsProgressTextShow = false;
+ this.Gravity = Gravity.CenterHorizontal;
+ //杩涘害鏉¢鑹�
+ this.ProgressBarColor = CSS_Color.MainColor;
+ //宸﹀彸杈硅窛
+ this.SeekBarPadding = Application.GetRealWidth(20);
+
+ //杩涘害鏉″�兼敼鍙樹簨浠�
+ this.OnProgressChangedEvent += this.MyProgressChangedEvent;
+ //鎵嬫寚寮硅捣浜嬩欢
+ this.OnStopTrackingTouchEvent += this.MyStopTrackingTouchEvent;
+ }
+
+ #endregion
+
+ #region 鈻� 浜嬩欢_______________________________
+
+ /// <summary>
+ /// 杩涘害鏉″�兼敼鍙樹簨浠�
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="value"></param>
+ private void MyProgressChangedEvent(object sender, int value)
+ {
+ if (this.ProgressChangedEvent == null)
+ {
+ this.OnProgressChangedEvent -= this.MyProgressChangedEvent;
+ return;
+ }
+ this.ProgressChangedEvent(0, value);
+ }
+
+ /// <summary>
+ /// 鎵嬫寚寮硅捣浜嬩欢
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="value"></param>
+ private void MyStopTrackingTouchEvent(object sender, int value)
+ {
+ if (this.ProgressChangedEvent == null)
+ {
+ this.OnStopTrackingTouchEvent -= this.MyStopTrackingTouchEvent;
+ return;
+ }
+ //寮硅捣浜嬩欢涓嶉渶瑕佸垽鏂椂闂�
+ this.ProgressChangedEvent(1, value);
+ }
+
+ #endregion
+
+ #region 鈻� 鑷畾涔変笂鏂规樉绀烘枃鏈琠________________
+
+ /// <summary>
+ /// 鍦ㄤ笂鏂规樉绀鸿嚜瀹氫箟鏂囨湰
+ /// </summary>
+ /// <param name="i_width">瀹藉害(鐪熷疄鍊�)</param>
+ /// <param name="textSize">鏂囧瓧澶у皬</param>
+ /// <param name="textColor">鏂囧瓧棰滆壊</param>
+ public void ShowCustomTextView(int i_width, int textSize, uint textColor)
+ {
+ if (this.btnTopView != null) { return; }
+
+ int contrHeight = Application.GetRealHeight(24);
+ this.btnTopView = new Button();
+ btnTopView.Width = i_width;
+ btnTopView.Height = contrHeight;
+ btnTopView.TextColor = textColor;
+ btnTopView.TextSize = textSize;
+ btnTopView.TextAlignment = TextAlignment.Center;
+ btnTopView.Y = this.Y - contrHeight + Application.GetRealHeight(20);
+ //鍒濆鍖栨椂,X杞村彲浠ヤ笉鐢ㄧ悊浼�
+
+ this.Parent.AddChidren(btnTopView);
+ }
+
+ /// <summary>
+ /// 璁剧疆鑷畾涔夋枃鏈俊鎭�
+ /// </summary>
+ /// <param name="i_text"></param>
+ public void SetCustomText(string i_text)
+ {
+ if (this.btnTopView == null) { return; }
+
+ this.btnTopView.Text = i_text;
+ //婊戞潯鏈�宸﹁竟鐨勮窛绂�
+ int XX = this.X + this.m_SeekBarPadding;
+ //褰撳墠婊戞潯鎵�鍦ㄧ殑澶ц嚧鐧惧垎姣�
+ int tempValue = this.Progress - this.m_MinValue;
+ if (tempValue < 0) { tempValue = 0; }
+ decimal persent = (decimal)tempValue / (this.m_MaxValue - this.m_MinValue);
+ //褰撳墠婊戞潯鎵�鍦ㄧ殑澶ц嚧浣嶇疆
+ XX += (int)((this.Width - this.m_SeekBarPadding * 2) * persent);
+ //鍥犱负瑕佸眳涓�,鎵�浠ュ噺鎺夎嚜瀹氫箟鎺т欢鐨勫搴︾殑涓�鑸�
+ XX = XX - this.btnTopView.Width / 2;
+
+ this.btnTopView.X = XX;
}
-}
+
+ #endregion
+
+ #region 鈻� 涓�鑸柟娉昣__________________________
+
+ /// <summary>
+ /// 鎺т欢鎽ф瘉
+ /// </summary>
+ public override void RemoveFromParent()
+ {
+ this.ProgressChangedEvent = null;
+ base.RemoveFromParent();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs
index a14cbfe..4e22ef5 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs
@@ -1,5 +1,8 @@
锘縰sing System;
using System.Collections.Generic;
+using System.Threading;
+using HDL_ON.DAL.Server;
+using HDL_ON.DriverLayer;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
@@ -25,21 +28,43 @@
/// 鍔熻兘鍒楄〃闆嗗悎鏄剧ず鍖哄煙
/// </summary>
static VerticalScrolViewLayout functionListView;
- #endregion
+ /// <summary>
+ /// 瀹屾垚鎸夐挳
+ /// </summary>
+ Button btnConfrim;
+ #endregion
+ /// <summary>
+ /// 鍦烘櫙閲岄潰鐨勫姛鑳藉垪琛�
+ /// </summary>
List<Function> sceneLishtList;
- Scene lightScene;
- public AddLightScene(List<Function> functions,Scene scene)
+ /// <summary>
+ /// 鏈湴鐨勭伅鍏夊垪琛�
+ /// </summary>
+ List<Function> lightList;
+ /// <summary>
+ /// 鍦烘櫙瀵硅薄
+ /// </summary>
+ Scene scene;
+ /// <summary>
+ /// 鍥炶皟鍒锋柊
+ /// </summary>
+ Action<Scene> backActon;
+
+ public AddLightScene(List<Function> functions,Scene inParscene, Action<Scene> action)
{
bodyView = this;
sceneLishtList = functions;
- lightScene = scene;
+ scene = inParscene;
+ backActon = action;
+ lightList = FunctionList.List.GetLightList();
}
public void LoadPage()
{
bodyView.BackgroundColor = CSS_Color.BackgroundColor;
new TopViewDiv(bodyView, Language.StringByID(StringId.CombinedDimming)).LoadTopView();
+ scene.name = Language.StringByID(StringId.CombinedDimming);
/// <summary>
/// 鎴块棿鍐呭鏄剧ず鍖哄煙
@@ -78,13 +103,68 @@
functionListView = new VerticalScrolViewLayout()
{
Y = Application.GetRealHeight(64 + 52),
- Height = Application.GetRealHeight(603 - 12 - 52),
+ Height = Application.GetRealHeight(640 - 12 - 52 -100),
};
bodyView.AddChidren(functionListView);
- var lightList = FunctionList.List.GetLightList();
- foreach (var function in lightList)
+ LoadLightRow(lightList);
+
+ #region 搴曢儴view
+ var bottomView = new FrameLayout()
+ {
+ Y = Application.GetRealHeight(591),
+ Height = Application.GetRealHeight(100),
+ BackgroundColor = CSS_Color.MainBackgroundColor,
+ Radius = (uint)Application.GetRealWidth(12),
+ };
+ this.AddChidren(bottomView);
+
+ btnConfrim = new Button()
+ {
+ Y = Application.GetRealHeight(12),
+ Gravity = Gravity.CenterHorizontal,
+ Width = Application.GetRealWidth(220),
+ Height = Application.GetRealHeight(44),
+ Radius = (uint)Application.GetRealHeight(22),
+ TextAlignment = TextAlignment.Center,
+ TextColor = CSS_Color.MainBackgroundColor,
+ BackgroundColor = CSS_Color.BackgroundColor,
+ TextID = StringId.Confirm,
+ TextSize = CSS_FontSize.SubheadingFontSize,
+ SelectedTextColor = CSS_Color.MainBackgroundColor,
+ SelectedBackgroundColor = CSS_Color.MainColor,
+ };
+ bottomView.AddChidren(btnConfrim);
+ btnConfrim.MouseUpEventHandler = (sender, e) => {
+ if (btnConfrim.IsSelected)
+ {
+ Action<Scene> action = (objScene) =>
+ {
+ backActon(objScene);
+ this.RemoveFromParent();
+ };
+
+ var lightSceneDialog = new LightSceneEditDialog(sceneLishtList, scene, action);
+ lightSceneDialog.ShowDialog();
+ }
+ };
+
+ #endregion
+
+ //鍔犺浇鍔熻兘绛涢�夌粍浠�
+ LoadDialog_ChangeFloor();
+ }
+
+ /// <summary>
+ /// 鍔犺浇鍔熻兘row
+ /// </summary>
+ /// <param name="lightList"></param>
+ void LoadLightRow(List<Function> functions)
+ {
+ functionListView.RemoveAll();
+
+ foreach (var function in functions)
{
var functionDiv = new LightRow(function)
{
@@ -97,42 +177,45 @@
BackgroundColor = CSS_Color.MainBackgroundColor,
Tag = function.spk + function.sid
};
- functionDiv.LoadDiv(sceneLishtList);
+
+ Action setAction = () =>
+ {
+ if (sceneLishtList.Count > 0)
+ {
+ btnConfrim.IsSelected = true;
+ }
+ else
+ {
+ btnConfrim.IsSelected = false;
+ }
+ };
+
+ functionDiv.LoadDiv(sceneLishtList,setAction);
functionListView.AddChidren(functionDiv);
functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) });
}
+ }
- #region 搴曢儴view
- var bottomView = new FrameLayout()
+
+ /// <summary>
+ /// 浣忓畢鍒楄〃鐐瑰嚮浜嬩欢
+ /// </summary>
+ void LoadDialog_ChangeFloor()
+ {
+ string nowSelectId = null;
+ btnFloor.MouseUpEventHandler += (sender, e) =>
{
- Y = Application.GetRealHeight(591),
- Height = Application.GetRealHeight(100),
- BackgroundColor = CSS_Color.MainBackgroundColor,
- Radius = (uint)Application.GetRealWidth(12),
+ //鏄剧ず涓嬫媺鍒楄〃
+ var form = new FloorRoomSelectPopupView();
+ form.ShowDeviceFunctionView(btnFloor, this.lightList, (selectId, listFunc) =>
+ {
+ nowSelectId = selectId;
+ //閲嶆柊鍔犺浇鐣岄潰
+ LoadLightRow(listFunc);
+ }, nowSelectId);
};
- this.AddChidren(bottomView);
-
- var btnConfrim = new Button()
- {
- Y = Application.GetRealHeight(12),
- Gravity = Gravity.CenterHorizontal,
- Width = Application.GetRealWidth(220),
- Height = Application.GetRealHeight(44),
- Radius = (uint)Application.GetRealHeight(22),
- TextAlignment = TextAlignment.Center,
- TextColor = CSS_Color.MainBackgroundColor,
- BackgroundColor = CSS_Color.MainColor,
- TextID = StringId.Confirm,
- };
- bottomView.AddChidren(btnConfrim);
- btnConfrim.MouseUpEventHandler = (sender, e) => {
- var lightSceneDialog = new LightSceneEditDialog(sceneLishtList,lightScene);
- lightSceneDialog.ShowDialog();
- };
-
- #endregion
}
}
@@ -174,7 +257,7 @@
/// <summary>
/// 鍔犺浇鎺у埗鍗$墖鍖哄煙
/// </summary>
- public void LoadDiv(List<Function> functions)
+ public void LoadDiv(List<Function> functions,Action action)
{
btnIcon = new Button()
{
@@ -242,6 +325,11 @@
functions.Remove(removeTemp);
}
}
+ ///鍒锋柊鐣岄潰
+ if (functions.Count == 0 || functions.Count == 1)
+ {
+ action();
+ }
};
}
@@ -254,19 +342,33 @@
/// </summary>
public class LightSceneEditDialog :Dialog
{
+ /// <summary>
+ /// 浼犲叆鐨勭伅鍏夊垪琛�
+ /// 鍔犲叆鍦烘櫙鎺у埗鍔熻兘鍒楄〃
+ /// </summary>
List<Function> lights;
+ /// <summary>
+ /// 涓存椂鐏厜瀵硅薄
+ /// 澶勭悊鐏厜鏂规硶
+ /// </summary>
+ Light tempLight = new Light();
+ //鍙戦�佹暟鎹敹闆�
+ Dictionary<string, string> commandDic = new Dictionary<string, string>();
- Scene editScene;
-
- public LightSceneEditDialog(List<Function> functions,Scene scene)
+ Scene scene;
+ Action<Scene> backAction;
+ public LightSceneEditDialog(List<Function> functions,Scene inParScene,Action<Scene> action)
{
lights = functions;
- editScene = scene;
+ scene = inParScene;
+ backAction = action;
}
public void ShowDialog()
{
+ commandDic.Add(FunctionAttributeKey.OnOff, "off");
+
var hadDimming = lights.Find((obj) => obj.spk == SPK.LightDimming) != null;
var hadCCT = lights.Find((obj) => obj.spk == SPK.LightCCT) != null;
var hadRGB = lights.Find((obj) => obj.spk == SPK.LightRGB) != null;
@@ -285,7 +387,6 @@
bodyView.AddChidren(contentView);
#region 鏍囬鍖�
- bool inEdit = false;//鏄惁鍦ㄧ紪杈戞爣棰�
var titleView = new FrameLayout()
{
Width = Application.GetRealWidth(343),
@@ -321,48 +422,74 @@
X = Application.GetRealWidth(12) + btnTitle.Right,
Gravity = Gravity.CenterVertical,
UnSelectedImagePath = "Public/Edit.png",
- SelectedImagePath = "Public/HookIcon.png"
+ //SelectedImagePath = "Public/HookIcon.png"
};
titleView.AddChidren(btnEditIcon);
- EventHandler<MouseEventArgs> dd = (sender, e) =>
- {
- inEdit = !inEdit;
- btnEditIcon.IsSelected = inEdit;
-
- if (inEdit)
+ Action<string> callBack = (str) =>
{
- btnTitle.Width = btnTitle.GetTextWidth();
- }
- else
- {
- if (btnTitle.GetTextWidth() > Application.GetRealWidth(197))//247
+ //鍚嶇О涓嶈兘涓虹┖
+ if (string.IsNullOrEmpty(str))
{
+ new Tip()
+ {
+ CloseTime = 1,
+ Text = Language.StringByID(StringId.NameCannotBeEmpty),
+ Direction = AMPopTipDirection.None,
+ }.Show(bodyView);
+ return;
+ }
+ btnTitle.Text = str;
+ scene.name = str;
+
+
+ if (btnTitle.GetTextWidth() > Application.GetRealWidth(197))//247
+ {
btnTitle.Width = Application.GetRealWidth(197);
}
else
{
btnTitle.Width = btnTitle.GetTextWidth();
}
- editScene.name = btnTitle.Text.Trim();
+
+ };
+ EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
+ {
+ List<string> sceneNameList = new List<string>();
+ foreach (var tempScene in FunctionList.List.scenes)
+ {
+ sceneNameList.Add(tempScene.name);
}
+ new PublicAssmebly().LoadDialog_EditParater(StringId.SceneName, scene.name, callBack, StringId.SceneNameCannotBeEmpty, StringId.SceneNameAlreadyExists, sceneNameList);
};
- btnTitle.MouseUpEventHandler = dd;
- btnEditIcon.MouseUpEventHandler = dd;
+ btnTitle.MouseUpEventHandler = eventHandler;
+ btnEditIcon.MouseUpEventHandler = eventHandler;
titleView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor, Y = Application.GetRealHeight(51) });
#endregion
- var dimmingLight = editScene.functions.Find((obj) => obj.localFunction.spk == SPK.LightDimming);
- var cctLight = editScene.functions.Find((obj) => obj.localFunction.spk == SPK.LightCCT);
- var rgbLight = editScene.functions.Find((obj) => obj.localFunction.spk == SPK.LightRGB);
+ //var dimmingLight = lights.Find((obj) => obj.spk == SPK.LightDimming);
+ //var cctLight = lights.Find((obj) => obj.spk == SPK.LightCCT);
+ //var rgbLight = lights.Find((obj) => obj.spk == SPK.LightRGB);
+ var dimmingLight = scene.functions.Find((obj) => obj.localFunction.spk == SPK.LightDimming);
+ var cctLight = scene.functions.Find((obj) => obj.localFunction.spk == SPK.LightCCT);
+ var rgbLight = scene.functions.Find((obj) => obj.localFunction.spk == SPK.LightRGB);
+
var brightnessValue = 0;
var cctValue = 27;
+ if(rgbLight!= null)
+ {
+ int.TryParse(rgbLight.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness).value, out brightnessValue);
+ }
if (cctLight != null)
{
int.TryParse(cctLight.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness).value, out brightnessValue);
+ int.TryParse(cctLight.status.Find((obj) => obj.key == FunctionAttributeKey.CCT).value, out cctValue);
+ }
+ if(dimmingLight!=null)
+ {
int.TryParse(cctLight.status.Find((obj) => obj.key == FunctionAttributeKey.CCT).value, out cctValue);
}
@@ -372,83 +499,113 @@
{
Y = Application.GetRealHeight(52),
Width = Application.GetRealWidth(343),
+ ScrollEnabled = false,
};
//灞炴�ц缃尯鍩熼珮搴�
- int attrViewHight = Application.GetRealHeight(27 + 22);
- attrView.AddChidren(new Button() { Height = Application.GetRealHeight(27) });
+ int attrViewHight = Application.GetRealHeight(18 + 22);
- if (hadDimming)
+
+ //鍙湁缁х數鍣�
+ if (!hadDimming && !hadCCT && !hadRGB)
{
- attrViewHight += Application.GetRealHeight(54 + 11);
- var dimmingView = new FrameLayout();
- attrView.AddChidren(dimmingView);
+ attrViewHight += Application.GetRealHeight(50);
+ attrView.Height = attrViewHight;
+ contentView.AddChidren(attrView);
+ attrView.AddChidren(new Button() { Height = Application.GetRealHeight(18) });
-
- #region 浜害璋冭妭
- var btnBrightnessText = new Button()
+ var view = new FrameLayout()
{
- X = Application.GetRealWidth(35),
- Y = Application.GetRealHeight(1),
- Width = Application.GetRealWidth(224),
- Height = Application.GetRealHeight(21),
- TextAlignment = TextAlignment.CenterLeft,
- TextColor = CSS_Color.FirstLevelTitleColor,
- TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- TextID = StringId.Brightness,
- BackgroundColor = 0xFFFF0000
+ Width = Application.GetRealWidth(343),
+ Height = Application.GetRealHeight(50),
};
- dimmingView.AddChidren(btnBrightnessText);
+ attrView.AddChidren(view);
+
- var btnMinValuesText = new Button()
+ var btnClose = 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,
+ X = Application.GetRealWidth(50),
+ Gravity = Gravity.CenterVertical,
+ Width = Application.GetRealWidth(98),
+ Height = Application.GetRealHeight(40),
+ TextColor = CSS_Color.TextualColor,
+ SelectedBackgroundColor = CSS_Color.MainColor,
+ SelectedTextColor = CSS_Color.MainBackgroundColor,
+ BackgroundColor = CSS_Color.DividingLineColor,
+ TextID = StringId.OFF,
+ TextSize = CSS_FontSize.TextFontSize,
+ Radius = (uint)Application.GetRealWidth(5),
+ IsSelected = true,
+ //BorderWidth = 1,
+ //BorderColor = 0x00000000
};
- dimmingView.AddChidren(btnMinValuesText);
+ view.AddChidren(btnClose);
- var dimmerBar = new DiyImageSeekBar()
+ var btnOpen = new Button()
{
- X = Application.GetRealWidth(35 + 22),
- Y = Application.GetRealHeight(11),
- 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 = brightnessValue,
- SeekBarPadding = Application.GetRealWidth(20),
+ X = Application.GetRealWidth(100 + 98),
+ Gravity = Gravity.CenterVertical,
+ Width = Application.GetRealWidth(98),
+ Height = Application.GetRealHeight(40),
+ TextColor = CSS_Color.TextualColor,
+ SelectedBackgroundColor = CSS_Color.MainColor,
+ SelectedTextColor = CSS_Color.MainBackgroundColor,
+ BackgroundColor = CSS_Color.DividingLineColor,
+ TextID = StringId.On,
+ TextSize = CSS_FontSize.TextFontSize,
+ Radius = (uint)Application.GetRealWidth(5),
};
- //dimmingView.AddChidren(dimmerBar);
+ view.AddChidren(btnOpen);
- var btnMaxValuesText = new Button()
+ btnClose.MouseUpEventHandler = (sender, e) =>
{
- 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,
+ btnClose.IsSelected = true;
+ btnOpen.IsSelected = false;
+ commandDic[FunctionAttributeKey.OnOff] = "off";
};
- dimmingView.AddChidren(btnMaxValuesText);
- #endregion
-
+ btnOpen.MouseUpEventHandler = (sender, e) =>
+ {
+ btnClose.IsSelected = false;
+ btnOpen.IsSelected = true;
+ commandDic[FunctionAttributeKey.OnOff] = "on";
+ };
}
- attrView.Height = attrViewHight;
- contentView.AddChidren(attrView);
+ else
+ {
+ if(hadRGB)
+ {
+ attrViewHight += Application.GetRealHeight(248);
+ hadDimming = true;
+ }
+ if (hadCCT)
+ {
+ attrViewHight += Application.GetRealHeight(54 + 11);
+ hadDimming = true;
+ }
+ if (hadDimming)
+ {
+ attrViewHight += Application.GetRealHeight(54 + 11);
+ }
+ attrView.Height = attrViewHight;
+ contentView.AddChidren(attrView);
+ attrView.AddChidren(new Button() { Height = Application.GetRealHeight(18) });
+
+
+ if (hadDimming)
+ {
+ LoadDimmingAttrView(attrView);
+ }
+ if (hadCCT)
+ {
+ LoadCctAttrView(attrView);
+ }
+ if(hadRGB)
+ {
+ LoadRgbAttrView(attrView);
+ }
+ }
+
contentView.Height = Application.GetRealHeight(52 + 44) + attrViewHight;
contentView.Gravity = Gravity.Center;
@@ -459,9 +616,10 @@
var bottomView = new FrameLayout()
{
Y = Application.GetRealHeight(52) + attrViewHight,
- Height = Application.GetRealHeight(44),
+ Height = Application.GetRealHeight(46),
};
contentView.AddChidren(bottomView);
+ bottomView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor });
var btnSave = new Button()
{
@@ -489,212 +647,476 @@
//渚嬶細鍙充笅鍦嗚 澶у皬涓�50
int mRectCornerID = HDLUtils.RectCornerBottomRight;
- btnComplete.SetCornerWithSameRadius((uint)Application.GetMinRealAverage(12), mRectCornerID);
-
- bottomView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor });
+ btnComplete.SetCornerWithSameRadius((uint)Application.GetRealWidth(14), mRectCornerID);
- btnSave.MouseUpEventHandler = (sender, e) => {
- this.Close();
-
-
- };
btnComplete.MouseUpEventHandler = (sender, e) => {
this.Close();
+ var waitPage = new Loading();
+ MainPage.BaseView.AddChidren(waitPage);
+ waitPage.Start(Language.StringByID(StringId.PleaseWait));
+
+ new Thread(() =>
+ {
+ try
+ {
+ foreach (var light in lights)
+ {
+ Dictionary<string, string> sendDate = new Dictionary<string, string>();
+ //璧嬪�煎満鏅姛鑳芥暟鎹�
+ foreach (var attr in light.GetAttributes())
+ {
+ if (commandDic.ContainsKey(attr))
+ {
+ try
+ {
+ sendDate.Add(attr, commandDic[attr]);
+ }
+ catch { }
+ }
+
+ }
+ Control.Ins.SendWriteCommand(light, sendDate);
+ Thread.Sleep(50);
+ }
+ }
+ catch
+ { }
+ finally
+ {
+ Application.RunOnMainThread(() =>
+ {
+ waitPage.Hide();
+ if (waitPage != null)
+ {
+ backAction(null);
+ waitPage.RemoveFromParent();
+ }
+ });
+ }
+ })
+ { IsBackground = true }.Start();
};
+
+
+
+ btnSave.MouseUpEventHandler += (sender, e) =>
+ {
+ if (string.IsNullOrEmpty(scene.name))
+ {
+ new Tip()
+ {
+ CloseTime = 1,
+ Text = Language.StringByID(StringId.SceneNameCannotBeEmpty),
+ Direction = AMPopTipDirection.None,
+ }.Show(bodyView);
+ return;
+ }
+ foreach (var tempRoom in FunctionList.List.scenes)
+ {
+ if (scene.name == tempRoom.name)
+ {
+ new PublicAssmebly().TipMsg(StringId.Tip, StringId.SceneNameAlreadyExists);
+ return;
+ }
+ }
+ var waitPage = new Loading();
+ MainPage.BaseView.AddChidren(waitPage);
+ waitPage.Start(Language.StringByID(StringId.PleaseWait));
+ new Thread(() =>
+ {
+ try
+ {
+ var serverScene = new Scene();
+ for (int i = 0; i < lights.Count; i++)
+ {
+ var light = lights[i];
+ //璧嬪�煎満鏅姛鑳芥暟鎹�
+ foreach (var attr in light.GetAttributes())
+ {
+ if (commandDic.ContainsKey(attr))
+ {
+ try
+ {
+ light.SetAttrState(attr, commandDic[attr]);
+ }
+ catch { }
+ }
+ }
+ //杞崲鍦烘櫙鐨勫姛鑳藉璞�
+ var sceneFunction = light.ConvertSceneFunction();
+ //鏌ヨ鏈夋病鏈夊瓨鍦�
+ var temp = scene.functions.Find((obj) => obj.sid == sceneFunction.sid);
+ //璧嬪��
+ if (temp != null)
+ {
+ temp = sceneFunction;
+ }
+ else
+ {
+ scene.functions.Add(sceneFunction);
+ }
+ }
+ var result = FunctionList.List.AddScene(scene, out serverScene);
+ Application.RunOnMainThread(() =>
+ {
+ if (result == StateCode.SUCCESS)
+ {
+ scene = serverScene;
+ FunctionList.List.scenes.Add(scene);
+ backAction(scene);
+ this.Close();
+ }
+ else
+ {
+ IMessageCommon.Current.ShowErrorInfoAlter(result);
+ }
+ });
+ }
+ catch { }
+ finally
+ {
+ Application.RunOnMainThread(() => {
+ waitPage.Hide();
+ waitPage.RemoveFromParent();
+ });
+ }
+ })
+ { IsBackground = true, Priority = ThreadPriority.AboveNormal }.Start();
+ };
+
+
+
+
#endregion
this.Show();
- return;
- //鍙湁璋冨厜鍣�
- if (!hadDimming&&!hadCCT&&!hadRGB)
- {
- contentView.Height = Application.GetRealHeight(520);
- contentView.Width = Application.GetRealWidth(343);
- contentView.Gravity = Gravity.Center;
- contentView.Radius = (uint)Application.GetRealWidth(12);
- contentView.AddChidren(titleView);
- }
- else if (hadCCT && hadRGB)//
- {
- contentView.Height = Application.GetRealHeight(520);
- contentView.Width = Application.GetRealWidth(343);
- contentView.Gravity = Gravity.Center;
- contentView.Radius = (uint)Application.GetRealWidth(12);
- contentView.AddChidren(titleView);
- #region 浜害璋冭妭
- var btnBrightnessText = new Button()
- {
- X = Application.GetRealWidth(35),
- Y = Application.GetRealHeight(82),
- Width = Application.GetRealWidth(224),
- Height = Application.GetRealHeight(21),
- TextAlignment = TextAlignment.CenterLeft,
- TextColor = CSS_Color.FirstLevelTitleColor,
- TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- TextID = StringId.Brightness,
- };
- contentView.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,
- };
- contentView.AddChidren(btnMinValuesText);
-
- var dimmerBar = new DiyImageSeekBar()
- {
- X = Application.GetRealWidth(35 + 22),
- Y = Application.GetRealHeight(312),
- 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 = brightnessValue,
- SeekBarPadding = Application.GetRealWidth(20),
- };
- contentView.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,
- };
- contentView.AddChidren(btnMaxValuesText);
- #endregion
-
-
-
- #region 鑹叉俯
- //鑹叉俯
- var btnTempClolor = new Button();
- btnTempClolor.X = Application.GetRealWidth(35);
- btnTempClolor.Y = Application.GetRealHeight(159);
- btnTempClolor.Width = Application.GetRealWidth(224);
- btnTempClolor.Height = Application.GetRealHeight(21);
- btnTempClolor.TextAlignment = TextAlignment.CenterLeft;
- btnTempClolor.TextColor = CSS_Color.FirstLevelTitleColor;
- btnTempClolor.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
- btnTempClolor.TextID = StringId.ColorTemperature;
- contentView.AddChidren(btnTempClolor);
-
- //2700K
- var btnTempClolorMin = new Button();
- btnTempClolorMin.Y = btnTempClolor.Bottom + Application.GetRealHeight(9);
- btnTempClolorMin.Width = Application.GetRealWidth(54);
- btnTempClolorMin.Height = Application.GetRealHeight(21);
- btnTempClolorMin.Text = "2700K";
- btnTempClolorMin.TextAlignment = TextAlignment.CenterRight;
- btnTempClolorMin.TextColor = CSS_Color.PromptingColor1;
- btnTempClolorMin.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
- contentView.AddChidren(btnTempClolorMin);
-
- //婊戝姩鏉$殑鑳屾櫙鍥剧墖
- var btnColorTemplatrueBack = new Button();
- //闇�瑕佸噺鎺夋粦鍔ㄦ潯鐨勫乏鍙抽棿璺�
- btnColorTemplatrueBack.Width = Application.GetRealWidth(210 - 20 * 2);
- btnColorTemplatrueBack.Height = Application.GetRealHeight(8);
- btnColorTemplatrueBack.Gravity = Gravity.CenterHorizontal;
- btnColorTemplatrueBack.UnSelectedImagePath = "FunctionIcon/Light/ColorTemperatureBar.png";
- contentView.AddChidren(btnColorTemplatrueBack);
- //婊戝姩鏉℃帶浠�
- var barColorTemplatrue = new CCTSeekBarControl();
- barColorTemplatrue.X = btnTempClolorMin.Right;
- barColorTemplatrue.Y = Application.GetRealHeight(340);
- barColorTemplatrue.MinValue = 27;
- barColorTemplatrue.MaxValue = 65;
- barColorTemplatrue.ProgressBarColor = 0x00000000;//鍏ㄩ儴閫忔槑
- barColorTemplatrue.ProgressBarUnEnableColor = 0x00000000;
- barColorTemplatrue.SeekBarBackgroundColor = 0x00000000;
- contentView.AddChidren(barColorTemplatrue);
- barColorTemplatrue.Y = btnTempClolorMin.Y - (barColorTemplatrue.Height - btnTempClolorMin.Height) / 2;
- //鏄剧ず涓婃柟鐨凾xt
- barColorTemplatrue.ShowCustomTextView(Application.GetRealWidth(50), CSS_FontSize.PromptFontSize_FirstLevel, CSS_Color.FirstLevelTitleColor);
- var cct = 27;
- int.TryParse(cctLight.status.Find((obj)=>obj.key == FunctionAttributeKey.CCT).value, out cct);
- barColorTemplatrue.Progress = cct;
- //璁剧疆鍒濆鍊�
- barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K");
-
- //鍙樻洿鑳屾櫙鍥剧殑Y杞村潗鏍�
- btnColorTemplatrueBack.Y = barColorTemplatrue.Y + (barColorTemplatrue.Height - btnColorTemplatrueBack.Height) / 2;
-
- //6500K
- var btnTempClolorMax = new Button();
- btnTempClolorMax.Y = btnTempClolorMin.Y;
- btnTempClolorMax.X = barColorTemplatrue.Right;
- btnTempClolorMax.Width = Application.GetRealWidth(54);
- btnTempClolorMax.Height = Application.GetRealHeight(21);
- btnTempClolorMax.Text = "6500K";
- btnTempClolorMax.TextAlignment = TextAlignment.CenterLeft;
- btnTempClolorMax.TextColor = CSS_Color.PromptingColor1;
- btnTempClolorMax.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
- contentView.AddChidren(btnTempClolorMax);
-
- #endregion
-
- #region RGB
-
- var btnCurColor = new Button()
- {
- X = Application.GetRealWidth(24),
- Y = Application.GetRealHeight(241),
- Width = Application.GetMinRealAverage(24),
- Height = Application.GetMinRealAverage(24),
- Radius = (uint)Application.GetMinRealAverage(8),
- BorderColor = CSS_Color.PromptingColor2,
- BorderWidth = 1,
- BackgroundColor = (uint)(0xFF000000 + new Light().GetRGBcolor(new Function(),rgbLight.status.Find((obj) => obj.key == FunctionAttributeKey.RGB).value))
- };
- contentView.AddChidren(btnCurColor);
-
- //鑹茬洏鐨勬甯冩帶浠�(闄愬埗閭d釜鐧借壊婊戝姩鐞冧娇鐢�)
- var framePickerBack = new FrameLayout();
- framePickerBack.Gravity = Gravity.CenterHorizontal;
- framePickerBack.Y = Application.GetRealHeight(249);
- framePickerBack.Width = Application.GetMinRealAverage(198);
- framePickerBack.Height = Application.GetMinRealAverage(198);
- contentView.AddChidren(framePickerBack);
-
- var colorPicker = new ColorPicker()
- {
- ColorImagePath = "FunctionIcon/Light/ColorWheel.png",
- };
- framePickerBack.AddChidren(colorPicker);
- #endregion
- }
- else if (hadDimming && !hadCCT && !hadRGB)
- {
- contentView.Height = Application.GetRealHeight(211);
- contentView.Width = Application.GetRealWidth(343);
- contentView.Gravity = Gravity.Center;
- contentView.Radius = (uint)Application.GetRealWidth(12);
- contentView.AddChidren(titleView);
- }
+
}
+
+ /// <summary>
+ /// 鍔犺浇璋冨厜灞炴�ц缃帶浠�
+ /// </summary>
+ /// <param name="attrView"></param>
+ void LoadDimmingAttrView(VerticalScrolViewLayout attrView)
+ {
+
+ commandDic.TryAdd(FunctionAttributeKey.Percent, "0");
+
+ 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) + " " + commandDic[FunctionAttributeKey.Percent] + "%";
+ 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,
+ Progress = Convert.ToInt32(commandDic[FunctionAttributeKey.Percent]),
+ 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) => {
+ commandDic[FunctionAttributeKey.Percent] = dimmerBar.Progress.ToString();
+ btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + e + "%";
+ };
+
+
+ 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(54 + 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(21);
+ 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;
+ var cct = 27;
+ //int.TryParse(cctLight.status.Find((obj) => obj.key == FunctionAttributeKey.CCT).value, out cct);
+ barColorTemplatrue.Progress = cct;
+ //璁剧疆鍒濆鍊�
+ 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) =>
+ {
+ commandDic[FunctionAttributeKey.CCT] = (barColorTemplatrue.Progress*100).ToString();
+ };
+ //鍙樻洿鑳屾櫙鍥剧殑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(VerticalScrolViewLayout attrView)
+ {
+
+ #region RGB
+ commandDic.TryAdd(FunctionAttributeKey.RGB, "255,255,255");
+
+ var rgbView = new FrameLayout()
+ {
+ Height = Application.GetRealHeight(248)
+ };
+ attrView.AddChidren(rgbView);
+
+
+ var btnCurColor = new Button()
+ {
+ X = Application.GetRealWidth(24),
+ Y = Application.GetRealHeight(10),
+ Width = Application.GetMinRealAverage(24),
+ Height = Application.GetMinRealAverage(24),
+ Radius = (uint)Application.GetMinRealAverage(8),
+ BorderColor = CSS_Color.PromptingColor2,
+ BorderWidth = 1,
+ BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(commandDic[FunctionAttributeKey.RGB]))
+ };
+ rgbView.AddChidren(btnCurColor);
+
+ //鑹茬洏鐨勬甯冩帶浠�(闄愬埗閭d釜鐧借壊婊戝姩鐞冧娇鐢�)
+ var framePickerBack = new FrameLayout();
+ framePickerBack.Gravity = Gravity.CenterHorizontal;
+ framePickerBack.Y = Application.GetRealHeight(20);
+ framePickerBack.Width = Application.GetMinRealAverage(198);
+ framePickerBack.Height = Application.GetMinRealAverage(198);
+ rgbView.AddChidren(framePickerBack);
+
+ var colorPicker = new ColorPicker()
+ {
+ ColorImagePath = "FunctionIcon/Light/ColorWheel.png",
+ };
+ framePickerBack.AddChidren(colorPicker);
+
+
+
+
+
+
+ //鐧界偣鎺т欢
+ var btnWhiteRound = new Button();
+ btnWhiteRound.Width = Application.GetRealWidth(24);
+ btnWhiteRound.Height = Application.GetRealWidth(24);
+ btnWhiteRound.UnSelectedImagePath = "FunctionIcon/Light/ColorWheelTip.png";
+ btnWhiteRound.Visible = false;
+ framePickerBack.AddChidren(btnWhiteRound);
+
+
+ //褰撳墠鐐瑰嚮鐨勩�愮偣銆戞槸鍚︽纭�
+ bool pointIsRight = false;
+ //鍦嗙殑鍗婂緞(鑰冭檻杈圭晫,闇�瑕佽缃畠鐨勫崐寰勬瘮杈冨皬涓�鐐�)
+ int circleR = colorPicker.Width / 2 - Application.GetRealWidth(12);
+
+
+ colorPicker.ColorChaged += (sender2, e2) => {
+ string rgbString = (e2[0] + "," + e2[1] + "," + e2[2]).ToString();
+ commandDic[FunctionAttributeKey.RGB] = rgbString;
+ btnCurColor.BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(rgbString));
+ };
+ colorPicker.MouseDownEventHandler += (sender, e) =>
+ {
+ pointIsRight = this.CheckPoint(circleR, colorPicker.Width / 2, colorPicker.Height / 2, (int)e.X, (int)e.Y);
+ if (pointIsRight == false)
+ {
+ //鐐圭殑鍖哄煙涓嶆槸鍦嗙洏鍐�
+ return;
+ }
+ //鏄剧ず鐧界偣
+ btnWhiteRound.X = (int)e.X - btnWhiteRound.Width / 2;
+ btnWhiteRound.Y = (int)e.Y - btnWhiteRound.Height / 2;
+ if (btnWhiteRound.Visible == false)
+ {
+ btnWhiteRound.Visible = true;
+ }
+ };
+
+ colorPicker.MouseMoveEventHandler += (sender, e) =>
+ {
+ //褰撻紶鏍囩偣涓嬩簨浠跺鐞�
+ colorPicker.MouseDownEventHandler(sender, e);
+ };
+
+
+ #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;
+ }
+
}
}
\ No newline at end of file
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs
index 41466c4..b78927b 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs
@@ -130,7 +130,7 @@
Radius = (uint)Application.GetMinRealAverage(8),
BorderColor = CSS_Color.PromptingColor2,
BorderWidth = 1,
- BackgroundColor = (uint)(0xFF000000 + lightTemp.GetRGBcolor(function))
+ BackgroundColor = (uint)(0xFF000000 + lightTemp.GetRGBcolor(function.GetAttrState(FunctionAttributeKey.RGB)))
};
controlView.AddChidren(btnCurColor);
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs
index 24e1b3b..91f95bd 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs
@@ -48,9 +48,9 @@
//鑹茬洏鐨勫渾鐐归殣钘�
bodyView.btnWhiteRound.Visible = false;
}
- bodyView.btnCurColor.BackgroundColor = (uint)(0xFF000000 + bodyView.lightTemp.GetRGBcolor(updateTemp));
+ bodyView.btnCurColor.BackgroundColor = (uint)(0xFF000000 + bodyView.lightTemp.GetRGBcolor(updateTemp.GetAttrState(FunctionAttributeKey.RGB)));
bodyView.lastColor = bodyView.lightTemp.GetRGBbytes(updateTemp);
- if (bodyView.lightTemp.GetRGBcolor(updateTemp) == 16777215 && bodyView.btnCurColor.BorderColor != 0x00000000)
+ if (bodyView.lightTemp.GetRGBcolor(updateTemp.GetAttrState(FunctionAttributeKey.RGB)) == 16777215 && bodyView.btnCurColor.BorderColor != 0x00000000)
{
bodyView.btnCurColor.BorderColor = CSS.CSS_Color.PromptingColor2;
}
--
Gitblit v1.8.0