.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 name="Electrical" expanded="True" /> </Node> </Node> </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 /> DLL/Linphone/iOS/Shared.IOS.HDLLinphoneSDK.dllBinary files differ
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" />--> HDL_ON/DAL/Server/HttpUtil.cs
@@ -17,8 +17,8 @@ /// 固定域名,正式环境 /// 公共域名就近解析 /// </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> 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"; 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; 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; } 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\" /> 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> 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";//董泽斌 天河办公室 //etAccount.Text = "tf@smarttech.com.ua"; //etAccount.Text = "18814122445";//董泽斌 天河办公室 //etAccount.Text = "18824864143";//"464027401@qq.com"; //"2791308028@qq.com";//13697499568 } b = !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> HDL_ON/UI/UI2/2-Classification/SceneControlZone.cs
New file @@ -0,0 +1,131 @@ using 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; } } } 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) { 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); //色盘的桌布控件(限制那个白色滑动球使用) 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> /// 加载变化速度选择弹窗 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") HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorGasPage.cs
@@ -118,8 +118,13 @@ /// </summary> private void RefreshFormStatu() { Application.RunOnMainThread(() => { foreach(var temp in device.attributes) { 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") @@ -133,7 +138,6 @@ btnIcon.UnSelectedImagePath = "FunctionIcon/ArmSensor/UnderProtectionBgIcon.png"; btnSuctionView.TextID = StringId.SensorNormalState; btnSuctionView.IsSelected = false; } } } }); 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") 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") HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs
@@ -238,12 +238,13 @@ 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(); } } } catch (Exception ex) { MainPage.Log($"AirSwitch error {ex.Message}"); 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; HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs
@@ -652,6 +652,7 @@ /// <param name="i_width">宽度,非真实值</param> public CCTSeekBarControl(int i_width = 210) { ProgressChangeDelayTime = 30; this.Width = Application.GetRealWidth(i_width); this.Height = Application.GetRealHeight(54); //圆球的宽度 @@ -689,7 +690,6 @@ this.OnProgressChangedEvent -= this.MyProgressChangedEvent; return; } this.ProgressChangedEvent(0, value); } HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs
@@ -1,5 +1,8 @@ using 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() { Y = Application.GetRealHeight(591), Height = Application.GetRealHeight(100), BackgroundColor = CSS_Color.MainBackgroundColor, Radius = (uint)Application.GetRealWidth(12), }; this.AddChidren(bottomView); var btnConfrim = new Button() string nowSelectId = null; btnFloor.MouseUpEventHandler += (sender, e) => { 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, //显示下拉列表 var form = new FloorRoomSelectPopupView(); form.ShowDeviceFunctionView(btnFloor, this.lightList, (selectId, listFunc) => { nowSelectId = selectId; //重新加载界面 LoadLightRow(listFunc); }, nowSelectId); }; 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,21 +422,27 @@ 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) => Action<string> callBack = (str) => { inEdit = !inEdit; btnEditIcon.IsSelected = inEdit; if (inEdit) //名称不能为空 if (string.IsNullOrEmpty(str)) { btnTitle.Width = btnTitle.GetTextWidth(); new Tip() { CloseTime = 1, Text = Language.StringByID(StringId.NameCannotBeEmpty), Direction = AMPopTipDirection.None, }.Show(bodyView); return; } else { btnTitle.Text = str; scene.name = str; if (btnTitle.GetTextWidth() > Application.GetRealWidth(197))//247 { btnTitle.Width = Application.GetRealWidth(197); @@ -344,25 +451,45 @@ { btnTitle.Width = btnTitle.GetTextWidth(); } editScene.name = btnTitle.Text.Trim(); } }; btnTitle.MouseUpEventHandler = dd; btnEditIcon.MouseUpEventHandler = dd; 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 = 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"; }; } 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,76 +647,207 @@ //例:右下圆角 大小为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)// /// <summary> /// 加载调光属性设置控件 /// </summary> /// <param name="attrView"></param> void LoadDimmingAttrView(VerticalScrolViewLayout attrView) { contentView.Height = Application.GetRealHeight(520); contentView.Width = Application.GetRealWidth(343); contentView.Gravity = Gravity.Center; contentView.Radius = (uint)Application.GetRealWidth(12); contentView.AddChidren(titleView); 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(82), Y = Application.GetRealHeight(1), Width = Application.GetRealWidth(224), Height = Application.GetRealHeight(21), Height = Application.GetRealHeight(25), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, TextID = StringId.Brightness, }; contentView.AddChidren(btnBrightnessText); 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(30), Width = Application.GetRealWidth(40), Height = Application.GetRealHeight(21), Text = "0%", TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, }; contentView.AddChidren(btnMinValuesText); dimmingView.AddChidren(btnMinValuesText); var dimmerBar = new DiyImageSeekBar() { X = Application.GetRealWidth(35 + 22), Y = Application.GetRealHeight(312), Width = Application.GetRealWidth(210), 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", @@ -567,134 +856,267 @@ ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel, ProgressBarColor = CSS_Color.AuxiliaryColor1 , MaxValue = 100, Progress = brightnessValue, Progress = Convert.ToInt32(commandDic[FunctionAttributeKey.Percent]), SeekBarPadding = Application.GetRealWidth(20), IsProgressTextShow = false, ProgressChangeDelayTime = 0, }; contentView.AddChidren(dimmerBar); 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(45), Width = Application.GetRealWidth(55), Height = Application.GetRealHeight(21), Text = "100%", TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, }; contentView.AddChidren(btnMaxValuesText); 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(159); 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; contentView.AddChidren(btnTempClolor); cctView.AddChidren(btnTempClolor); //2700K var btnTempClolorMin = new Button(); btnTempClolorMin.Y = btnTempClolor.Bottom + Application.GetRealHeight(9); 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.CenterRight; btnTempClolorMin.TextAlignment = TextAlignment.CenterLeft; btnTempClolorMin.TextColor = CSS_Color.PromptingColor1; btnTempClolorMin.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; contentView.AddChidren(btnTempClolorMin); cctView.AddChidren(btnTempClolorMin); //滑动条的背景图片 var btnColorTemplatrueBack = new Button(); //需要减掉滑动条的左右间距 btnColorTemplatrueBack.Width = Application.GetRealWidth(210 - 20 * 2); 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; btnColorTemplatrueBack.UnSelectedImagePath = "FunctionIcon/Light/ColorTemperatureBar.png"; contentView.AddChidren(btnColorTemplatrueBack); cctView.AddChidren(btnColorTemplatrueBack); //滑动条控件 var barColorTemplatrue = new CCTSeekBarControl(); barColorTemplatrue.X = btnTempClolorMin.Right; barColorTemplatrue.Y = Application.GetRealHeight(340); 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; contentView.AddChidren(barColorTemplatrue); cctView.AddChidren(barColorTemplatrue); barColorTemplatrue.Y = btnTempClolorMin.Y - (barColorTemplatrue.Height - btnTempClolorMin.Height) / 2; //显示上方的Txt 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); //int.TryParse(cctLight.status.Find((obj) => obj.key == FunctionAttributeKey.CCT).value, out cct); barColorTemplatrue.Progress = cct; //设置初始值 barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K"); 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; btnTempClolorMax.X = barColorTemplatrue.Right - Application.GetRealWidth(30); btnTempClolorMax.Width = Application.GetRealWidth(54); btnTempClolorMax.Height = Application.GetRealHeight(21); btnTempClolorMax.Text = "6500K"; btnTempClolorMax.TextAlignment = TextAlignment.CenterLeft; btnTempClolorMax.TextAlignment = TextAlignment.CenterRight; btnTempClolorMax.TextColor = CSS_Color.PromptingColor1; btnTempClolorMax.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; contentView.AddChidren(btnTempClolorMax); 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(241), 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 + new Light().GetRGBcolor(new Function(),rgbLight.status.Find((obj) => obj.key == FunctionAttributeKey.RGB).value)) BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(commandDic[FunctionAttributeKey.RGB])) }; contentView.AddChidren(btnCurColor); rgbView.AddChidren(btnCurColor); //色盘的桌布控件(限制那个白色滑动球使用) var framePickerBack = new FrameLayout(); framePickerBack.Gravity = Gravity.CenterHorizontal; framePickerBack.Y = Application.GetRealHeight(249); framePickerBack.Y = Application.GetRealHeight(20); framePickerBack.Width = Application.GetMinRealAverage(198); framePickerBack.Height = Application.GetMinRealAverage(198); contentView.AddChidren(framePickerBack); rgbView.AddChidren(framePickerBack); var colorPicker = new ColorPicker() { ColorImagePath = "FunctionIcon/Light/ColorWheel.png", }; framePickerBack.AddChidren(colorPicker); #endregion } else if (hadDimming && !hadCCT && !hadRGB) //白点控件 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) => { contentView.Height = Application.GetRealHeight(211); contentView.Width = Application.GetRealWidth(343); contentView.Gravity = Gravity.Center; contentView.Radius = (uint)Application.GetRealWidth(12); contentView.AddChidren(titleView); 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; } } } 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); 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; }