From 37c315988c2dc11e4f477233f7a9f87d57bb61aa Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期一, 08 三月 2021 09:17:15 +0800
Subject: [PATCH] 数据结构优化修改
---
HDL-ON_Android/Properties/AndroidManifest.xml | 2
HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs | 94
HDL-ON_iOS/HDL-ON_iOS.csproj | 4
HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs | 25
HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs | 38
HDL_ON/Entity/Function/FloorHeating.cs | 372 +--
HDL_ON/HDL_ON.projitems | 1
HDL_ON/Entity/Function/Sensor.cs | 506 ++---
HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs | 39
HDL-ON_iOS/Info.plist | 4
HDL_ON/Entity/Function/Fan.cs | 56
HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs | 102
HDL_ON/Entity/Room.cs | 9
HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs | 3
HDL_ON/UI/UI2/FuntionControlView/Light/RelayPage.cs | 23
HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs | 27
HDL_ON/UI/UI1-Login/LoginPage.cs | 4
HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs | 49
HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPage.cs | 19
HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs | 92
HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPage.cs | 51
HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs | 47
HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs | 36
HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs | 98
HDL_ON/DAL/DriverLayer/Control_Udp.cs | 261 +-
HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs | 28
HDL_ON/Entity/Function/Function.cs | 51
HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs | 4
HDL_ON/UI/UI2/2-Classification/FunctionPage.cs | 14
HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs | 37
HDL_ON/UI/UI2/FuntionControlView/AC/AcControlPage.cs | 98
HDL_ON/Entity/Function/WeepRobot.cs | 2
HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs | 55
HDL_ON/UI/UI2/1-HomePage/HomePage.cs | 8
HDL_ON/Entity/Function/Light.cs | 287 ---
HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs | 41
HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPage.cs | 17
HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs | 13
HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs | 77
HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPage.cs | 49
HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs | 90
HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPage.cs | 19
HDL_ON/Entity/Function/AC.cs | 363 +---
HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs | 88
HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs | 3
HDL_ON/DAL/DriverLayer/Packet.cs | 251 +-
HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs | 81
.vs/HDL_APP_Project/xs/UserPrefs.xml | 57
HDL_ON/DAL/DriverLayer/Control.cs | 436 +---
HDL_ON/UI/MainPage.cs | 2
HDL_ON/Entity/Function/AirCleaner.cs | 2
HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs | 44
HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPage.cs | 23
HDL_ON/Entity/Function/SwitchSocket.cs | 2
HDL_ON/Entity/Function/TV.cs | 11
HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs | 28
HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePage.cs | 23
HDL_ON/Entity/FunctionList.cs | 378 +---
HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs | 42
/dev/null | 15
HDL_ON/Entity/Function/Curtain.cs | 69
HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePageBLL.cs | 14
HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs | 78
63 files changed, 1,966 insertions(+), 2,896 deletions(-)
diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml
index e19ddc8..1697180 100644
--- a/.vs/HDL_APP_Project/xs/UserPrefs.xml
+++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,60 +1,27 @@
锘�<Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default">
- <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008020-000404163432002E" />
- <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs">
+ <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.94B44E9C-E1BC-4BF7-812E-FC71E9B623B2" />
+ <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI1-Login/LoginPage.cs">
<Files>
- <File FileName="HDL_ON/Entity/FunctionList.cs" Line="370" Column="38" />
- <File FileName="HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs" Line="58" Column="22" />
- <File FileName="HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs" Line="153" Column="41" />
- <File FileName="HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaWaterValvePage.cs" />
+ <File FileName="HDL_ON/UI/UI1-Login/LoginPage.cs" Line="199" Column="17" />
+ <File FileName="HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs" />
<File FileName="HDL_ON/Common/ApiUtlis.cs" />
- <File FileName="HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorPirPage.cs" Line="98" Column="21" />
- <File FileName="HDL_ON/UI/UI0-Stan/Logic/HdlDeviceStatuPushLogic.cs" Line="41" Column="42" />
- <File FileName="HDL_ON/UI/UI2/FuntionControlView/Electrical/TuyaAirCleanerPage.cs" Line="789" Column="42" />
- <File FileName="HDL_ON/DAL/DriverLayer/Control.cs" Line="209" Column="31" />
- <File FileName="HDL_ON/UI/UI2/FuntionControlView/AC/AcControlPage.cs" Line="83" Column="1" />
- <File FileName="HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs" Line="9" Column="32" />
- <File FileName="HDL_ON/UI/UI1-Login/LoginPage.cs" Line="218" Column="58" />
- <File FileName="HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs" Line="47" Column="35" />
+ <File FileName="HDL_ON/Entity/Room.cs" />
+ <File FileName="HDL_ON/Entity/FunctionList.cs" />
+ <File FileName="HDL_ON/UI/MainPage.cs" />
+ <File FileName="HDL-ON_iOS/Info.plist" />
</Files>
<Pads>
<Pad Id="ProjectPad">
<State name="__root__">
<Node name="HDL_APP_Project" expanded="True">
<Node name="HDL_ON" expanded="True">
- <Node name="Common" expanded="True">
- <Node name="Utlis" expanded="True" />
- </Node>
- <Node name="DAL" expanded="True">
- <Node name="DriverLayer" 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="UpdataSidDataDialog.cs" selected="True" />
- </Node>
- <Node name="UI0-Stan" expanded="True">
- <Node name="Logic" expanded="True" />
- </Node>
- <Node name="UI1-Login" expanded="True" />
- <Node name="UI2" expanded="True">
- <Node name="1-HomePage" expanded="True" />
- <Node name="2-Classification" expanded="True" />
- <Node name="3-Intelligence" expanded="True">
- <Node name="Scene" expanded="True" />
- </Node>
- <Node name="FuntionControlView" expanded="True">
- <Node name="AC" expanded="True" />
- <Node name="ArmSensor" expanded="True" />
- <Node name="Curtain" expanded="True" />
- <Node name="Electrical" expanded="True" />
- <Node name="Light" expanded="True" />
- </Node>
+ <Node name="UI1-Login" expanded="True">
+ <Node name="LoginPage.cs" selected="True" />
</Node>
</Node>
</Node>
- <Node name="ys" expanded="True" />
+ <Node name="HDL-ON_iOS" expanded="True" />
</Node>
</State>
</Pad>
@@ -66,7 +33,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="Release" />
<MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.SelectDevice" />
<MonoDevelop.Ide.DebuggingService.Breakpoints>
<BreakpointStore>
diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml
index 7456bfe..00724b4 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="202103032" android:versionName="1.1.202103032" package="com.hdl.onpro">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202103051" android:versionName="1.1.202103051" package="com.hdl.onpro">
<uses-sdk android:minSdkVersion="26" android:targetSdkVersion="26" />
<!-- 瀹氫綅鏉冮檺-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
diff --git a/HDL-ON_iOS/HDL-ON_iOS.csproj b/HDL-ON_iOS/HDL-ON_iOS.csproj
index f5a867c..cad9e3a 100644
--- a/HDL-ON_iOS/HDL-ON_iOS.csproj
+++ b/HDL-ON_iOS/HDL-ON_iOS.csproj
@@ -47,14 +47,14 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchArch>ARM64</MtouchArch>
- <CodesignKey>iPhone Developer: xuebiao huang (4P32GXQWWK)</CodesignKey>
+ <CodesignKey>Apple Development: xuebiao huang (4P32GXQWWK)</CodesignKey>
<MtouchDebug>true</MtouchDebug>
<MtouchI18n>cjk</MtouchI18n>
<MtouchLink>SdkOnly</MtouchLink>
<MtouchExtraArgs>-gcc_flags="-dead_strip -ObjC"</MtouchExtraArgs>
<MtouchEnableSGenConc>false</MtouchEnableSGenConc>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
-<CodesignProvision>ComHdlOnProDevelopment20210225-1</CodesignProvision>
+<CodesignProvision>ComHdlOnProDevelopment20210305-1</CodesignProvision>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
diff --git a/HDL-ON_iOS/Info.plist b/HDL-ON_iOS/Info.plist
index 1e97d34..d5aace1 100644
--- a/HDL-ON_iOS/Info.plist
+++ b/HDL-ON_iOS/Info.plist
@@ -102,9 +102,9 @@
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>CFBundleShortVersionString</key>
- <string>1.1.202103032</string>
+ <string>1.1.202103051</string>
<key>CFBundleVersion</key>
- <string>202103032</string>
+ <string>202103051</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Use geographic location to provide services such as weather</string>
<key>NSAppleMusicUsageDescription</key>
diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index 386bc5a..7982419 100644
--- a/HDL_ON/DAL/DriverLayer/Control.cs
+++ b/HDL_ON/DAL/DriverLayer/Control.cs
@@ -674,311 +674,187 @@
try
{
var localFunction = allLocalFuntion.Find((obj) => obj.sid == updateTemp.sid);
+ if (localFunction == null)
+ {
+ continue;
+ }
if (Ins.GatewayOnline_Local && isCloudData)//鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞�
{
- if(!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(localFunction.spk))
+ if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(localFunction.spk))
{
//MainPage.Log($"A鍗忚鏇存柊鐘舵��:鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞�........");
return;
}
}
- //MainPage.Log($"A鍗忚鏇存柊鐘舵��:{revString}");
+ MainPage.Log($"A鍗忚鏇存柊鐘舵��:{revString}");
foreach (var attr in updateTemp.status)
{
- localFunction.SetAttrState(attr.key,attr.value);
+ localFunction.SetAttrState(attr.key, attr.value);
}
- if (localFunction != null)
+ //鏇存柊鐣岄潰鐘舵��
+ Function localObj = null;
+ switch (localFunction.spk)
{
- //鏇存柊鐣岄潰鐘舵��
- Function localObj = null;
- switch (localFunction.spk)
- {
- case SPK.LightSwitch:
- var localSwitch = FunctionList.List.lights.Find((obj) => obj.sid == updateTemp.sid);
- if (localSwitch != null)
+ case SPK.LightSwitch:
+ RelayPage.UpdataState(localFunction);
+ break;
+ case SPK.LightDimming:
+ localFunction.lastState = Language.StringByID(StringId.Brightness) + " : " +
+ localFunction.GetAttrState(FunctionAttributeKey.Brightness) + "%";
+ DimmerPage.UpdataStates(localFunction);
+ break;
+ case SPK.ElectricFan:
+ localFunction.lastState = Language.StringByID(StringId.Level) + " : " +
+ localFunction.GetAttrState(FunctionAttributeKey.OpenLevel);
+ FanPage.UpdataState(localFunction);
+ break;
+ case SPK.LightRGB:
+ localFunction.lastState = Language.StringByID(StringId.Brightness) + " : " + localFunction.GetAttrState(FunctionAttributeKey.Brightness) + "%";
+ RGBPage.UpdataStates(localFunction);
+ break;
+ case SPK.LightRGBW:
+ break;
+ case SPK.LightCCT:
+ localFunction.lastState = Language.StringByID(StringId.Brightness) + " : " + localFunction.GetAttrState(FunctionAttributeKey.Brightness) + "%";
+ ColorTureLampPage.UpdataStatus(localFunction);
+ break;
+ case SPK.CurtainSwitch:
+ localFunction.lastState = localFunction.trait_on_off.curValue.ToString() == "on" ? Language.StringByID(StringId.Open) : Language.StringByID(StringId.Close);
+ CurtainModulePage.UpdataState(localFunction);
+ break;
+ case SPK.CurtainTrietex:
+ localFunction.lastState = Language.StringByID(StringId.Open) + localFunction.GetAttrState(FunctionAttributeKey.Percent) + "%";
+ MotorCurtainPage.UpdataState(localFunction);
+ break;
+ case SPK.CurtainRoller:
+ localFunction.lastState = Language.StringByID(StringId.Open) + localFunction.GetAttrState(FunctionAttributeKey.Percent) + "%";
+ RollingShutterPage.UpdataState(localFunction);
+ break;
+ case SPK.CurtainShades:
+ break;
+ case SPK.AcStandard:
+ Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid, updateTemp.status);
+ if (localFunction != null)
+ {
+ localFunction.lastState = "";
+ switch (localFunction.GetAttrState(FunctionAttributeKey.Mode))
{
- localObj = localSwitch;
- foreach (var attr in updateTemp.status)
- {
- var localAttr = localSwitch.attributes.Find((obj) => obj.key == attr.key);
- if (localAttr != null)
- {
- localAttr.curValue = attr.value;
- }
- }
- RelayPage.UpdataState(localSwitch);
+ case "cool":
+ localFunction.lastState = Language.StringByID(StringId.Cool);
+ break;
+ case "heat":
+ localFunction.lastState = Language.StringByID(StringId.Heat);
+ break;
+ case "dry":
+ localFunction.lastState = Language.StringByID(StringId.Dry);
+ break;
+ case "auto":
+ localFunction.lastState = Language.StringByID(StringId.Auto);
+ break;
+ case "fan":
+ localFunction.lastState = Language.StringByID(StringId.AirSupply);
+ break;
}
- break;
- case SPK.LightDimming:
- var dimming = FunctionList.List.lights.Find((obj) => obj.sid == updateTemp.sid);
- if (dimming != null)
+ switch (localFunction.GetAttrState(FunctionAttributeKey.FanSpeed))
{
- localObj = dimming;
- foreach (var attr in updateTemp.status)
- {
- var localAttr = dimming.attributes.Find((obj) => obj.key == attr.key);
- if (localAttr != null)
- {
- localAttr.curValue = attr.value;
- }
- }
- dimming.lastState = Language.StringByID(StringId.Brightness) + " : " + dimming.brightness + "%";
- DimmerPage.UpdataStates(dimming);
+ case "high":
+ localFunction.lastState += " " + Language.StringByID(StringId.HighWindSpeed);
+ break;
+ case "medium":
+ localFunction.lastState += " " + Language.StringByID(StringId.MiddleWindSpeed);
+ break;
+ case "low":
+ localFunction.lastState += " " + Language.StringByID(StringId.LowWindSpeed);
+ break;
+ case "auto":
+ localFunction.lastState += " " + Language.StringByID(StringId.Auto);
+ break;
}
- break;
- case SPK.ElectricFan:
- var fan = FunctionList.List.fans.Find((obj) => obj.sid == updateTemp.sid);
- if (fan != null)
+ localFunction.lastState += " " + localFunction.GetAttrState(FunctionAttributeKey.SetTemp) + new AC().GetTempUnitString(localFunction);
+ ACPage.UpdataStates(localFunction);
+ }
+ break;
+ case SPK.FloorHeatStandard:
+ switch (localFunction.GetAttrState(FunctionAttributeKey.Mode))
+ {
+ case "normal":
+ localFunction.lastState = Language.StringByID(StringId.Normal);
+ break;
+ case "day":
+ localFunction.lastState = Language.StringByID(StringId.Day);
+ break;
+ case "night":
+ localFunction.lastState = Language.StringByID(StringId.Night);
+ break;
+ case "timer":
+ localFunction.lastState = Language.StringByID(StringId.Auto);
+ break;
+ case "away":
+ localFunction.lastState = Language.StringByID(StringId.Away);
+ break;
+ }
+ localFunction.lastState += " " + localFunction.GetAttrState(FunctionAttributeKey.SetTemp) + new FloorHeating().GetTempUnitString(localFunction);
+ FloorHeatingPage.UpdataStates(localFunction);
+ break;
+ case SPK.SensorPm25:
+ case SPK.SensorCO2:
+ case SPK.SensorTVOC:
+ case SPK.SensorTemperature:
+ case SPK.SensorHumidity:
+ var sensor = FunctionList.List.GetEnvirSensorsList().Find((obj) => obj.sid == updateTemp.sid);
+ if (sensor != null)
+ {
+ localObj = sensor;
+ foreach (var attr in updateTemp.status)
{
- localObj = fan;
- foreach (var attr in updateTemp.status)
+ var localAttr = sensor.attributes.Find((obj) => obj.key == attr.key);
+ if (localAttr != null)
{
- var localAttr = fan.attributes.Find((obj) => obj.key == attr.key);
- if (localAttr != null)
- {
- localAttr.curValue = attr.value;
- }
+ localAttr.curValue = attr.value;
}
- fan.lastState = Language.StringByID(StringId.Level) + " : " + fan.openLevel;
- FanPage.UpdataState(fan);
}
- break;
- case SPK.LightRGB:
- var rgb = FunctionList.List.lights.Find((obj) => obj.sid == updateTemp.sid);
- if (rgb != null)
+ EnvironmentalSciencePage.LoadEvent_UpdataStatus(sensor);
+ }
+ break;
+ case SPK.ElectricSocket:
+ var es = FunctionList.List.GetElectricSocketList().Find((obj) => obj.sid == updateTemp.sid);
+ if (es != null)
+ {
+ localObj = es;
+ foreach (var attr in updateTemp.status)
{
- localObj = rgb;
- foreach (var attr in updateTemp.status)
+ var localAttr = es.attributes.Find((obj) => obj.key == attr.key);
+ if (localAttr != null)
{
- var localAttr = rgb.attributes.Find((obj) => obj.key == attr.key);
- if (localAttr != null)
- {
- localAttr.curValue = attr.value;
- }
+ localAttr.curValue = attr.value;
}
- rgb.lastState = Language.StringByID(StringId.Brightness) + " : " + rgb.brightness + "%";
- RGBPage.UpdataStates(rgb);
}
- break;
- case SPK.LightRGBW:
- break;
- case SPK.LightCCT:
- var lightCCT = FunctionList.List.lights.Find((obj) => obj.sid == updateTemp.sid);
- if (lightCCT != null)
- {
- localObj = lightCCT;
- foreach (var attr in updateTemp.status)
- {
- var localAttr = lightCCT.attributes.Find((obj) => obj.key == attr.key);
- if (localAttr != null)
- {
- localAttr.curValue = attr.value;
- }
- }
- lightCCT.lastState = Language.StringByID(StringId.Brightness) + " : " + lightCCT.brightness + "%";
- ColorTureLampPage.UpdataStates(lightCCT);
- }
- break;
- case SPK.CurtainSwitch:
- var curtain = FunctionList.List.curtains.Find((obj) => obj.sid == updateTemp.sid);
- if (curtain != null)
- {
- localObj = curtain;
- foreach (var attr in updateTemp.status)
- {
- var localAttr = curtain.attributes.Find((obj) => obj.key == attr.key);
- if (localAttr != null)
- {
- localAttr.curValue = attr.value;
- }
- }
- curtain.lastState = curtain.trait_on_off.curValue.ToString() == "on" ? Language.StringByID(StringId.Open) : Language.StringByID(StringId.Close);
- CurtainModulePage.UpdataState(curtain);
- }
- break;
- case SPK.CurtainTrietex:
- var trietex = FunctionList.List.curtains.Find((obj) => obj.sid == updateTemp.sid);
- if (trietex != null)
- {
- localObj = trietex;
- foreach (var attr in updateTemp.status)
- {
- var localAttr = trietex.attributes.Find((obj) => obj.key == attr.key);
- if (localAttr != null)
- {
- localAttr.curValue = attr.value;
- }
- }
- trietex.lastState = Language.StringByID(StringId.Open) + trietex.percent + "%";
- MotorCurtainPage.UpdataState(trietex);
- }
- break;
- case SPK.CurtainRoller:
- var roller = FunctionList.List.curtains.Find((obj) => obj.sid == updateTemp.sid);
- if (roller != null)
- {
- localObj = roller;
- foreach (var attr in updateTemp.status)
- {
- var localAttr = roller.attributes.Find((obj) => obj.key == attr.key);
- if (localAttr != null)
- {
- localAttr.curValue = attr.value;
- }
- }
- roller.lastState = Language.StringByID(StringId.Open) + roller.percent + "%";
- RollingShutterPage.UpdataState(roller);
- }
- break;
- case SPK.CurtainShades:
- break;
- case SPK.AcStandard:
- var ac = FunctionList.List.aCs.Find((obj) => obj.sid == updateTemp.sid);
- if (ac != null)
- {
- localObj = ac;
- foreach (var attr in updateTemp.status)
- {
- var localAttr = ac.attributes.Find((obj) => obj.key == attr.key);
- if (localAttr != null)
- {
- localAttr.curValue = attr.value;
- }
- }
- ac.lastState = "";
- switch (ac.GetAttrState(FunctionAttributeKey.Mode))
- {
- case "cool":
- ac.lastState = Language.StringByID(StringId.Cool);
- break;
- case "heat":
- ac.lastState = Language.StringByID(StringId.Heat);
- break;
- case "dry":
- ac.lastState = Language.StringByID(StringId.Dry);
- break;
- case "auto":
- ac.lastState = Language.StringByID(StringId.Auto);
- break;
- case "fan":
- ac.lastState = Language.StringByID(StringId.AirSupply);
- break;
- }
- switch (ac.GetAttrState(FunctionAttributeKey.FanSpeed))
- {
- case "high":
- ac.lastState += " " + Language.StringByID(StringId.HighWindSpeed);
- break;
- case "medium":
- ac.lastState += " " + Language.StringByID(StringId.MiddleWindSpeed);
- break;
- case "low":
- ac.lastState += " " + Language.StringByID(StringId.LowWindSpeed);
- break;
- case "auto":
- ac.lastState += " " + Language.StringByID(StringId.Auto);
- break;
- }
- ac.lastState += " " + ac.GetAttrState(FunctionAttributeKey.SetTemp) + ac.tempUnitString;
- ACPage.UpdataStates(ac);
- }
- break;
- case SPK.FloorHeatStandard:
- var fh = FunctionList.List.floorHeatings.Find((obj) => obj.sid == updateTemp.sid);
- if (fh != null)
- {
- localObj = fh;
- foreach (var attr in updateTemp.status)
- {
- var localAttr = fh.attributes.Find((obj) => obj.key == attr.key);
- if (localAttr != null)
- {
- localAttr.curValue = attr.value;
- }
- }
- switch (fh.trait_mode.curValue)
- {
- case "normal":
- fh.lastState = Language.StringByID(StringId.Normal);
- break;
- case "day":
- fh.lastState = Language.StringByID(StringId.Day);
- break;
- case "night":
- fh.lastState = Language.StringByID(StringId.Night);
- break;
- case "timer":
- fh.lastState = Language.StringByID(StringId.Auto);
- break;
- case "away":
- fh.lastState = Language.StringByID(StringId.Away);
- break;
- }
- fh.lastState += " " + fh.trait_temp.curValue + fh.tempUnitString;
- FloorHeatingPage.UpdataStates(fh);
- }
- break;
- case SPK.SensorPm25:
- case SPK.SensorCO2:
- case SPK.SensorTVOC:
- case SPK.SensorTemperature:
- case SPK.SensorHumidity:
- var sensor = FunctionList.List.sensorsEnvironmentalScience.Find((obj) => obj.sid == updateTemp.sid);
- if (sensor != null)
- {
- localObj = sensor;
- foreach (var attr in updateTemp.status)
- {
- var localAttr = sensor.attributes.Find((obj) => obj.key == attr.key);
- if (localAttr != null)
- {
- localAttr.curValue = attr.value;
- }
- }
- EnvironmentalSciencePage.LoadEvent_UpdataStatus(sensor);
- }
- break;
- case SPK.ElectricSocket:
- var es = FunctionList.List.switchSockets.Find((obj) => obj.sid == updateTemp.sid);
- if (es != null)
- {
- localObj = es;
- foreach (var attr in updateTemp.status)
- {
- var localAttr = es.attributes.Find((obj) => obj.key == attr.key);
- if (localAttr != null)
- {
- localAttr.curValue = attr.value;
- }
- }
- SocketPage.UpdataState(es);
- }
- break;
- case SPK.ElectricTV:
- break;
- case SPK.ElectricTuyaAirCleaner:
- case SPK.ElectricTuyaFan:
- case SPK.ElectricTuyaWeepRobot:
- case SPK.ElectricTuyaWaterValve:
- case SPK.SensorPir:
- case SPK.SensorDoorWindow:
- case SPK.SensorSmoke:
- case SPK.SensorWater:
- case SPK.ClothesHanger:
- case SPK.IrAC:
- //璁惧鐘舵�佹帹閫�
- Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid,updateTemp.status);
- break;
- }
- if (localObj != null)
- {
- HomePage.UpdataFunctionStates(localObj);
- RoomPage.UpdataStates(localObj);
- FunctionPage.UpdataStates(localObj);
- ClassificationPage.UpdataInfo(localObj);
- }
+ SocketPage.UpdataState(es);
+ }
+ break;
+ case SPK.ElectricTV:
+ break;
+ case SPK.ElectricTuyaAirCleaner:
+ case SPK.ElectricTuyaFan:
+ case SPK.ElectricTuyaWeepRobot:
+ case SPK.ElectricTuyaWaterValve:
+ case SPK.SensorPir:
+ case SPK.SensorDoorWindow:
+ case SPK.SensorSmoke:
+ case SPK.SensorWater:
+ case SPK.ClothesHanger:
+ case SPK.IrAC:
+ //璁惧鐘舵�佹帹閫�
+ Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid, updateTemp.status);
+ break;
}
+
+ HomePage.UpdataFunctionStates(localFunction);
+ RoomPage.UpdataStates(localFunction);
+ FunctionPage.UpdataStates(localFunction);
+ ClassificationPage.UpdataInfo(localFunction);
+
}
catch (Exception ex)
{
diff --git a/HDL_ON/DAL/DriverLayer/Control_Udp.cs b/HDL_ON/DAL/DriverLayer/Control_Udp.cs
index 456591d..d4762a2 100644
--- a/HDL_ON/DAL/DriverLayer/Control_Udp.cs
+++ b/HDL_ON/DAL/DriverLayer/Control_Udp.cs
@@ -188,47 +188,75 @@
}
break;
case SPK.AcStandard:
- AC tempAc = new AC();
+ AC acTemp = new AC();
+ byte onoff = 0;
+ byte mode = 0;
+ byte fan = 0;
foreach (var attr in f.status)
{
byte modeKey = 4;
switch (attr.key)
{
case FunctionAttributeKey.OnOff:
- tempAc.trait_on_off.curValue = attr.value;
+ if(attr.value == "on")
+ {
+ onoff = 1;
+ }
+ else
+ {
+ onoff = 0;
+ }
break;
case FunctionAttributeKey.Mode:
- tempAc.SetAttrState(FunctionAttributeKey.Mode, attr.value);
- break;
- case FunctionAttributeKey.FanSpeed:
- tempAc.SetAttrState(FunctionAttributeKey.FanSpeed, attr.value);
- break;
- case FunctionAttributeKey.SetTemp:
- tempAc.SetAttrState(FunctionAttributeKey.SetTemp, attr.value);
- switch (tempAc.curModeIndex())
+ switch (attr.value)
{
- case 3:
+ case "auto":
+ mode = 3;
modeKey = 8;
break;
- case 0:
+ case "cool":
+ mode = 0;
modeKey = 4;
break;
- case 1:
+ case "heat":
+ mode = 1;
modeKey = 7;
break;
- case 4:
+ case "dry":
+ mode = 4;
modeKey = 19;
break;
- case 2:
+ case "fan":
+ mode = 2;
modeKey = 2;
break;
}
break;
+ case FunctionAttributeKey.FanSpeed:
+ switch (attr.value)
+ {
+ case "high":
+ fan = 1;
+ break;
+ case "medium":
+ fan = 2;
+ break;
+ case "low":
+ fan = 3;
+ break;
+ case "auto":
+ fan = 0;
+ break;
+ default:
+ fan = 0;
+ break;
+ }
+ break;
}
- ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { 3, tempAc.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0, f.localFunction.bus.LoopId });
- ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { 6, tempAc.curModeIndex(), f.localFunction.bus.LoopId });
- ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { 5, tempAc.curFanIndex(), f.localFunction.bus.LoopId });
- ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { modeKey, Convert.ToByte(tempAc.GetAttrState(FunctionAttributeKey.SetTemp)), f.localFunction.bus.LoopId });
+ ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { 3, onoff, f.localFunction.bus.LoopId });
+ ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { 6, mode, f.localFunction.bus.LoopId });
+ ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { 5, fan, f.localFunction.bus.LoopId });
+ ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { modeKey, modeKey, f.localFunction.bus.LoopId });
}
break;
case SPK.LightSwitch:
@@ -260,25 +288,50 @@
case SPK.LightRGB:
break;
case SPK.FloorHeatStandard:
- var tempFh = new FloorHeating();
+ byte onoff_1 = 0;
+ byte setTemp_1 = 0;
+ byte mode_1 = 0;
foreach (var attr in f.status)
{
switch (attr.key)
{
case FunctionAttributeKey.OnOff:
- tempFh.trait_on_off.curValue = attr.value;
+ if (attr.value == "on")
+ {
+ onoff_1 = 1;
+ }
+ else
+ {
+ onoff_1 = 0;
+ }
break;
case FunctionAttributeKey.SetTemp:
- tempFh.trait_temp.curValue = attr.value;
+ setTemp_1 = Convert.ToByte(attr.value);
break;
case FunctionAttributeKey.Mode:
- tempFh.trait_mode.curValue = attr.value;
+ switch (attr.value)
+ {
+ case "day":
+ mode_1 = 2;
+ break;
+ case "night":
+ mode_1 = 3;
+ break;
+ case "away":
+ mode_1 = 4;
+ break;
+ case "normal":
+ mode_1 = 1;
+ break;
+ case "timer":
+ mode_1 = 5;
+ break;
+ }
break;
}
}
- byte b1 = tempFh.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0;
ControlBytesSend(Command.SetFloorHeat, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] {
- f. localFunction.bus.LoopId, b1, 0, tempFh.curModeIndex, Convert.ToByte( tempFh.trait_temp.curValue), Convert.ToByte( tempFh.trait_temp.curValue), Convert.ToByte( tempFh.trait_temp.curValue), Convert.ToByte( tempFh.trait_temp.curValue), 0, 0 });
+ f. localFunction.bus.LoopId, onoff_1, 0, setTemp_1, mode_1, setTemp_1, setTemp_1, setTemp_1, 0, 0 });
break;
case SPK.ElectricSocket:
foreach (var attr in f.status)
@@ -350,78 +403,93 @@
switch (function.Spk_Prefix)
{
case FunctionCategory.Light:
- var light = function as Light;
- switch (light.spk)
+ switch (function.spk)
{
case SPK.LightCCT:
byte b0 = 100;//寮�鍏虫搷浣滀緷鎹畂n_off瀛楁锛屽疄闄呭紑鍏冲�间緷鎹産rightness锛屽綋on_off涓烘墦寮�锛宐rightness涓嶈兘涓�0
- if (light.trait_on_off.curValue.ToString() == "off")
+ if (function.trait_on_off.curValue.ToString() == "off")
{
b0 = 0;
}
else
{
- b0 = (byte)light.brightness == 0 ? (byte)100 : (byte)light.brightness;
+ b0 = Convert.ToByte( function.GetAttrState(FunctionAttributeKey.Brightness)) == 0 ? (byte)100 : Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Brightness));
}
var bytes0 = new byte[] { function.bus.LoopId,
b0,
- 254, 0,Convert.ToByte(light.fadeTime) ,2,
- (byte)((int)light.Attr_CCT.curValue/256),(byte)((int)light.Attr_CCT.curValue%256),
- (byte)light.BlueColor,
+ 254, 0,Convert.ToByte(function.GetAttrState(FunctionAttributeKey.FadeTime)) ,2,
+ (byte)(Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.CCT))/256),
+ (byte)(Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.CCT))%256),
+ 0,
0,0};
ControlBytesSend(Command.SetLogicLoopColor, subnetId, deviceId, bytes0, 1);
break;
case SPK.LightRGB:
byte b = 100;//寮�鍏虫搷浣滀緷鎹畂n_off瀛楁锛屽疄闄呭紑鍏冲�间緷鎹産rightness锛屽綋on_off涓烘墦寮�锛宐rightness涓嶈兘涓�0
- if (light.trait_on_off.curValue.ToString() == "off")
+ if (function.trait_on_off.curValue.ToString() == "off")
{
b = 0;
}
else
{
- b = (byte)light.brightness == 0 ? (byte)100 : (byte)light.brightness;
+ byte lightBri1 = Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Brightness));
+ if (lightBri1 == 0)
+ {
+ b = 100;
+ }
+ else
+ {
+ b = lightBri1;
+ }
}
+ var tempLight = new Light();
var bytes = new byte[] { function.bus.LoopId,
b,
- 254, 0,Convert.ToByte(light.fadeTime) ,3,
- (byte)light.RedColor,(byte)light.GreenColor,
- (byte)light.BlueColor,
+ 254, 0,Convert.ToByte(function.GetAttrState(FunctionAttributeKey.FadeTime)) ,3,
+ (byte)tempLight.GetColor(0,function),
+ (byte)tempLight.GetColor(1,function),
+ (byte)tempLight.GetColor(2,function),
0,0};
ControlBytesSend(Command.SetLogicLoopColor, subnetId, deviceId, bytes, 1);
break;
case SPK.LightDimming:
byte b1 = 100;
- if (light.trait_on_off.curValue.ToString() == "off")
+ if (function.trait_on_off.curValue.ToString() == "off")
{
b1 = 0;
}
else
{
- b1 = (byte)light.brightness == 0 ? (byte)100 : (byte)light.brightness;
+ byte lightBri = Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Brightness));
+ if (lightBri == 0)
+ {
+ b = 100;
+ }
+ else
+ {
+ b = lightBri;
+ }
}
ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] {
function.bus.LoopId,
b1,
- 0, Convert.ToByte(light.fadeTime) });
- //DimmerPage.UpdataStates(light);
+ 0, Convert.ToByte(function.GetAttrState(FunctionAttributeKey.FadeTime)) });
break;
case SPK.LightSwitch:
- ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus.LoopId, light.trait_on_off.curValue.ToString() == "on" ? (byte)100 : (byte)0, 0, 0 });
- //RelayPage.UpdataState(light);
+ ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus.LoopId, function.trait_on_off.curValue.ToString() == "on" ? (byte)100 : (byte)0, 0, 0 });
break;
}
break;
case FunctionCategory.Curtain:
- var curtain = function as Curtain;
- switch (curtain.spk)
+ switch (function.spk)
{
case SPK.CurtainSwitch:
byte b1 = 0;
- if (curtain.trait_on_off.curValue.ToString() == "stop")
+ if (function.trait_on_off.curValue.ToString() == "stop")
{
b1 = 0;
}
- else if (curtain.trait_on_off.curValue.ToString() == "on")
+ else if (function.trait_on_off.curValue.ToString() == "on")
{
b1 = 1;
}
@@ -429,37 +497,19 @@
{
b1 = 2;
}
- ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { curtain.bus.LoopId, b1 });
+ ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { function.bus.LoopId, b1 });
break;
case SPK.CurtainTrietex:
case SPK.CurtainRoller:
- //if (commandDictionary.Count > 0)
- //{
- if (curtain.trait_on_off.curValue.ToString() == "stop")
+ if (function.trait_on_off.curValue.ToString() == "stop")
{
- ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { curtain.bus.LoopId, 0 });
+ ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { function.bus.LoopId, 0 });
}
else
{
- ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { 17, Convert.ToByte(curtain.percent) });
+ ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { 17, Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Percent)) });
}
- //}
- //else
- //{
- // if (curtain.trait_on_off.value.ToString() == "stop")
- // {
- // ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { curtain.bus_Data.loopId, 0 });
- // }
- // else if (curtain.trait_on_off.value.ToString() == "on")
- // {
- // ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { 17, 100 });
- // }
- // else if (curtain.trait_on_off.value.ToString() == "off")
- // {
- // ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { 17, 0 });
- // }
- //}
break;
}
break;
@@ -467,25 +517,26 @@
switch (function.spk)
{
case SPK.AcStandard:
- var aC = function as AC;
- ControlBytesSend(Command.SetACMode, subnetId, deviceId, new byte[] { aC.bus.LoopId, (byte)aC.curTempType, 32, 32, 32, 32, 32, 0, aC.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0, aC.curModeIndex(), aC.curFanIndex(), Convert.ToByte(aC.GetAttrState(FunctionAttributeKey.SetTemp)), 0 });
- //ControlBytesSend(Command.InstructionPanelKey, aC.bus_Data.SubnetID, aC.bus_Data.DeviceID, new byte[] { 3, aC.on_off == "on" ? (byte)1 : (byte)0, aC.bus_Data.loopId });
+ var ac = new AC();
+ ControlBytesSend(Command.SetACMode, subnetId, deviceId, new byte[] { function.bus.LoopId, 0, 32, 32, 32, 32, 32, 0, function.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0,
+ ac.GetModeIndex(function),
+ ac.GetFanIndex(function), Convert.ToByte(function.GetAttrState(FunctionAttributeKey.SetTemp)), 0 });
foreach (var dic in commandDictionary)
{
switch (dic.Key)
{
- case "on_off":
- ControlBytesSend(Command.InstructionPanelKey, aC.bus.SubnetID, aC.bus.DeviceID, new byte[] { 3, aC.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0, aC.bus.LoopId });
+ case FunctionAttributeKey.OnOff:
+ ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 3, function.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0, function.bus.LoopId });
break;
case "mode":
- ControlBytesSend(Command.InstructionPanelKey, aC.bus.SubnetID, aC.bus.DeviceID, new byte[] { 6, aC.curModeIndex(), aC.bus.LoopId });
+ ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 6, ac.GetModeIndex(function), function.bus.LoopId });
break;
case "fan":
- ControlBytesSend(Command.InstructionPanelKey, aC.bus.SubnetID, aC.bus.DeviceID, new byte[] { 5, aC.curFanIndex(), aC.bus.LoopId });
+ ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 5, ac.GetFanIndex(function), function.bus.LoopId });
break;
case "temp":
byte modeKey = 4;
- switch (aC.curModeIndex())
+ switch (ac.GetModeIndex(function))
{
case 3:
modeKey = 8;
@@ -503,7 +554,8 @@
modeKey = 2;
break;
}
- ControlBytesSend(Command.InstructionPanelKey, aC.bus.SubnetID, aC.bus.DeviceID, new byte[] { modeKey, Convert.ToByte(aC.GetAttrState(FunctionAttributeKey.SetTemp)), aC.bus.LoopId });
+ ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] {
+ modeKey, Convert.ToByte(function.GetAttrState(FunctionAttributeKey.SetTemp)), function.bus.LoopId });
break;
default:
MainPage.Log($"鍔熻兘鏈敮鎸� : {dic.Key}");
@@ -515,38 +567,48 @@
}
break;
case FunctionCategory.FloorHeat:
- switch (function.spk) {
+ var fhTemp = new FloorHeating();
+ switch (function.spk)
+ {
case SPK.FloorHeatStandard:
- var fh = function as FloorHeating;
- if (fh.modeTemp.Count == 4)
+ if (function.Fh_Mode_Temp.Count == 4)
{
- byte b1 = fh.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0;
- if (fh.workMode > 0)
+ var onoffString = function.trait_on_off.curValue.ToString();
+ byte b1 = 1;
+ if(onoffString == "off")
{
- b1 += (byte)(16 + fh.workMode);
+ b1 = 0;
+ }
+ var wm = fhTemp.GetWorkModeIndex(function);
+ if (wm > 0)
+ {
+ b1 += (byte)(16 + wm);
}
if (commandDictionary.ContainsKey("temp"))
{
var dicTempString = "";
commandDictionary.TryGetValue("temp", out dicTempString);
var dicTemp = Convert.ToByte(dicTempString);
- switch (fh.trait_mode.curValue)
+ var mode = function.GetAttrState(FunctionAttributeKey.Mode);
+ switch (mode)
{
case "day":
- fh.modeTemp["day"] = dicTemp;
+ function.Fh_Mode_Temp["day"] = dicTemp;
break;
case "night":
- fh.modeTemp["night"] = dicTemp;
+ function.Fh_Mode_Temp["night"] = dicTemp;
break;
case "away":
- fh.modeTemp["away"] = dicTemp;
+ function.Fh_Mode_Temp["away"] = dicTemp;
break;
case "normal":
- fh.modeTemp["normal"] = dicTemp;
+ function.Fh_Mode_Temp["normal"] = dicTemp;
break;
}
}
- ControlBytesSend(Command.SetFloorHeat, subnetId, deviceId, new byte[] { fh.bus.LoopId, b1, (byte)fh.curTempType, fh.curModeIndex, fh.modeTemp["normal"], fh.modeTemp["day"], fh.modeTemp["night"], fh.modeTemp["away"], 0, 0 });
+ var tt = fhTemp.GetTempUintIndex(function);
+ ControlBytesSend(Command.SetFloorHeat, subnetId, deviceId, new byte[] { function.bus.LoopId, b1,
+ (byte)tt,fhTemp.GetModeIndex(function), function.Fh_Mode_Temp["normal"], function.Fh_Mode_Temp["day"], function.Fh_Mode_Temp["night"], function.Fh_Mode_Temp["away"], 0, 0 });
}
break;
}
@@ -555,18 +617,16 @@
switch (function.spk)
{
case SPK.ElectricFan:
- var fan = function as Fan;
- if (fan.trait_on_off.curValue.ToString() == "on")
+ if (function.trait_on_off.curValue.ToString() == "on")
{
- ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { fan.bus.LoopId, (byte)fan.openLevel });
+ ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus.LoopId, Convert.ToByte(function.GetAttrState(FunctionAttributeKey.OpenLevel)) });
}
{
- ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { fan.bus.LoopId, 0 });
+ ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus.LoopId, 0 });
}
break;
case SPK.ElectricSocket:
- var s = function as SwitchSocket;
- ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { s.bus.LoopId, s.trait_on_off.curValue.ToString() == "on" ? (byte)100 : (byte)0 });
+ ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus.LoopId, function.trait_on_off.curValue.ToString() == "on" ? (byte)100 : (byte)0 });
break;
}
break;
@@ -642,17 +702,14 @@
switch (function.spk)
{
case SPK.ElectricFan:
- var fan = function as Fan;
- ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { fan.bus.LoopId });
+ ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus.LoopId });
break;
case SPK.ElectricSocket:
- var s = function as SwitchSocket;
- ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { s.bus.LoopId });
+ ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus.LoopId });
break;
}
break;
case FunctionCategory.Sensor:
- var sensor = function as Sensor;
byte sensorType = 0;
switch (function.spk)
{
@@ -672,7 +729,7 @@
sensorType = 7;
break;
}
- ControlBytesSend(Command.ReadDeviceLoopInfo, subnetId, deviceId, new byte[] { 5, sensorType, sensor.bus.LoopId });
+ ControlBytesSend(Command.ReadDeviceLoopInfo, subnetId, deviceId, new byte[] { 5, sensorType, function.bus.LoopId });
break;
}
}
diff --git a/HDL_ON/DAL/DriverLayer/Packet.cs b/HDL_ON/DAL/DriverLayer/Packet.cs
index 323b918..1535a92 100644
--- a/HDL_ON/DAL/DriverLayer/Packet.cs
+++ b/HDL_ON/DAL/DriverLayer/Packet.cs
@@ -124,8 +124,8 @@
{
case Command.SetSingleLightACK:
var queryList = new List<Function>();
- queryList.AddRange(FunctionList.List.electricals);
- queryList.AddRange(FunctionList.List.lights);
+ queryList.AddRange(FunctionList.List.GetElectricals());
+ queryList.AddRange(FunctionList.List.GetLightList());
foreach (var updataObj in queryList)
{
if (updataObj.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
@@ -138,11 +138,11 @@
switch (updataObj.spk)
{
case SPK.ElectricFan:
- (updataObj as Fan).openLevel = receiveBytes[2];
+ updataObj.SetAttrState(FunctionAttributeKey.OpenLevel, receiveBytes[2].ToString());
updataObj.lastState = Language.StringByID(StringId.Level) + " : " + receiveBytes[2];
break;
case SPK.LightDimming:
- (updataObj as Light).brightness = receiveBytes[2];
+ updataObj.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[2].ToString());
updataObj.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[2] + "%";
break;
}
@@ -154,13 +154,13 @@
switch (updataObj.spk)
{
case SPK.LightSwitch:
- RelayPage.UpdataState(updataObj as Light);
+ RelayPage.UpdataState(updataObj);
break;
case SPK.LightDimming:
- DimmerPage.UpdataStates(updataObj as Light);
+ DimmerPage.UpdataStates(updataObj);
break;
case SPK.ElectricFan:
- FanPage.UpdataState(updataObj as Fan);
+ FanPage.UpdataState(updataObj);
break;
}
break;
@@ -171,7 +171,7 @@
case Command.ReadLightAllLoopBrightnessACK:
for (int i = 0; i < receiveBytes[0]; i++)
{
- var light = FunctionList.List.lights.Find((obj) => obj.bus.SubnetID == subnetID && obj.bus.DeviceID == deviceID && obj.bus.LoopId == (i + 1));
+ var light = FunctionList.List.GetLightList().Find((obj) => obj.bus.SubnetID == subnetID && obj.bus.DeviceID == deviceID && obj.bus.LoopId == (i + 1));
if (light != null)
{
if (light.spk != SPK.LightRGB)
@@ -179,7 +179,7 @@
light.trait_on_off.curValue = receiveBytes[light.bus.LoopId] == 0 ? "off" : "on";
if (light.trait_on_off.curValue.ToString() == "on")
{
- light.brightness = receiveBytes[2];
+ light.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[2].ToString());
light.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[2] + "%";
}
HomePage.UpdataFunctionStates(light);
@@ -199,27 +199,26 @@
}
else
{
- var e = FunctionList.List.electricals.Find((obj) => obj.bus.SubnetID == subnetID && obj.bus.DeviceID == deviceID && obj.bus.LoopId == i);
- if (e != null)
+ var function = FunctionList.List.GetElectricals().Find((obj) => obj.bus.SubnetID == subnetID && obj.bus.DeviceID == deviceID && obj.bus.LoopId == i);
+ if (function != null)
{
- var fan = e as Fan;
- fan.trait_on_off.curValue = receiveBytes[2] == 0 ? "off" : "on";
- if (fan.trait_on_off.curValue.ToString() == "on")
+ function.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[2] == 0 ? "off" : "on");
+ if (function.trait_on_off.curValue.ToString() == "on")
{
- fan.openLevel = receiveBytes[2];
- fan.lastState = Language.StringByID(StringId.Level) + " : " + receiveBytes[2];
+ function.SetAttrState(FunctionAttributeKey.OpenLevel, receiveBytes[2].ToString());
+ function.lastState = Language.StringByID(StringId.Level) + " : " + receiveBytes[2];
}
- HomePage.UpdataFunctionStates(fan);
- RoomPage.UpdataStates(fan);
- FunctionPage.UpdataStates(fan);
- ClassificationPage.UpdataInfo(fan);
- switch (fan.spk)
+ HomePage.UpdataFunctionStates(function);
+ RoomPage.UpdataStates(function);
+ FunctionPage.UpdataStates(function);
+ ClassificationPage.UpdataInfo(function);
+ switch (function.spk)
{
case SPK.ElectricFan:
- FanPage.UpdataState(fan);
+ FanPage.UpdataState(function);
break;
case SPK.ElectricSocket:
-
+ SocketPage.UpdataState(function);
break;
}
}
@@ -228,7 +227,7 @@
break;
case Command.SetLogicLoopColorACK:
case Command.ReadLogicLoopColorACK:
- foreach (var rgb in FunctionList.List.lights)
+ foreach (var rgb in FunctionList.List.GetLightList())
{
if (rgb.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
{
@@ -237,10 +236,10 @@
rgb.trait_on_off.curValue = receiveBytes[1] > 0 ? "on" : "off";
if (receiveBytes[1] > 0)
{
- rgb.brightness = receiveBytes[1];
+ rgb.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[1].ToString());
rgb.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[1] + "%";
}
- rgb.SetRGBcolor(new byte[] { receiveBytes[6], receiveBytes[7], receiveBytes[8] });
+ new Light().SetRGBcolor(new byte[] { receiveBytes[6], receiveBytes[7], receiveBytes[8] }, rgb);
HomePage.UpdataFunctionStates(rgb);
RoomPage.UpdataStates(rgb);
@@ -253,7 +252,7 @@
break;
case Command.SetCurtainModelStutasACK:
case Command.ReadCurtainStutasACK:
- foreach (var curtain in FunctionList.List.curtains)
+ foreach (var curtain in FunctionList.List.GetCurtainList())
{
if (curtain.bus.SubnetID == subnetID && curtain.bus.DeviceID == deviceID)
{
@@ -267,8 +266,8 @@
{
curtain.trait_on_off.curValue = "off";
}
- curtain.percent = receiveBytes[1];
- curtain.lastState = Language.StringByID(StringId.Open) + curtain.percent + "%";
+ curtain.SetAttrState(FunctionAttributeKey.Percent, receiveBytes[1].ToString());
+ curtain.lastState = Language.StringByID(StringId.Open) + curtain.GetAttrState(FunctionAttributeKey.Percent) + "%";
}
else
{
@@ -310,149 +309,157 @@
break;
case Command.SetACModeACK:
case Command.ReadACModeACK:
- foreach (var ac in FunctionList.List.aCs)
+ foreach (var function in FunctionList.List.GetAcList())
{
- if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
+ var acFunction = new AC();
+ if (function.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
{
- ac.curTempType = receiveBytes[1];
- ac.SetAttrState(FunctionAttributeKey.IndoorTemp, receiveBytes[2].ToString());
- ac.trait_on_off.curValue = receiveBytes[8] == 1 ? "on" : "off";
- ac.SetModeIndex(receiveBytes[9]);
- ac.SetFanIndex(receiveBytes[10]);
- ac.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[11].ToString());
- ac.lastState = "";
- switch (ac.GetAttrState(FunctionAttributeKey.Mode))
+ function.SetAttrState(FunctionAttributeKey.TempType, receiveBytes[1].ToString());
+ function.SetAttrState(FunctionAttributeKey.IndoorTemp, receiveBytes[2].ToString());
+ function.trait_on_off.curValue = receiveBytes[8] == 1 ? "on" : "off";
+ acFunction.SetMode(receiveBytes[9],function);
+ acFunction.SetFan(receiveBytes[10],function);
+ function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[11].ToString());
+ function.lastState = "";
+ switch (function.GetAttrState(FunctionAttributeKey.Mode))
{
case "cool":
- ac.lastState = Language.StringByID(StringId.Cool);
+ function.lastState = Language.StringByID(StringId.Cool);
break;
case "heat":
- ac.lastState = Language.StringByID(StringId.Heat);
+ function.lastState = Language.StringByID(StringId.Heat);
break;
case "dry":
- ac.lastState = Language.StringByID(StringId.Dry);
+ function.lastState = Language.StringByID(StringId.Dry);
break;
case "auto":
- ac.lastState = Language.StringByID(StringId.Auto);
+ function.lastState = Language.StringByID(StringId.Auto);
break;
case "fan":
- ac.lastState = Language.StringByID(StringId.AirSupply);
+ function.lastState = Language.StringByID(StringId.AirSupply);
break;
}
- switch (ac.GetAttrState(FunctionAttributeKey.FanSpeed))
+ switch (function.GetAttrState(FunctionAttributeKey.FanSpeed))
{
case "high":
- ac.lastState += " " + Language.StringByID(StringId.HighWindSpeed);
+ function.lastState += " " + Language.StringByID(StringId.HighWindSpeed);
break;
case "medium":
- ac.lastState += " " + Language.StringByID(StringId.MiddleWindSpeed);
+ function.lastState += " " + Language.StringByID(StringId.MiddleWindSpeed);
break;
case "low":
- ac.lastState += " " + Language.StringByID(StringId.LowWindSpeed);
+ function.lastState += " " + Language.StringByID(StringId.LowWindSpeed);
break;
case "auto":
- ac.lastState += " " + Language.StringByID(StringId.Auto);
+ function.lastState += " " + Language.StringByID(StringId.Auto);
break;
}
- ac.lastState += " " + ac.GetAttrState(FunctionAttributeKey.SetTemp) + ac.tempUnitString;
- RoomPage.UpdataStates(ac);
- FunctionPage.UpdataStates(ac);
- HomePage.UpdataFunctionStates(ac);
- ClassificationPage.UpdataInfo(ac);
- ACPage.UpdataStates(ac);
+ function.lastState += " " + function.GetAttrState(FunctionAttributeKey.SetTemp) + acFunction.GetTempUnitString(function);
+ RoomPage.UpdataStates(function);
+ FunctionPage.UpdataStates(function);
+ HomePage.UpdataFunctionStates(function);
+ ClassificationPage.UpdataInfo(function);
+ ACPage.UpdataStates(function);
}
}
break;
case Command.ReadFloorHeatACK:
case Command.SetFloorHeatACK:
- foreach (var fh in FunctionList.List.floorHeatings)
+ foreach (var function in FunctionList.List.GetFloorHeatingList())
{
- if (fh.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
+ if (function.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
{
- fh.curTempType = receiveBytes[2];
- fh.trait_on_off.curValue = receiveBytes[1] % 2 == 0 ? "off" : "on";
- fh.curModeIndex = receiveBytes[3];
- if (fh.modeTemp.ContainsKey("normal"))
+ function.SetAttrState(FunctionAttributeKey.TempType, receiveBytes[2]);
+ function.trait_on_off.curValue = receiveBytes[1] % 2 == 0 ? "off" : "on";
+ new FloorHeating().SetModeIndex(receiveBytes[3],function);
+
+ if (function.Fh_Mode_Temp.ContainsKey("normal"))
{
- fh.modeTemp["normal"] = receiveBytes[4];
+ function.Fh_Mode_Temp["normal"] = receiveBytes[4];
}
else
{
- fh.modeTemp.Add("normal", receiveBytes[4]);
+ function.Fh_Mode_Temp.Add("normal", receiveBytes[4]);
}
- if (fh.modeTemp.ContainsKey("day"))
+ if (function.Fh_Mode_Temp.ContainsKey("day"))
{
- fh.modeTemp["day"] = receiveBytes[5];
+ function.Fh_Mode_Temp["day"] = receiveBytes[5];
}
else
{
- fh.modeTemp.Add("day", receiveBytes[5]);
+ function.Fh_Mode_Temp.Add("day", receiveBytes[5]);
}
- if (fh.modeTemp.ContainsKey("night"))
+ if (function.Fh_Mode_Temp.ContainsKey("night"))
{
- fh.modeTemp["night"] = receiveBytes[6];
+ function.Fh_Mode_Temp["night"] = receiveBytes[6];
}
else
{
- fh.modeTemp.Add("night", receiveBytes[6]);
+ function.Fh_Mode_Temp.Add("night", receiveBytes[6]);
}
- if (fh.modeTemp.ContainsKey("away"))
+ if (function.Fh_Mode_Temp.ContainsKey("away"))
{
- fh.modeTemp["away"] = receiveBytes[7];
+ function.Fh_Mode_Temp["away"] = receiveBytes[7];
}
else
{
- fh.modeTemp.Add("away", receiveBytes[7]);
+ function.Fh_Mode_Temp.Add("away", receiveBytes[7]);
}
- switch (fh.trait_mode.curValue)
+ switch (function.GetAttrState(FunctionAttributeKey.Mode))
{
case "normal":
- fh.lastState = Language.StringByID(StringId.Normal);
- fh.trait_temp.curValue = receiveBytes[4].ToString();
+ function.lastState = Language.StringByID(StringId.Normal);
+ function.SetAttrState(FunctionAttributeKey.SetTemp,receiveBytes[4].ToString());
break;
case "day":
- fh.lastState = Language.StringByID(StringId.Day);
- fh.trait_temp.curValue = receiveBytes[5].ToString();
+ function.lastState = Language.StringByID(StringId.Day);
+ function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[5].ToString());
break;
case "night":
- fh.lastState = Language.StringByID(StringId.Night);
- fh.trait_temp.curValue = receiveBytes[6].ToString();
+ function.lastState = Language.StringByID(StringId.Night);
+ function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[6].ToString());
break;
case "timer":
- fh.lastState = Language.StringByID(StringId.Auto);
+ function.lastState = Language.StringByID(StringId.Auto);
if (receiveBytes[8] == 0)
{
- fh.timeFlag = 0;
- fh.trait_temp.curValue = receiveBytes[5].ToString();
+ function.SetAttrState(FunctionAttributeKey.TimeFlag, 0);
+ function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[5].ToString());
}
else
{
- fh.timeFlag = 1;
- fh.trait_temp.curValue = receiveBytes[6].ToString();
+ function.SetAttrState(FunctionAttributeKey.TimeFlag, 1);
+ function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[6].ToString());
}
break;
case "away":
- fh.trait_temp.curValue = receiveBytes[7].ToString();
- fh.lastState = Language.StringByID(StringId.Away);
+ function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[7].ToString());
+ function.lastState = Language.StringByID(StringId.Away);
break;
}
+ var indoorTemp = 0;
+ if (receiveBytes[9] > 128)
+ {
+ indoorTemp = 1 - (receiveBytes[9] - 128);
+ }else
+ {
+ indoorTemp = receiveBytes[9];
+ }
+ function.SetAttrState(FunctionAttributeKey.IndoorTemp, indoorTemp);
- fh.trait_IndoorTemp.curValue = receiveBytes[9] > 128 ? (1 - (receiveBytes[9] - 128)) : receiveBytes[9];
-
- fh.lastState += " " + fh.trait_temp.curValue + fh.tempUnitString;
- RoomPage.UpdataStates(fh);
- FunctionPage.UpdataStates(fh);
- HomePage.UpdataFunctionStates(fh);
- ClassificationPage.UpdataInfo(fh);
- FloorHeatingPage.UpdataStates(fh);
+ function.lastState += " " + function.GetAttrState(FunctionAttributeKey.Mode) + new FloorHeating().GetTempUnitString(function);
+ RoomPage.UpdataStates(function);
+ FunctionPage.UpdataStates(function);
+ HomePage.UpdataFunctionStates(function);
+ ClassificationPage.UpdataInfo(function);
+ FloorHeatingPage.UpdataStates(function);
}
}
break;
case Command.ReadDeviceLoopInfoACK:
- //FunctionType dt = (FunctionType)(11 * 256 + receiveBytes[1]);
string tag = receiveBytes[1] + "_" + subnetID + "_" + deviceID + "_" + receiveBytes[2];
- foreach (var sensor in FunctionList.List.sensorsEnvironmentalScience)
+ foreach (var sensor in FunctionList.List.GetEnvirSensorsList())
{
byte sensorType = 0;
switch (sensor.spk)
@@ -482,19 +489,19 @@
{
case SPK.SensorTemperature:
byte[] tempBytes = new byte[] { receiveBytes[24], receiveBytes[25], receiveBytes[26], receiveBytes[27] };
- sensor.values = Math.Round(BitConverter.ToSingle(tempBytes, 0), 1);
+ sensor.SetAttrState(FunctionAttributeKey.Value,Math.Round(BitConverter.ToSingle(tempBytes, 0), 1).ToString());
break;
case SPK.SensorHumidity:
- sensor.values = Convert.ToDouble(receiveBytes[24] * 256 + receiveBytes[25]) / 10;
+ sensor.SetAttrState(FunctionAttributeKey.Value, (Convert.ToDouble(receiveBytes[24] * 256 + receiveBytes[25]) / 10).ToString());
break;
case SPK.SensorTVOC:
- sensor.values = Convert.ToDouble(receiveBytes[24] * 256 + receiveBytes[25]) / 100;
+ sensor.SetAttrState(FunctionAttributeKey.Value, (Convert.ToDouble(receiveBytes[24] * 256 + receiveBytes[25]) / 100).ToString());
break;
case SPK.SensorPm25:
- sensor.values = Convert.ToInt32(receiveBytes[24] * 256 + receiveBytes[25]);
+ sensor.SetAttrState(FunctionAttributeKey.Value,Convert.ToInt32(receiveBytes[24] * 256 + receiveBytes[25]).ToString());
break;
case SPK.SensorCO2:
- sensor.values = Convert.ToInt32(receiveBytes[24] * 256 + receiveBytes[25]);
+ sensor.SetAttrState(FunctionAttributeKey.Value, Convert.ToInt32(receiveBytes[24] * 256 + receiveBytes[25]).ToString());
break;
}
EnvironmentalSciencePage.LoadEvent_UpdataStatus(sensor);
@@ -504,7 +511,7 @@
break;
case Command.New_Analog_Quantity_BROADCAST:
string tag1 = receiveBytes[1] + "_" + subnetID + "_" + deviceID + "_" + receiveBytes[2];
- foreach (var sensor in FunctionList.List.sensorsEnvironmentalScience)
+ foreach (var sensor in FunctionList.List.GetEnvirSensorsList())
{
byte sensorType = 0;
switch (sensor.spk)
@@ -534,21 +541,24 @@
switch (receiveBytes[3])
{
case 1:
- sensor.values = (receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8];
+ sensor.SetAttrState(FunctionAttributeKey.Value,( (receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8]).ToString());
break;
case 2:
- sensor.values = -1 * ((receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8]);
+ sensor.SetAttrState(FunctionAttributeKey.Value,( -1 * ((receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8])).ToString());
break;
case 3:
byte[] tempBytes = new byte[] { receiveBytes[5], receiveBytes[6], receiveBytes[7], receiveBytes[8] };
- sensor.values = Math.Round(BitConverter.ToSingle(tempBytes, 0), 1);
+ sensor.SetAttrState(FunctionAttributeKey.Value,( Math.Round(BitConverter.ToSingle(tempBytes, 0), 1)).ToString());
break;
}
switch (receiveBytes[4])
{
case 2:
if (receiveBytes[1] == 5)//TVOC闇�姹傞櫎浠�100000
- sensor.values /= 100000;
+ {
+ var value = Convert.ToInt32(sensor.GetAttrState(FunctionAttributeKey.Value));
+ sensor.SetAttrState(FunctionAttributeKey.Value, (value /= 100000).ToString());
+ }
break;
}
EnvironmentalSciencePage.LoadEvent_UpdataStatus(sensor);
@@ -571,42 +581,43 @@
{
break;
}
- foreach (var ac in FunctionList.List.aCs)
+ foreach (var function in FunctionList.List.GetAcList())
{
- if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + reACPanel)
+ var acFunction = new AC();
+ if (function.GetBusId() == subnetID + "_" + deviceID + "_" + reACPanel)
{
switch (receiveBytes[0])
{
case 3://
- ac.trait_on_off.curValue = receiveBytes[1] == 1 ? "on" : "off";
+ function.trait_on_off.curValue = receiveBytes[1] == 1 ? "on" : "off";
break;
case 4:
case 7:
case 8:
case 19:
- ac.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[1].ToString());
+ function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[1].ToString());
break;
case 5:
- ac.SetFanIndex ( receiveBytes[1]);
+ acFunction.SetFan ( receiveBytes[1],function);
break;
case 6:
- ac.SetModeIndex ( receiveBytes[1]);
+ acFunction.SetMode ( receiveBytes[1],function);
break;
}
- ac.lastState = "";
- ac.lastState += " " + ac.GetAttrState(FunctionAttributeKey.SetTemp) + ac.tempUnitString;
- RoomPage.UpdataStates(ac);
- FunctionPage.UpdataStates(ac);
- HomePage.UpdataFunctionStates(ac);
- ClassificationPage.UpdataInfo(ac);
- ACPage.UpdataStates(ac);
+ function.lastState = "";
+ function.lastState += " " + function.GetAttrState(FunctionAttributeKey.SetTemp) + acFunction.GetTempUnitString(function);
+ RoomPage.UpdataStates(function);
+ FunctionPage.UpdataStates(function);
+ HomePage.UpdataFunctionStates(function);
+ ClassificationPage.UpdataInfo(function);
+ ACPage.UpdataStates(function);
}
}
break;
case Command.ReadPanleTempACK://1944
case Command.PanleBroadcastTemp:
- foreach (var ac in FunctionList.List.aCs)
+ foreach (var ac in FunctionList.List.GetAcList())
{
if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
{
diff --git a/HDL_ON/Entity/Function/AC.cs b/HDL_ON/Entity/Function/AC.cs
index 9b76ee4..e05d976 100644
--- a/HDL_ON/Entity/Function/AC.cs
+++ b/HDL_ON/Entity/Function/AC.cs
@@ -4,30 +4,55 @@
namespace HDL_ON.Entity
{
- public class AC : Function
+ public class AC
{
- /// <summary>
- /// 褰撳墠娓╁害妯″紡
- /// 0:鎽勬皬搴�
- /// 1:鍗庢皬搴�
- /// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public int curTempType = 0;
/// <summary>
/// 褰撳墠娓╁害妯″紡瀛楃
/// </summary>
- public string tempUnitString
+ public string GetTempUnitString(Function function)
{
- get
+ var tt = function.GetAttrState(FunctionAttributeKey.TempType);
+ if (tt == "0")
{
- if (curTempType == 0)
- {
- return "掳C";
- }
- else
- {
- return "掳F";
- }
+ return "掳C";
+ }
+ else
+ {
+ return tt;
+ }
+ }
+
+ /// <summary>
+ /// 鑾峰彇娓╁害鍗曚綅bus鏍囪瘑
+ /// </summary>
+ /// <param name="function"></param>
+ /// <returns></returns>
+ public int GetTempUintIndex(Function function)
+ {
+ var tt = function.GetAttrState(FunctionAttributeKey.TempType);
+ if(tt == "掳F")
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ /// <summary>
+ /// 鏍规嵁bus鏍囪瘑璁剧疆娓╁害鍗曚綅
+ /// </summary>
+ /// <param name="function"></param>
+ /// <returns></returns>
+ public void SetTempUint(Function function,int index)
+ {
+ if (index == 0)
+ {
+ function.SetAttrState(FunctionAttributeKey.TempType, "掳C");
+ }
+ else
+ {
+ function.SetAttrState(FunctionAttributeKey.TempType, "掳F");
}
}
@@ -35,46 +60,38 @@
/// 褰撳墠妯″紡绱㈠紩
/// bus鎺у埗鍛戒护浣跨敤
/// </summary>
- public byte curModeIndex()
+ public byte GetModeIndex(Function function)
{
- try
+ var value = function.GetAttrState(FunctionAttributeKey.Mode);
+ byte index = 0;
+ switch (value)
{
- string value = GetAttrState(FunctionAttributeKey.Mode);
- byte index = 0;
- switch (value)
- {
- case "auto":
- index = 3;
- break;
- case "cool":
- index = 0;
- break;
- case "heat":
- index = 1;
- break;
- case "dry":
- index = 4;
- break;
- case "fan":
- index = 2;
- break;
- default:
- index = 0;
- break;
- }
- return index;
+ case "auto":
+ index = 3;
+ break;
+ case "cool":
+ index = 0;
+ break;
+ case "heat":
+ index = 1;
+ break;
+ case "dry":
+ index = 4;
+ break;
+ case "fan":
+ index = 2;
+ break;
+ default:
+ index = 0;
+ break;
}
- catch (Exception ex)
- {
- MainPage.Log($"get curModeIndex error : {ex.Message}");
- return 0;
- }
+ return index;
}
/// <summary>
- /// 璁剧疆bus鍗忚妯″紡鏍囪
+ /// 璁剧疆bus鍗忚鏍囪璁剧疆a鍗忚鏁版嵁
/// </summary>
- public void SetModeIndex(int index)
+ public void SetMode(int index , Function function)
{
string value = "auto";
switch (index)
@@ -95,49 +112,41 @@
value = "fan";
break;
}
- SetAttrState(FunctionAttributeKey.Mode, value);
+ function.SetAttrState(FunctionAttributeKey.Mode, value);
}
/// <summary>
/// 褰撳墠椋庨�熺储寮�
/// bus鎺у埗鍛戒护浣跨敤
/// </summary>
- public byte curFanIndex()
+ public byte GetFanIndex(Function function)
{
- try
+ var value = function.GetAttrState(FunctionAttributeKey.FanSpeed);
+ byte index = 0;
+ switch (value)
{
- string value = GetAttrState(FunctionAttributeKey.FanSpeed);
- byte index = 0;
- switch (value)
- {
- case "high":
- index = 1;
- break;
- case "medium":
- index = 2;
- break;
- case "low":
- index = 3;
- break;
- case "auto":
- index = 0;
- break;
- default:
- index = 0;
- break;
- }
- return index;
+ case "high":
+ index = 1;
+ break;
+ case "medium":
+ index = 2;
+ break;
+ case "low":
+ index = 3;
+ break;
+ case "auto":
+ index = 0;
+ break;
+ default:
+ index = 0;
+ break;
}
- catch (Exception ex)
- {
- MainPage.Log($"get curFanIndex error : {ex.Message}");
- return 0;
- }
+ return index;
}
/// <summary>
- /// 璁剧疆bus鍗忚椋庨�熸爣璁�
+ /// 鏍规嵁bus鍗忚椋庨�熸爣璁拌缃產鍗忚鏍囪
/// </summary>
- public void SetFanIndex(int index)
+ public void SetFan(int index,Function function)
{
string value = "high";
switch (index)
@@ -155,195 +164,20 @@
value = "auto";
break;
}
- SetAttrState(FunctionAttributeKey.FanSpeed, value);
+ function.SetAttrState(FunctionAttributeKey.FanSpeed, value);
}
-
- /* 鍘绘帀琛嶇敓灞炴�э紝閫氳繃base.GetAttrState 鏌ユ壘灞炴�т笌鐘舵��
- FunctionAttributes _trait_mode;
- /// <summary>
- /// 妯″紡灞炴��
- /// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public FunctionAttributes trait_mode
- {
- get
- {
- if (_trait_mode == null)
- {
- _trait_mode = attributes.Find((obj) => obj.key == "mode");
- //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
- if (_trait_mode == null)
- {
- _trait_mode = new FunctionAttributes()
- {
- key = "mode",
- value = new List<string> { "auto", "cool", "heat", "dry", "fan" },
- max = 4,
- min = 0,
- };
- }
- }
- if (_trait_mode.curValue.ToString() == "{}")
- _trait_mode.curValue = "cool";
- return _trait_mode;
- }
- }
-
- FunctionAttributes _trait_fan;
- [Newtonsoft.Json.JsonIgnore]
- public FunctionAttributes trait_fan
- {
- get
- {
- if (_trait_fan == null)
- {
- _trait_fan = attributes.Find((obj) => obj.key == "fan");
- //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
- if (_trait_fan == null)
- {
- _trait_fan = new FunctionAttributes()
- {
- key = "fan",
- value = new List<string> { "high", "medium", "low", "auto" },
- max = 3,
- min = 0,
- curValue = "high"
- };
- }
- }
- if (_trait_fan.curValue.ToString() == "{}")
- _trait_fan.curValue = "high";
- return _trait_fan;
- }
- }
-
- FunctionAttributes _trait_temp;
- /// <summary>
- /// 褰撳墠绌鸿皟娓╁害
- /// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public FunctionAttributes trait_temp
- {
- get
- {
- if (_trait_temp == null)
- {
- _trait_temp = attributes.Find((obj) => obj.key == "set_temp");
- //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
- if (_trait_temp == null)
- {
- _trait_temp = new FunctionAttributes()
- {
- key = "set_temp",
- value = new List<string> { },
- max = 32,
- min = 16,
- };
- }
- }
- if (_trait_temp.curValue.ToString() == "{}")
- {
- _trait_temp.curValue = 16;
- }
- double vv = 16;
- Double.TryParse(_trait_temp.curValue.ToString(), out vv);
- _trait_temp.curValue = Convert.ToInt32(vv);
- return _trait_temp;
- }
- }
-
- FunctionAttributes _trait_swting;
- [Newtonsoft.Json.JsonIgnore]
- public FunctionAttributes trait_swting
- {
- get
- {
- if (_trait_swting == null)
- {
- _trait_swting = attributes.Find((obj) => obj.key == "swting");
- //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
- if (_trait_swting == null)
- {
- _trait_swting = new FunctionAttributes()
- {
- key = "swting",
- value = new List<string> { "up", "down", "left", "right" },
- max = 3,
- min = 0,
- };
- }
- }
- if (_trait_swting.curValue.ToString() == "{}")
- _trait_swting.curValue = "up";
- return _trait_swting;
- }
- }
- /// <summary>
- /// 绌鸿皟鎵妯″紡鍒楄〃
- /// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public List<string> swting
- {
- get
- {
- try
- {
- return trait_swting.value;
- }
- catch (Exception ex)
- {
- MainPage.Log($"ac get swting error : {ex.Message}");
- return new List<string> { "up", "down", "left", "right" };
- }
- }
- }
- FunctionAttributes _trait_IndoorTemp;
- /// <summary>
- /// 瀹ゅ唴娓╁害
- /// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public FunctionAttributes trait_IndoorTemp
- {
- get
- {
- if (_trait_IndoorTemp == null)
- {
- _trait_IndoorTemp = attributes.Find((obj) => obj.key == FunctionAttributeKey.IndoorTemp);
- //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
- if (_trait_IndoorTemp == null)
- {
- _trait_IndoorTemp = new FunctionAttributes()
- {
- key = FunctionAttributeKey.IndoorTemp,
- value = new List<string> { },
- max = 30,
- min = 0,
- };
- }
- }
- if (_trait_IndoorTemp.curValue.ToString() == "{}")
- {
- _trait_IndoorTemp.curValue = 0;
- }
- var vv = Convert.ToDouble(_trait_IndoorTemp.curValue);
- _trait_IndoorTemp.curValue = Convert.ToInt32(vv);
- return _trait_IndoorTemp;
- }
- }
- */
/// <summary>
/// 褰撳墠妯″紡鐨刬con璺緞
/// </summary>
/// <param name="lightingIcon">鑾峰彇鐨勫浘鏍囩被鍨嬶紝榛樿鏄偣浜�</param>
/// <returns></returns>
- public string GetModeIconPath(bool lightingIcon = true)
+ public string GetModeIconPath(string modeValue , bool lightingIcon = true)
{
- var value = GetAttrState(FunctionAttributeKey.Mode);
var imagePath = "FunctionIcon/AC/CoolIcon.png";
if (lightingIcon)
{
- switch (value)
+ switch (modeValue)
{
case "auto":
imagePath = "FunctionIcon/AC/AutoIcon.png";
@@ -368,7 +202,7 @@
else
{
imagePath = "FunctionIcon/AC/AutoIconGray.png";
- switch (value)
+ switch (modeValue)
{
case "auto":
imagePath = "FunctionIcon/AC/AutoIconGray.png";
@@ -395,13 +229,12 @@
/// </summary>
/// <param name="lightingIcon">鑾峰彇鐨勫浘鏍囩被鍨嬶紝榛樿鏄偣浜�</param>
/// <returns></returns>
- public string GetFanIconPath(bool lightingIcon = true)
+ public string GetFanIconPath(string modeValue, bool lightingIcon = true)
{
- string value = GetAttrState(FunctionAttributeKey.FanSpeed);
var imagePath = "FunctionIcon/AC/WindHighIcon.png";
if (lightingIcon)
{
- switch (value)
+ switch (modeValue)
{
case "high":
imagePath = "FunctionIcon/AC/WindHighIcon.png";
@@ -419,7 +252,7 @@
}
else
{
- switch (value)
+ switch (modeValue)
{
case "high":
imagePath = "FunctionIcon/AC/WindHighIconGray.png";
diff --git a/HDL_ON/Entity/Function/AirCleaner.cs b/HDL_ON/Entity/Function/AirCleaner.cs
index 5ed7559..4eb0fb6 100644
--- a/HDL_ON/Entity/Function/AirCleaner.cs
+++ b/HDL_ON/Entity/Function/AirCleaner.cs
@@ -1,7 +1,7 @@
锘縰sing System;
namespace HDL_ON.Entity
{
- public class AirCleaner : Function
+ public class AirCleaner
{
public AirCleaner()
{
diff --git a/HDL_ON/Entity/Function/Curtain.cs b/HDL_ON/Entity/Function/Curtain.cs
index ee1da9d..630b044 100644
--- a/HDL_ON/Entity/Function/Curtain.cs
+++ b/HDL_ON/Entity/Function/Curtain.cs
@@ -4,73 +4,12 @@
namespace HDL_ON.Entity
{
- public class Curtain : Function
+ public class Curtain
{
- /*
- 绐楀笜灞炴�у垪琛細trait: [switch,percent,lock]
- 灞炴�� 鎻忚堪
- on_off on/off/stop;
- percent 0-100;
- lock boolean (Lock閿佸畾鎺у埗)
- */
- public Curtain()
+ public int GetPercent(Function function)
{
- }//percent
- [Newtonsoft.Json.JsonIgnore]
- public FunctionAttributes trait_percent;
- /// <summary>
- /// 寮�鍏崇櫨鍒嗘瘮
- /// 0-100
- /// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public int percent
- {
- get
- {
- try
- {
- if(trait_percent==null)
- {
- trait_percent = attributes.Find((obj) => obj.key == "percent");
- if (trait_percent == null)
- {
- trait_percent = new FunctionAttributes()
- {
- key = "percent",
- value = new List<string> { "up", "down" },
- max = 100,
- min = 0,
- curValue = 0
- };
- }
- if (trait_percent.curValue.ToString() == "{}")
- trait_percent.curValue = 0;
- }
- string textValue = trait_percent.curValue.ToString();
- if (textValue == string.Empty)
- {
- trait_percent.curValue = 0;
- }
- return Convert.ToInt32( trait_percent.curValue);
- }
- catch
- {
- MainPage.Log("percent 鏁版嵁鑾峰彇澶辫触.");
- return 0;
- }
- }
- set
- {
- try
- {
- trait_percent.curValue = value;
- }
- catch
- {
- MainPage.Log("percent 鏁版嵁鍒锋柊澶辫触.");
- }
- }
+ return Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Percent));
}
-
+
}
}
diff --git a/HDL_ON/Entity/Function/DeviceFunction.cs b/HDL_ON/Entity/Function/DeviceFunction.cs
deleted file mode 100644
index 7638ed0..0000000
--- a/HDL_ON/Entity/Function/DeviceFunction.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-锘縰sing System;
-namespace HDL_ON.Entity
-{
- /// <summary>
- /// 璁惧鍔熻兘
- /// </summary>
- public class DeviceFunction : Function
- {
- public DeviceFunction()
- {
- }
-
-
- }
-}
diff --git a/HDL_ON/Entity/Function/Fan.cs b/HDL_ON/Entity/Function/Fan.cs
index 36108ac..ce91f65 100644
--- a/HDL_ON/Entity/Function/Fan.cs
+++ b/HDL_ON/Entity/Function/Fan.cs
@@ -3,66 +3,12 @@
namespace HDL_ON.Entity
{
- public class Fan : Function
+ public class Fan
{
public Fan()
{
}
- [Newtonsoft.Json.JsonIgnore]
- public FunctionAttributes trait_openLevel;
- /// <summary>
- /// 妗d綅
- /// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public int openLevel
- {
- get
- {
- try
- {
- if (trait_openLevel == null)
- {
- trait_openLevel = attributes.Find((obj) => obj.key == "openLevel");
- if (trait_openLevel == null)
- {
- trait_openLevel = new FunctionAttributes()
- {
- key = "openLevel",
- value = new List<string> { "up", "down" },
- max = 7,
- min = 0,
- curValue = 0
- };
- }
- if (trait_openLevel.curValue.ToString() == "{}")
- trait_openLevel.curValue = 0;
- }
- string textValue = trait_openLevel.curValue.ToString();
- if (textValue == string.Empty)
- {
- trait_openLevel.curValue = 0;
- }
- return Convert.ToInt32(trait_openLevel.curValue);
- }
- catch
- {
- MainPage.Log("openLevel 鏁版嵁鑾峰彇澶辫触.");
- return 0;
- }
- }
- set
- {
- try
- {
- trait_openLevel.curValue = value;
- }
- catch
- {
- MainPage.Log("openLevel 鏁版嵁鍒锋柊澶辫触.");
- }
- }
- }
}
}
diff --git a/HDL_ON/Entity/Function/FloorHeating.cs b/HDL_ON/Entity/Function/FloorHeating.cs
index aefe030..02aaffd 100644
--- a/HDL_ON/Entity/Function/FloorHeating.cs
+++ b/HDL_ON/Entity/Function/FloorHeating.cs
@@ -3,155 +3,144 @@
namespace HDL_ON.Entity
{
- public class FloorHeating : Function
+ public class FloorHeating
{
- /*
- *鍦扮儹锛歵rait: [switch, mode, set_temp, lock]
- *灞炴�� 鎻忚堪
- *switch on/off
- *mode day, night,away, vacation, timer
- *set_temp value
- *lock boolean(Lock閿佸畾鎺у埗)
- *set_ point up,down,value
- */
- public FloorHeating()
+ /// <summary>
+ /// 鑾峰彇娓╁害鍗曚綅bus鏍囪瘑
+ /// </summary>
+ /// <param name="function"></param>
+ /// <returns></returns>
+ public int GetTempUintIndex(Function function)
{
+ var tt = function.GetAttrState(FunctionAttributeKey.TempType);
+ if (tt == "掳F")
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
}
/// <summary>
- /// 褰撳墠娓╁害妯″紡
- /// 0:鎽勬皬搴�
- /// 1:鍗庢皬搴�
+ /// 鏍规嵁bus鏍囪瘑璁剧疆娓╁害鍗曚綅
/// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public int curTempType = 0;
+ /// <param name="function"></param>
+ /// <returns></returns>
+ public void SetTempUint(Function function, int index)
+ {
+ if (index == 0)
+ {
+ function.SetAttrState(FunctionAttributeKey.TempType, "掳C");
+ }
+ else
+ {
+ function.SetAttrState(FunctionAttributeKey.TempType, "掳F");
+ }
+ }
/// <summary>
- /// 宸ヤ綔妯″紡
+ /// 鑾峰彇bus鍗忚宸ヤ綔妯″紡index
/// 0:鍦扮儹妯″紡锛�1:鍦板喎妯″紡锛�
/// 2:鍦扮儹鍔熺巼妯″紡锛�3:鍦板喎鍔熺巼妯″紡锛�
/// </summary>
- public int workMode = 0;
- /// <summary>
- /// 褰撳墠娓╁害妯″紡瀛楃
- /// </summary>
- public string tempUnitString
+ public int GetWorkModeIndex(Function function)
{
- get
- {
- if (curTempType == 0)
- {
- return "掳C";
- }
- else
- {
- return "掳F";
- }
- }
- }
- FunctionAttributes _trait_mode;
- /// <summary>
- /// 妯″紡灞炴��
- /// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public FunctionAttributes trait_mode
- {
- get
- {
- if (_trait_mode == null)
- {
- _trait_mode = attributes.Find((obj) => obj.key == "mode");
- //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
- if (_trait_mode == null)
- {
- _trait_mode = new FunctionAttributes()
- {
- key = "mode",
- value = new List<string> { "day", "night", "away", "normal", "timer" },
- max = 4,
- min = 0,
- };
- }
- if(_trait_mode.curValue.ToString() == "{}")
- {
- _trait_mode.curValue = "day";
- }
- }
- return _trait_mode;
- }
+ var attr = function.GetAttrState(FunctionAttributeKey.WorkMode);
+ if (attr == "cool")
+ return 1;
+ return 0;
}
/// <summary>
- /// 宸ヤ綔妯″紡瀵瑰簲鐨勫伐浣滄俯搴�
+ /// 璁剧疆bus鍗忚宸ヤ綔妯″紡index
+ /// 0:鍦扮儹妯″紡锛�1:鍦板喎妯″紡锛�
+ /// 2:鍦扮儹鍔熺巼妯″紡锛�3:鍦板喎鍔熺巼妯″紡锛�
/// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public Dictionary<string, byte> modeTemp = new Dictionary<string, byte>();
+ public void SetWorkModeIndex(Function function, int index)
+ {
+ if (index == 1)
+ function.SetAttrState(FunctionAttributeKey.WorkMode, "cool");
+ else
+ function.SetAttrState(FunctionAttributeKey.WorkMode, "heat");
+ }
/// <summary>
- /// 褰撳墠妯″紡绱㈠紩
- /// bus鎺у埗鍛戒护浣跨敤
+ /// 鑾峰彇娓╁害妯″紡瀛楃
/// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public byte curModeIndex
+ public string GetTempUnitString(Function function)
{
- get
+ var tt = function.GetAttrState(FunctionAttributeKey.TempType);
+ if (tt == "0")
{
- try
- {
- byte index = 0;
- switch (trait_mode.curValue.ToString())
- {
- case "day":
- index = 2;
- break;
- case "night":
- index = 3;
- break;
- case "away":
- index = 4;
- break;
- case "normal":
- index = 1;
- break;
- case "timer":
- index = 5;
- break;
- default:
- index = 0;
- break;
- }
- return index;
- }
- catch (Exception ex)
- {
- MainPage.Log($"get curModeIndex error : {ex.Message}");
- return 0;
- }
+ return "掳C";
}
- set
+ else
{
- switch (value)
- {
- case 5:
- trait_mode.curValue = "timer";
- break;
- case 1:
- trait_mode.curValue = "normal";
- break;
- case 2:
- trait_mode.curValue = "day";
- break;
- case 3:
- trait_mode.curValue = "night";
- break;
- case 4:
- trait_mode.curValue = "away";
- break;
- default:
- trait_mode.curValue = "cool";
- break;
+ return tt;
+ }
+ }
- }
+
+
+ /// <summary>
+ /// 鑾峰彇bus鍗忚妯″紡绱㈠紩
+ /// </summary>
+ public byte GetModeIndex(Function function)
+ {
+ byte index = 0;
+ var mode = function.GetAttrState(FunctionAttributeKey.Mode);
+ switch (mode)
+ {
+ case "day":
+ index = 2;
+ break;
+ case "night":
+ index = 3;
+ break;
+ case "away":
+ index = 4;
+ break;
+ case "normal":
+ index = 1;
+ break;
+ case "timer":
+ index = 5;
+ break;
+ default:
+ index = 0;
+ break;
}
+ return index;
+ }
+ /// <summary>
+ /// 璁剧疆bus鍗忚妯″紡绱㈠紩
+ /// </summary>
+ public void SetModeIndex(int value, Function function)
+ {
+ string mode = "timer";
+ switch (value)
+ {
+ case 5:
+ mode = "timer";
+ break;
+ case 1:
+ mode = "normal";
+ break;
+ case 2:
+ mode = "day";
+ break;
+ case 3:
+ mode = "night";
+ break;
+ case 4:
+ mode = "away";
+ break;
+ default:
+ mode = "cool";
+ break;
+ }
+ function.SetAttrState(FunctionAttributeKey.Mode, mode);
}
/// <summary>
@@ -160,120 +149,35 @@
/// </summary>
public byte timeFlag = 0;
- FunctionAttributes _trait_IndoorTemp;
/// <summary>
- /// 瀹ゅ唴娓╁害
+ /// 鑾峰彇妯″紡鐨刬con璺緞
/// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public FunctionAttributes trait_IndoorTemp
+ public string GetModeImage(Function function)
{
- get
+ var imagePath = "FunctionIcon/AC/HeatingIcon.png";
+ var key = function.GetAttrState(FunctionAttributeKey.Mode);
+ switch (key)
{
- if (_trait_IndoorTemp == null)
- {
- _trait_IndoorTemp = attributes.Find((obj) => obj.key == FunctionAttributeKey.IndoorTemp);
- //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
- if (_trait_IndoorTemp == null)
- {
- _trait_IndoorTemp = new FunctionAttributes()
- {
- key = FunctionAttributeKey.IndoorTemp,
- value = new List<string> { },
- max = 30,
- min = 0,
- };
-
- }
- }
- if (_trait_IndoorTemp.curValue.ToString() == "{}")
- {
- _trait_IndoorTemp.curValue = "0";
- }
- var vv = Convert.ToDouble(_trait_IndoorTemp.curValue);
- _trait_IndoorTemp.curValue = Convert.ToInt32(vv).ToString();
- return _trait_IndoorTemp;
+ case "day":
+ imagePath = "FunctionIcon/AC/HeatingIcon.png";
+ break;
+ case "night":
+ imagePath = "FunctionIcon/FloorHeating/NightIcon.png";
+ break;
+ case "away":
+ imagePath = "FunctionIcon/FloorHeating/AwayIcon.png";
+ break;
+ case "timer":
+ imagePath = "FunctionIcon/AC/AutoIcon.png";
+ break;
+ case "normal":
+ imagePath = "FunctionIcon/FloorHeating/OrdinaryIcon.png";
+ break;
+ default:
+ imagePath = "FunctionIcon/AC/HeatingIcon.png";
+ break;
}
+ return imagePath;
}
-
-
- FunctionAttributes _trait_temp;
- /// <summary>
- /// 褰撳墠娓╁害
- /// </summary>/// <summary>
- /// 褰撳墠绌鸿皟娓╁害
- /// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public FunctionAttributes trait_temp
- {
- get
- {
- if (_trait_temp == null)
- {
- _trait_temp = attributes.Find((obj) => obj.key == "set_temp");
- //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
- if (_trait_temp == null)
- {
- _trait_temp = new FunctionAttributes()
- {
- key = "set_temp",
- value = new List<string> { },
- max = 30,
- min = 5,
- };
- }
- if(_trait_temp.curValue.ToString() == "{}")
- _trait_temp.curValue = "16";
- }
- //if (_trait_temp.curValue.ToString().Length > 3)
- {
- double vv = 0;
- Double.TryParse(_trait_temp.curValue.ToString(),out vv);
- _trait_temp.curValue = Convert.ToInt32(vv).ToString();
- }
- return _trait_temp;
- }
- }
- /// <summary>
- /// 褰撳墠妯″紡鐨刬con璺緞
- /// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public string curModeImage
- {
- get
- {
- try
- {
- var imagePath = "FunctionIcon/AC/HeatingIcon.png";
- switch (trait_mode.curValue)
- {
- case "day":
- imagePath = "FunctionIcon/AC/HeatingIcon.png";
- break;
- case "night":
- imagePath = "FunctionIcon/FloorHeating/NightIcon.png";
- break;
- case "away":
- imagePath = "FunctionIcon/FloorHeating/AwayIcon.png";
- break;
- case "timer":
- imagePath = "FunctionIcon/AC/AutoIcon.png";
- break;
- case "normal":
- imagePath = "FunctionIcon/FloorHeating/OrdinaryIcon.png";
- break;
- default:
- imagePath = "FunctionIcon/AC/HeatingIcon.png";
- break;
- }
- return imagePath;
- }
- catch (Exception ex)
- {
- MainPage.Log($"ac ge curModeImage error : {ex.Message}");
- return "FunctionIcon/AC/CoolIcon.png";
- }
- }
- }
-
}
}
diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs
index 2eca3c6..8bd7fe7 100644
--- a/HDL_ON/Entity/Function/Function.cs
+++ b/HDL_ON/Entity/Function/Function.cs
@@ -79,7 +79,7 @@
return attrs;
}
/// <summary>
- /// 鑾峰彇鍒跺畾灞炴��
+ /// 鑾峰彇鎸囧畾灞炴��
/// </summary>
/// <returns></returns>
public FunctionAttributes GetAttribute(string key)
@@ -96,7 +96,7 @@
public string GetAttrState(string key)
{
var attrState = attributes.Find((s) => s.key == key.ToString());
- if(attrState == null)
+ if (attrState == null || string.IsNullOrEmpty(attrState.state))
{
return "0";
}
@@ -108,7 +108,7 @@
/// <param name="key"></param>
/// <param name="value"></param>
/// <returns>淇敼缁撴灉</returns>
- public bool SetAttrState(string key, string value)
+ public bool SetAttrState(string key, object value)
{
//var attrState = status.Find((s) => s.key == key.ToString());
var attr = attributes.Find((s) => s.key == key);
@@ -118,13 +118,28 @@
}
else
{
- attr.state = value;
+ attr.state = value.ToString();
+ attr.curValue = value.ToString();
}
return true;
}
+
+ /// <summary>
+ /// 涓婁竴娆℃墦寮�鐨勪寒搴�
+ /// 鐏厜绉佹湁灞炴��
+ /// </summary>
+ [Newtonsoft.Json.JsonIgnore]
+ public int lastBrightness = 100;
+
+ /// <summary>
+ /// 宸ヤ綔妯″紡瀵瑰簲鐨勫伐浣滄俯搴�
+ /// 鍦扮儹绉佹湁灞炴��
+ /// </summary>
+ [Newtonsoft.Json.JsonIgnore]
+ public Dictionary<string, byte> Fh_Mode_Temp = new Dictionary<string, byte>();
#endregion
@@ -263,7 +278,6 @@
public void CollectFunction()
{
var result = "";
- //var waitPage = new Loading();
new System.Threading.Thread(() =>
{
@@ -282,6 +296,12 @@
{
collect = !collect;
IMessageCommon.Current.ShowErrorInfoAlter(result);
+ });
+ }else
+ {
+ Application.RunOnMainThread(() =>
+ {
+ UI.HomePage.RefreshFunctionView();
});
}
})
@@ -672,6 +692,11 @@
/// </summary>
public const string Mode = "mode";
/// <summary>
+ /// 宸ヤ綔妯″紡
+ /// 鍦扮儹/鍦板喎/鍔熺巼鍦扮儹/鍔熺巼鍦板喎
+ /// </summary>
+ public const string WorkMode = "mode_work";
+ /// <summary>
/// 椋庨��
/// </summary>
public const string FanSpeed = "fan";
@@ -679,6 +704,16 @@
/// 璁剧疆娓╁害
/// </summary>
public const string SetTemp = "set_temp";
+ /// <summary>
+ /// 娓╁害妯″紡
+ /// 绌鸿皟銆佸湴鐑�//app鑷姞
+ /// </summary>
+ public const string TempType = "temperature_type";
+ /// <summary>
+ /// 鏃堕棿鏍囪
+ /// 鍦扮儹//app鑷姞
+ /// </summary>
+ public const string TimeFlag = "time_flag";
/// <summary>
/// 寤舵椂
/// </summary>
@@ -763,8 +798,10 @@
/// 璐熺瀛愬墿浣欐椂闂�
/// </summary>
public const string AnionTimeLeft = "anion_time_surplus";
-
-
+ /// <summary>
+ /// 鎵撳紑鐧昏(椋庢墖)
+ /// </summary>
+ public const string OpenLevel = "openLevel";
#region tuya
diff --git a/HDL_ON/Entity/Function/Light.cs b/HDL_ON/Entity/Function/Light.cs
index 0ddbb56..63d3f63 100644
--- a/HDL_ON/Entity/Function/Light.cs
+++ b/HDL_ON/Entity/Function/Light.cs
@@ -4,202 +4,24 @@
namespace HDL_ON.Entity
{
- public class Light : Function
+ public class Light
{
- [Newtonsoft.Json.JsonIgnore]
- FunctionAttributes trait_brightness;
- /// <summary>
- /// 浜害鍊�
- /// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public int brightness
- {
- get
- {
- if (trait_brightness == null)
- {
- trait_brightness = attributes.Find((obj) => obj.key == "brightness");
- //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
- if (trait_brightness == null)
- {
- trait_brightness = new FunctionAttributes()
- {
- key = "brightness",
- value = new List<string> { "up", "down" },
- max = 100,
- min = 0,
- curValue = 0,
- };
- }
- if (trait_brightness.curValue.ToString() == "{}")
- trait_brightness.curValue = 0;
- }
- try
- {
- string textValue = trait_brightness.curValue.ToString();
- if (textValue == string.Empty)
- {
- trait_brightness.curValue = 0;
- }
- return Convert.ToInt32(trait_brightness.curValue);
- }
- catch
- {
- trait_brightness.curValue = 0;
- return 0;
- }
- }
- set
- {
- try
- {
- if (trait_brightness == null)
- {
- trait_brightness = attributes.Find((obj) => obj.key == "brightness");
- //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
- if (trait_brightness == null)
- {
- trait_brightness = new FunctionAttributes()
- {
- key = "brightness",
- value = new List<string> { "up", "down" },
- max = 100,
- min = 0,
- curValue = 0
- };
- }
- }
- trait_brightness.curValue = value;
- }
- catch
- {
- MainPage.Log("brightness 鏁版嵁鍒锋柊澶辫触.");
- }
- }
- }
- /// <summary>
- /// 涓婁竴娆℃墦寮�鐨勪寒搴�
- /// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public int lastBrightness = 100;
-
- int hadFadeTime = 99;
- /// <summary>
- /// 鏄惁鎷ユ湁娓愬彉鏃堕棿
- /// </summary>
- public bool HadFadeTime
- {
- get
- {
- if (hadFadeTime == 99)
- {
- var t = attributes.Find((obj) => obj.key == FunctionAttributeKey.FadeTime);
- if (t == null)
- {
- hadFadeTime = 0;
- return false;
- }
- else
- {
- hadFadeTime = 1;
- return true;
- }
- }
- if (hadFadeTime == 1)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- }
-
- [Newtonsoft.Json.JsonIgnore]
- FunctionAttributes trait_fadeTime;
- /// <summary>
- /// 娓愬彉鏃堕棿
- /// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public int fadeTime
- {
- get
- {
- if (trait_fadeTime == null)
- {
- trait_fadeTime = attributes.Find((obj) => obj.key == FunctionAttributeKey.FadeTime);
- //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
- if (trait_fadeTime == null)
- {
- trait_fadeTime = new FunctionAttributes()
- {
- key = FunctionAttributeKey.FadeTime,
- value = new List<string> { "up", "down" },
- max = 10,
- min = 0,
- curValue = 0
- };
- }
- }
- int result = 0;
- int.TryParse(trait_fadeTime.curValue.ToString(), out result);
- return result;
- }
- set
- {
- try
- {
- if (trait_fadeTime == null)
- {
- trait_fadeTime = attributes.Find((obj) => obj.key == FunctionAttributeKey.FadeTime);
- //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
- if (trait_fadeTime == null)
- {
- trait_fadeTime = new FunctionAttributes()
- {
- key = FunctionAttributeKey.FadeTime,
- value = new List<string> { "up", "down" },
- max = 100,
- min = 0,
- curValue = 0
- };
- }
- }
- trait_fadeTime.curValue = value;
- }
- catch
- {
- }
- }
- }
-
#region RGB
/// <summary>
/// 鑾峰彇rgb棰滆壊
/// </summary>
/// <returns></returns>
- public int GetRGBcolor()
+ public int GetRGBcolor(Function function )
{
- if (trait_color == null)
- {
- trait_color = attributes.Find((obj) => obj.key == FunctionAttributeKey.RGB);
- //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
- if (trait_color == null)
- {
- trait_color = new FunctionAttributes()
- {
- key = "color",
- value = new List<string> { "255,255,255" },
- curValue = "255,255,255"
- };
- }
- if (trait_color.curValue.ToString() == "{}")
- trait_color.curValue = "255,255,255";
- }
- int.TryParse(trait_color.curValue.ToString().Split(",")[0], out redColor);
- int.TryParse(trait_color.curValue.ToString().Split(",")[1], out greenColor);
- int.TryParse(trait_color.curValue.ToString().Split(",")[2], out blueColor);
+ var color = function.GetAttrState(FunctionAttributeKey.RGB).Split(",");
+
+ int redColor = 0;
+ int greenColor = 0;
+ int blueColor = 0;
+
+ int.TryParse(color[0], out redColor);
+ int.TryParse(color[1], out greenColor);
+ int.TryParse(color[2], out blueColor);
int recolor = redColor * 256 * 256 + greenColor * 256 + blueColor;
@@ -209,79 +31,40 @@
/// 鑾峰彇rgb 鎺у埗瀛楃涓�
/// </summary>
/// <returns></returns>
- public string GetRGBcolorString()
+ public string GetRGBcolorString(Function function )
{
- return redColor + "," + greenColor + "," + blueColor;
+ var color = function.GetAttrState(FunctionAttributeKey.RGB).Split(",");
+ return color[0] + "," + color[1] + "," + color[2];
+ }
+
+ /// <summary>
+ /// 鑾峰彇rgb棰滆壊
+ /// </summary>
+ /// <param name="index">0:red 1:green 2:blue</param>
+ /// <returns></returns>
+ public int GetColor( int index,Function function)
+ {
+ int color = 0;
+ if (index <= 2)
+ {
+ try
+ {
+ int.TryParse(function.GetAttrState(FunctionAttributeKey.RGB).Split(",")[index], out color);
+ }
+ catch { }
+ }
+ return color;
}
/// <summary>
/// 璁剧疆rgb棰滆壊
/// </summary>
- public void SetRGBcolor(byte[] color)
+ public void SetRGBcolor(byte[] color,Function function)
{
- redColor = color[0];
- greenColor = color[1];
- blueColor = color[2];
- trait_color.curValue = redColor + "," + greenColor + "," + blueColor;
+ function.SetAttrState(FunctionAttributeKey.RGB, color[0] + "," + color[1] + "," + color[2]);
}
- [Newtonsoft.Json.JsonIgnore]
- public FunctionAttributes trait_color;
- int redColor = 255;
- int greenColor = 255;
- int blueColor = 255;
-
- public int RedColor {
- get
- {
- return redColor;
- }
- }
- public int GreenColor {
- get
- {
- return greenColor;
- }
- }
- public int BlueColor
- {
- get
- {
- return blueColor;
- }
- }
#endregion
- #region CCT
- FunctionAttributes attr_CCT;
- /// <summary>
- /// 鑹叉俯
- /// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public FunctionAttributes Attr_CCT
- {
- get
- {
- if(attr_CCT == null)
- {
- attr_CCT = attributes.Find((obj) => obj.key == FunctionAttributeKey.CCT);
- if(attr_CCT== null)
- {
- attr_CCT = new FunctionAttributes()
- {
- key = FunctionAttributeKey.CCT,
- value = new List<string> (),
- max = 6500,
- min = 2700,
- curValue = 2700
- };
- }
- }
- var result = 2700;
- int.TryParse(attr_CCT.curValue.ToString(), out result);
- return attr_CCT;
- }
- }
- #endregion
}
}
diff --git a/HDL_ON/Entity/Function/Sensor.cs b/HDL_ON/Entity/Function/Sensor.cs
index 2e4d27c..585a617 100644
--- a/HDL_ON/Entity/Function/Sensor.cs
+++ b/HDL_ON/Entity/Function/Sensor.cs
@@ -3,337 +3,253 @@
namespace HDL_ON.Entity
{
- public class Sensor :Function
+ public class Sensor
{
- public Sensor()
- {
-
- }
- [Newtonsoft.Json.JsonIgnore]
- public int functionTypeNameId
- {
- get
- {
- int nameId = 0;
- switch (spk)
- {
- case SPK.SensorPm25:
- nameId = StringId.PM25;
- break;
- case SPK.SensorCO2:
- nameId = StringId.CO2;
- break;
- case SPK.SensorTemperature:
- nameId = StringId.Temp;
- break;
- case SPK.SensorTVOC:
- nameId = StringId.TVOC;
- break;
- case SPK.SensorHumidity:
- nameId = StringId.Humidity;
- break;
- }
- return nameId;
- }
- }
-
- [Newtonsoft.Json.JsonIgnore]
- public FunctionAttributes trait_values;
/// <summary>
- /// 鍊�
+ /// 鑾峰彇鍚嶇О鏂囨湰ID
/// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public double values
+ /// <param name="spk"></param>
+ /// <returns></returns>
+ public int GetFunctionTypeNameId(string spk)
{
- get
+ int nameId = 0;
+ switch (spk)
{
- if (trait_values == null)
- {
- trait_values = attributes.Find((obj) => obj.key == FunctionAttributeKey.Value);
- //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
- if (trait_values == null)
- {
- trait_values = new FunctionAttributes()
- {
- key = FunctionAttributeKey.Value,
- value = new List<string> { "29" },
- max = 10000,
- min = 0,
- };
- trait_values.curValue = trait_values.min;
- }
- }
- if (trait_values.curValue.ToString() == "{}")
- trait_values.curValue = 0;
- if(spk == SPK.SensorTVOC)
- {
- return Convert.ToDouble(trait_values.curValue.ToString()) / 100000;
- }
- return Convert.ToDouble(trait_values.curValue);
+ case SPK.SensorPm25:
+ nameId = StringId.PM25;
+ break;
+ case SPK.SensorCO2:
+ nameId = StringId.CO2;
+ break;
+ case SPK.SensorTemperature:
+ nameId = StringId.Temp;
+ break;
+ case SPK.SensorTVOC:
+ nameId = StringId.TVOC;
+ break;
+ case SPK.SensorHumidity:
+ nameId = StringId.Humidity;
+ break;
}
- set
- {
- try
-
- {
- if (trait_values == null)
- {
- trait_values = attributes.Find((obj) => obj.key == FunctionAttributeKey.Value);
- //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
- if (trait_values == null)
- {
- trait_values = new FunctionAttributes()
- {
- key = FunctionAttributeKey.Value,
- value = new List<string> { "up" },
- max = 100,
- min = 0,
- };
- }
- trait_values.curValue = trait_values.min;
- }
- trait_values.curValue = value;
- MainPage.Log($"values 鏁版嵁鍒锋柊{value}.");
- }
- catch
- {
- MainPage.Log("values 鏁版嵁鍒锋柊澶辫触.");
- }
- }
+ return nameId;
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ public double GetValues(Function function)
+ {
+ var value = function.GetAttrState(FunctionAttributeKey.Value);
+ return Convert.ToDouble(value);
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="value"></param>
+ /// <param name="function"></param>
+ public void SetValues(int value, Function function)
+ {
+ function.SetAttrState(FunctionAttributeKey.Value, value);
}
- List<string> _intervalValue;
/// <summary>
/// 姣忎釜绛夌骇瀵瑰尯闂村��
/// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public List<string> intervalValue
+ public List<string> GetIntervalValue(string spk)
{
- get
+ var _intervalValue = new List<string>();
+ switch (spk)
{
- if (_intervalValue == null)
- {
- _intervalValue = new List<string>();
- switch (spk)
- {
- case SPK.SensorPm25:
- _intervalValue.Add("0 ~ 35");
- _intervalValue.Add("36 ~ 75");
- _intervalValue.Add("76 ~ 115");
- _intervalValue.Add("115 ~");
- break;
- case SPK.SensorCO2:
- _intervalValue.Add("0 ~ 1000");
- _intervalValue.Add("1001 ~ 2000");
- _intervalValue.Add("2001 ~ 5000");
- _intervalValue.Add("5001 ~");
- break;
- case SPK.SensorTemperature:
- _intervalValue.Add("~ 18掳C");
- _intervalValue.Add("18 ~ 20掳C");
- _intervalValue.Add("20 ~ 25掳C");
- _intervalValue.Add("25 ~ 27掳C");
- _intervalValue.Add("27 ~ 30掳C");
- _intervalValue.Add("30 ~ 33掳C");
- _intervalValue.Add("33掳C ~");
- break;
- case SPK.SensorTVOC:
- _intervalValue.Add("0 ~ 0.6");
- _intervalValue.Add("0.61 ~ 2");
- _intervalValue.Add("2.01 ~ 5");
- _intervalValue.Add("5 ~");
- break;
- case SPK.SensorHumidity:
- _intervalValue.Add("70 ~");
- _intervalValue.Add("71 ~ 40");
- _intervalValue.Add("0 ~ 39");
- break;
- }
- }
- return _intervalValue;
+ case SPK.SensorPm25:
+ _intervalValue.Add("0 ~ 35");
+ _intervalValue.Add("36 ~ 75");
+ _intervalValue.Add("76 ~ 115");
+ _intervalValue.Add("115 ~");
+ break;
+ case SPK.SensorCO2:
+ _intervalValue.Add("0 ~ 1000");
+ _intervalValue.Add("1001 ~ 2000");
+ _intervalValue.Add("2001 ~ 5000");
+ _intervalValue.Add("5001 ~");
+ break;
+ case SPK.SensorTemperature:
+ _intervalValue.Add("~ 18掳C");
+ _intervalValue.Add("18 ~ 20掳C");
+ _intervalValue.Add("20 ~ 25掳C");
+ _intervalValue.Add("25 ~ 27掳C");
+ _intervalValue.Add("27 ~ 30掳C");
+ _intervalValue.Add("30 ~ 33掳C");
+ _intervalValue.Add("33掳C ~");
+ break;
+ case SPK.SensorTVOC:
+ _intervalValue.Add("0 ~ 0.6");
+ _intervalValue.Add("0.61 ~ 2");
+ _intervalValue.Add("2.01 ~ 5");
+ _intervalValue.Add("5 ~");
+ break;
+ case SPK.SensorHumidity:
+ _intervalValue.Add("70 ~");
+ _intervalValue.Add("71 ~ 40");
+ _intervalValue.Add("0 ~ 39");
+ break;
}
+ return _intervalValue;
}
- List<uint> _levelColorList;
+
/// <summary>
/// 姣忎釜绛夌骇鐨勯鑹插��
/// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public List<uint> levelColorList
+ public List<uint> GetLevelColorList(string spk)
{
- get
+ var _levelColorList = new List<uint>();
+ switch (spk)
{
- try
- {
- if (_levelColorList == null)
- {
- _levelColorList = new List<uint>();
- switch (spk)
- {
- case SPK.SensorPm25:
- _levelColorList.Add(0xFFADE764);
- _levelColorList.Add(0xFFFFD154);
- _levelColorList.Add(0xFFFF9D54);
- _levelColorList.Add(0xFFFF3D3D);
- break;
- case SPK.SensorCO2:
- _levelColorList.Add(0xFFADE764);
- _levelColorList.Add(0xFFFFD154);
- _levelColorList.Add(0xFFFF9D54);
- _levelColorList.Add(0xFFFF3D3D);
- break;
- case SPK.SensorTemperature:
- _levelColorList.Add(0xFF2172FF);
- _levelColorList.Add(0xCC4484F4);
- _levelColorList.Add(0x7F4484F4);
- _levelColorList.Add(0xFFADE764);
- _levelColorList.Add(0xFFFFD154);
- _levelColorList.Add(0xFFFF9D54);
- _levelColorList.Add(0xFFFF3D3D);
- break;
- case SPK.SensorTVOC:
- _levelColorList.Add(0xFFADE764);
- _levelColorList.Add(0xFFFFD154);
- _levelColorList.Add(0xFFFF9D54);
- _levelColorList.Add(0xFFFF3D3D);
+ case SPK.SensorPm25:
+ _levelColorList.Add(0xFFADE764);
+ _levelColorList.Add(0xFFFFD154);
+ _levelColorList.Add(0xFFFF9D54);
+ _levelColorList.Add(0xFFFF3D3D);
+ break;
+ case SPK.SensorCO2:
+ _levelColorList.Add(0xFFADE764);
+ _levelColorList.Add(0xFFFFD154);
+ _levelColorList.Add(0xFFFF9D54);
+ _levelColorList.Add(0xFFFF3D3D);
+ break;
+ case SPK.SensorTemperature:
+ _levelColorList.Add(0xFF2172FF);
+ _levelColorList.Add(0xCC4484F4);
+ _levelColorList.Add(0x7F4484F4);
+ _levelColorList.Add(0xFFADE764);
+ _levelColorList.Add(0xFFFFD154);
+ _levelColorList.Add(0xFFFF9D54);
+ _levelColorList.Add(0xFFFF3D3D);
+ break;
+ case SPK.SensorTVOC:
+ _levelColorList.Add(0xFFADE764);
+ _levelColorList.Add(0xFFFFD154);
+ _levelColorList.Add(0xFFFF9D54);
+ _levelColorList.Add(0xFFFF3D3D);
- break;
- case SPK.SensorHumidity:
- _levelColorList.Add(0xFF2172FF);
- _levelColorList.Add(0xFFADE764);
- _levelColorList.Add(0xFFFF3D3D);
- break;
- }
- }
- }catch(Exception ex)
- {
- MainPage.Log($"sensor error 1 : {ex.Message}");
- }
- return _levelColorList;
+ break;
+ case SPK.SensorHumidity:
+ _levelColorList.Add(0xFF2172FF);
+ _levelColorList.Add(0xFFADE764);
+ _levelColorList.Add(0xFFFF3D3D);
+ break;
}
+ return _levelColorList;
+
}
- List<int> _levelTextList;
+
/// <summary>
/// 姣忎釜绛夌骇鐨勫悕绉�
/// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public List<int> levelTextList
+ public List<int> GetLevelTextList(string spk)
{
- get
+ var _levelTextList = new List<int>();
+ switch (spk)
{
- if (_levelTextList == null)
- {
- _levelTextList = new List<int>();
- switch (spk)
- {
- case SPK.SensorPm25:
- _levelTextList.Add(StringId.Great);
- _levelTextList.Add(StringId.Good);
- _levelTextList.Add(StringId.MildPollution);
- _levelTextList.Add(StringId.HeavyPollution);
- break;
- case SPK.SensorCO2:
- _levelTextList.Add(StringId.SensorReferenceTipCO2Level1);
- _levelTextList.Add(StringId.SensorReferenceTipCO2Level2);
- _levelTextList.Add(StringId.SensorReferenceTipCO2Level3);
- _levelTextList.Add(StringId.SensorReferenceTipCO2Level4);
- break;
- case SPK.SensorTemperature:
- _levelTextList.Add(StringId.ExtremelyCold);
- _levelTextList.Add(StringId.Cold);
- _levelTextList.Add(StringId.SlightlyCold);
- _levelTextList.Add(StringId.Comfortable);
- _levelTextList.Add(StringId.TepidFever);
- _levelTextList.Add(StringId.Heat_SensorTip);
- _levelTextList.Add(StringId.ExtremeHeat);
-
-
- break;
- case SPK.SensorTVOC:
- _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel1);
- _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel2);
- _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel3);
- _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel4);
-
- break;
- case SPK.SensorHumidity:
- _levelTextList.Add(StringId.SensorReferenceHumidityTipLevel1);
- _levelTextList.Add(StringId.SensorReferenceHumidityTipLevel2);
- _levelTextList.Add(StringId.SensorReferenceHumidityTipLevel3);
- break;
- }
- }
- return _levelTextList;
+ case SPK.SensorPm25:
+ _levelTextList.Add(StringId.Great);
+ _levelTextList.Add(StringId.Good);
+ _levelTextList.Add(StringId.MildPollution);
+ _levelTextList.Add(StringId.HeavyPollution);
+ break;
+ case SPK.SensorCO2:
+ _levelTextList.Add(StringId.SensorReferenceTipCO2Level1);
+ _levelTextList.Add(StringId.SensorReferenceTipCO2Level2);
+ _levelTextList.Add(StringId.SensorReferenceTipCO2Level3);
+ _levelTextList.Add(StringId.SensorReferenceTipCO2Level4);
+ break;
+ case SPK.SensorTemperature:
+ _levelTextList.Add(StringId.ExtremelyCold);
+ _levelTextList.Add(StringId.Cold);
+ _levelTextList.Add(StringId.SlightlyCold);
+ _levelTextList.Add(StringId.Comfortable);
+ _levelTextList.Add(StringId.TepidFever);
+ _levelTextList.Add(StringId.Heat_SensorTip);
+ _levelTextList.Add(StringId.ExtremeHeat);
+ break;
+ case SPK.SensorTVOC:
+ _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel1);
+ _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel2);
+ _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel3);
+ _levelTextList.Add(StringId.SensorReferenceTVOCTipLevel4);
+ break;
+ case SPK.SensorHumidity:
+ _levelTextList.Add(StringId.SensorReferenceHumidityTipLevel1);
+ _levelTextList.Add(StringId.SensorReferenceHumidityTipLevel2);
+ _levelTextList.Add(StringId.SensorReferenceHumidityTipLevel3);
+ break;
}
+ return _levelTextList;
}
/// <summary>
/// 褰撳墠绛夌骇
/// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public int curLevel
+ public int GetCurLevel(Function function)
{
- get
+ var spk = function.spk;
+ var values = GetValues(function);
+ int level = 1;
+ switch (spk)
{
- int level = 1;
- switch (spk)
- {
- case SPK.SensorPm25:
- if (values < 35)
- level = 1;
- else if (values < 75)
- level = 2;
- else if (values < 115)
- level = 3;
- else if (values > 115)
- level = 4;
- break;
- case SPK.SensorCO2:
- if (values < 1000)
- level = 1;
- else if (values < 2000)
- level = 2;
- else if (values < 5000)
- level = 3;
- else if (values > 5000)
- level = 4;
- break;
- case SPK.SensorTemperature:
- if (values < 18)
- level = 1;
- else if (values < 20)
- level = 2;
- else if (values < 25)
- level = 3;
- else if (values < 27)
- level = 4;
- else if (values < 30)
- level = 5;
- else if (values < 33)
- level = 6;
- else if (values > 33)
- level = 7;
- break;
- case SPK.SensorTVOC:
- if (values < 0.6)
- level = 1;
- else if (values < 2)
- level = 2;
- else if (values < 5)
- level = 3;
- else if (values > 5)
- level = 4;
- break;
- case SPK.SensorHumidity:
- if (values > 70)
- level = 1;
- else if (values > 40)
- level = 2;
- else if (values < 40)
- level = 3;
- break;
- }
- return level;
+ case SPK.SensorPm25:
+ if (values < 35)
+ level = 1;
+ else if (values < 75)
+ level = 2;
+ else if (values < 115)
+ level = 3;
+ else if (values > 115)
+ level = 4;
+ break;
+ case SPK.SensorCO2:
+ if (values < 1000)
+ level = 1;
+ else if (values < 2000)
+ level = 2;
+ else if (values < 5000)
+ level = 3;
+ else if (values > 5000)
+ level = 4;
+ break;
+ case SPK.SensorTemperature:
+ if (values < 18)
+ level = 1;
+ else if (values < 20)
+ level = 2;
+ else if (values < 25)
+ level = 3;
+ else if (values < 27)
+ level = 4;
+ else if (values < 30)
+ level = 5;
+ else if (values < 33)
+ level = 6;
+ else if (values > 33)
+ level = 7;
+ break;
+ case SPK.SensorTVOC:
+ if (values < 0.6)
+ level = 1;
+ else if (values < 2)
+ level = 2;
+ else if (values < 5)
+ level = 3;
+ else if (values > 5)
+ level = 4;
+ break;
+ case SPK.SensorHumidity:
+ if (values > 70)
+ level = 1;
+ else if (values > 40)
+ level = 2;
+ else if (values < 40)
+ level = 3;
+ break;
}
+ return level;
}
-
}
}
diff --git a/HDL_ON/Entity/Function/SwitchSocket.cs b/HDL_ON/Entity/Function/SwitchSocket.cs
index 34e4d09..58d9768 100644
--- a/HDL_ON/Entity/Function/SwitchSocket.cs
+++ b/HDL_ON/Entity/Function/SwitchSocket.cs
@@ -1,7 +1,7 @@
锘縰sing System;
namespace HDL_ON.Entity
{
- public class SwitchSocket : Function
+ public class SwitchSocket
{
public SwitchSocket()
{
diff --git a/HDL_ON/Entity/Function/TV.cs b/HDL_ON/Entity/Function/TV.cs
index c0b23c5..8dde74a 100644
--- a/HDL_ON/Entity/Function/TV.cs
+++ b/HDL_ON/Entity/Function/TV.cs
@@ -3,20 +3,19 @@
namespace HDL_ON.Entity
{
- public class TV : Function
+ public class TV
{
public TV()
{
- trait_on_off.curValue = "off";
}
- public void ControlTV(InfraredCode_TV iCode)
+ public void ControlTV(InfraredCode_TV iCode,Function function)
{
int RandKey = new Random().Next(0, 255);
var textByte = (byte)iCode;
- new Control_Udp().ControlBytesSend(Command.InfraredControl, bus.SubnetID, bus.DeviceID, new byte[] { 1, bus.LoopId, textByte, 0, 0, (byte)RandKey }, 0);
+ new Control_Udp().ControlBytesSend(Command.InfraredControl, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 1, function.bus.LoopId, textByte, 0, 0, (byte)RandKey }, 0);
}
- public void ControlTV(int number)
+ public void ControlTV(int number,Function function)
{
int RandKey = new Random().Next(0, 255);
var textByte = (byte)(number + 7);
@@ -24,7 +23,7 @@
{
textByte = 18;
}
- new Control_Udp().ControlBytesSend(Command.InfraredControl, bus.SubnetID, bus.DeviceID, new byte[] { 1, bus.LoopId, textByte, 0, 0, (byte)RandKey }, 0);
+ new Control_Udp().ControlBytesSend(Command.InfraredControl, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 1, function.bus.LoopId, textByte, 0, 0, (byte)RandKey }, 0);
}
}
}
diff --git a/HDL_ON/Entity/Function/WeepRobot.cs b/HDL_ON/Entity/Function/WeepRobot.cs
index 1e39a13..cee5c46 100644
--- a/HDL_ON/Entity/Function/WeepRobot.cs
+++ b/HDL_ON/Entity/Function/WeepRobot.cs
@@ -1,7 +1,7 @@
锘縰sing System;
namespace HDL_ON.Entity
{
- public class WeepRobot : Function
+ public class WeepRobot
{
public WeepRobot()
{
diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs
index 845ab49..8d83075 100644
--- a/HDL_ON/Entity/FunctionList.cs
+++ b/HDL_ON/Entity/FunctionList.cs
@@ -16,7 +16,7 @@
{
get
{
- if(_FunctionList == null)
+ if (_FunctionList == null)
{
_FunctionList = new FunctionList();
#region 鎭㈠鏁版嵁
@@ -35,126 +35,160 @@
/// </summary>
public List<Function> Functions = new List<Function>();
-
-
-
-
/// <summary>
/// 绌鸿皟鍒楄〃
/// </summary>
- public List<AC> aCs = new List<AC>();
+ /// <returns></returns>
+ public List<Function> GetAcList()
+ {
+ return Functions.FindAll((obj) => obj.spk == SPK.AcStandard);
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <returns></returns>
+ public List<Function> GetList()
+ {
+ List<Function> list = new List<Function>();
+
+
+ return list;
+ }
+
/// <summary>
/// 鐏厜鍒楄〃
/// </summary>
- public List<Light> lights = new List<Light>();
+ public List<Function> GetLightList()
+ {
+ return Functions.FindAll((obj) =>
+ obj.spk == SPK.LightSwitch
+ || obj.spk == SPK.LightDimming
+ || obj.spk == SPK.LightRGB
+ || obj.spk == SPK.LightRGBW
+ || obj.spk == SPK.LightCCT);
+ }
/// <summary>
/// 绐楀笜鍒楄〃
/// </summary>
- public List<Curtain> curtains = new List<Curtain>();
+ public List<Function> GetCurtainList()
+ {
+ return Functions.FindAll((obj) =>
+ obj.spk == SPK.CurtainRoller
+ || obj.spk == SPK.CurtainShades
+ || obj.spk == SPK.CurtainSwitch
+ || obj.spk == SPK.CurtainTrietex
+ );
+ }
+
/// <summary>
/// 鍦扮儹鍒楄〃
/// </summary>
- public List<FloorHeating> floorHeatings = new List<FloorHeating>();
+ public List<Function> GetFloorHeatingList()
+ {
+ return Functions.FindAll((obj) => obj.spk == SPK.FloorHeatStandard);
+ }
#region 瀹剁數鍒楄〃 electricals
/// <summary>
/// 瀹剁數鍒楄〃
/// </summary>
- public List<Function> electricals
+ public List<Function> GetElectricals()
{
- get
- {
- if(fans == null)
- {
- fans = new List<Fan>();
- }
- if(switchSockets == null)
- {
- switchSockets = new List<SwitchSocket>();
- }
- if(tVs == null)
- {
- tVs = new List<TV>();
- }
- if (airCleaners == null)
- {
- airCleaners = new List<AirCleaner>();
- }
- if (weepRobots == null)
- {
- weepRobots = new List<WeepRobot>();
- }
- if(waterValveList == null)
- {
- waterValveList = new List<Function>();
- }
- if(clothesHangerList == null)
- {
- clothesHangerList = new List<Function>();
- }
- var list = new List<Function>();
- list.AddRange(fans);
- list.AddRange(switchSockets);
- list.AddRange(tVs);
- list.AddRange(airCleaners);
- list.AddRange(weepRobots);
- list.AddRange(waterValveList);
- list.AddRange(clothesHangerList);
- return list;
- }
+
+ return Functions.FindAll((obj) => obj.spk == SPK.ElectricFan || obj.spk == SPK.ElectricTuyaFan
+ || obj.spk == SPK.ElectricSocket
+ || obj.spk == SPK.ElectricTV
+ || obj.spk == SPK.ElectricTuyaAirCleaner
+ || obj.spk == SPK.ElectricTuyaWeepRobot
+ || obj.spk == SPK.ElectricTuyaWaterValve
+ || obj.spk == SPK.ClothesHanger);
}
/// <summary>
/// 椋庢墖鍒楄〃
/// </summary>
- public List<Fan> fans = new List<Fan>();
+ public List<Function> GetFanList()
+ {
+ return Functions.FindAll((obj) => obj.spk == SPK.ElectricFan || obj.spk == SPK.ElectricTuyaFan);
+ }
/// <summary>
/// 鐢佃鍒楄〃
/// </summary>
- public List<TV> tVs = new List<TV>();
+ public List<Function> GetTVList()
+ {
+ return Functions.FindAll((obj) => obj.spk == SPK.ElectricTV);
+ }
/// <summary>
- /// 瀹剁數鍒楄〃
+ /// 瀹剁數鎻掑骇鍒楄〃
/// </summary>
- public List<SwitchSocket> switchSockets = new List<SwitchSocket>();
+ public List<Function> GetElectricSocketList()
+ {
+ return Functions.FindAll((obj) => obj.spk == SPK.ElectricSocket);
+ }
/// <summary>
/// 绌烘皵鍑�鍖栧櫒鍒楄〃
/// </summary>
- public List<AirCleaner> airCleaners = new List<AirCleaner>();
+ public List<Function> GetAirCleanerList()
+ {
+ return Functions.FindAll((obj) => obj.spk == SPK.ElectricTuyaAirCleaner);
+ }
/// <summary>
/// 鎵湴鏈哄櫒浜哄垪琛�
/// </summary>
- public List<WeepRobot> weepRobots = new List<WeepRobot>();
+ public List<Function> GetWeepRobotList()
+ {
+ return Functions.FindAll((obj) => obj.spk == SPK.ElectricTuyaWeepRobot);
+ }
/// <summary>
/// 姘撮榾鍒楄〃
/// </summary>
- public List<Function> waterValveList = new List<Function>();
+ public List<Function> GetWaterValveList()
+ {
+ return Functions.FindAll((obj) => obj.spk == SPK.ElectricTuyaWaterValve);
+ }
/// <summary>
/// 鍑夐湼鍒楄〃
/// </summary>
- public List<Function> clothesHangerList = new List<Function>();
+ public List<Function> GetClothesHangerList ()
+ {
+ return Functions.FindAll((obj) => obj.spk == SPK.ClothesHanger);
+ }
/// <summary>
/// 绾㈠瀹濆垪琛�
/// </summary>
- public List<Function> irModule = new List<Function>();
+ public List<Function> GetIrModuleList()
+ {
+ return Functions.FindAll((obj) => obj.spk == SPK.IrModule);
+ }
#endregion
/// <summary>
/// 鐜浼犳劅鍣ㄥ垪琛�
/// </summary>
- public List<Sensor> sensorsEnvironmentalScience = new List<Sensor>();
+ public List<Function> GetEnvirSensorsList()
+ {
+ return Functions.FindAll((obj) => obj.spk == SPK.SensorPm25
+ || obj.spk == SPK.SensorCO2
+ || obj.spk == SPK.SensorTVOC
+ || obj.spk == SPK.SensorTemperature
+ || obj.spk == SPK.SensorHumidity
+ );
+ }
/// <summary>
/// 瀹夐槻璁惧鍒楄〃
/// </summary>
- public List<Sensor> sensorsArm = new List<Sensor>();
+ public List<Function> GetArmSensorList()
+ {
+ return Functions.FindAll((obj) => obj.spk == SPK.SensorSmoke
+ || obj.spk == SPK.SensorWater
+ || obj.spk == SPK.SensorDoorWindow
+ || obj.spk == SPK.SensorPir
+ );
+ }
public List<Scene> scenes = new List<Scene>();
- /// <summary>
- /// 鍔熻兘鍒楄〃
- /// </summary>
- List<Function> deviceFunctionList = new List<Function>();
-
/// <summary>
/// 鍔犺浇鍔熻兘鍒楄〃
- /// todo 闇�瑕佷紭鍖栵紝鍚庢湡涓嶈兘淇濊瘉鑳戒娇鐢╯id瑙f瀽鍑烘槸浠�涔堢被鍨嬬殑璁惧
/// </summary>
/// <param name="filePath"></param>
public void IniFunctionList(string filePath)
@@ -162,7 +196,7 @@
// todo 澧炲姞璁惧锛屽鍔犲姛鑳借繘鍔熻兘鍒楄〃
if (filePath.StartsWith("FunctionData_"))
{
- var functionDataBytes = Common.FileUtlis.Files.ReadFile(filePath);
+ var functionDataBytes = FileUtlis.Files.ReadFile(filePath);
var functionDataString = System.Text.Encoding.UTF8.GetString(functionDataBytes);
var tempFunction = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(functionDataString);
if (tempFunction == null)
@@ -170,100 +204,10 @@
FileUtlis.Files.DeleteFile(filePath);
return;
}
- {
- switch (tempFunction.spk)
- {
- case SPK.LightSwitch:
- case SPK.LightDimming:
- case SPK.LightRGB:
- case SPK.LightRGBW:
- case SPK.LightCCT:
- var light = Newtonsoft.Json.JsonConvert.DeserializeObject<Light>(functionDataString);
- List.lights.Add(light);
- deviceFunctionList.Add(light);
- break;
- case SPK.CurtainRoller:
- case SPK.CurtainShades:
- case SPK.CurtainSwitch:
- case SPK.CurtainTrietex:
- var curtain = Newtonsoft.Json.JsonConvert.DeserializeObject<Curtain>(functionDataString);
- List.curtains.Add(curtain);
- deviceFunctionList.Add(curtain);
- break;
- case SPK.AcStandard:
- var ac = Newtonsoft.Json.JsonConvert.DeserializeObject<AC>(functionDataString);
- List.aCs.Add(ac);
- deviceFunctionList.Add(ac);
- break;
- case SPK.FloorHeatStandard:
- var fh = Newtonsoft.Json.JsonConvert.DeserializeObject<FloorHeating>(functionDataString);
- List.floorHeatings.Add(fh);
- deviceFunctionList.Add(fh);
- break;
- case SPK.SensorPm25:
- case SPK.SensorCO2:
- case SPK.SensorTVOC:
- case SPK.SensorTemperature:
- case SPK.SensorHumidity:
- var sensor = Newtonsoft.Json.JsonConvert.DeserializeObject<Sensor>(functionDataString);
- List.sensorsEnvironmentalScience.Add(sensor);
- deviceFunctionList.Add(sensor);
- break;
- case SPK.ElectricSocket:
- var ele = Newtonsoft.Json.JsonConvert.DeserializeObject<SwitchSocket>(functionDataString);
- List.switchSockets.Add(ele);
- deviceFunctionList.Add(ele);
- break;
- case SPK.ElectricTV:
- var tv = Newtonsoft.Json.JsonConvert.DeserializeObject<TV>(functionDataString);
- List.tVs.Add(tv);
- deviceFunctionList.Add(tv);
- break;
- case SPK.ElectricFan:
- var fan = Newtonsoft.Json.JsonConvert.DeserializeObject<Fan>(functionDataString);
- List.fans.Add(fan);
- deviceFunctionList.Add(fan);
- break;
- case SPK.ElectricTuyaAirCleaner:
- var airCleaner = Newtonsoft.Json.JsonConvert.DeserializeObject<AirCleaner>(functionDataString);
- List.airCleaners.Add(airCleaner);
- deviceFunctionList.Add(airCleaner);
- break;
- case SPK.ElectricTuyaFan:
- var tuyaFan = Newtonsoft.Json.JsonConvert.DeserializeObject<Fan>(functionDataString);
- List.fans.Add(tuyaFan);
- deviceFunctionList.Add(tuyaFan);
- break;
- case SPK.ElectricTuyaWeepRobot:
- var tuyaWeepRobot = Newtonsoft.Json.JsonConvert.DeserializeObject<WeepRobot>(functionDataString);
- List.weepRobots.Add(tuyaWeepRobot);
- deviceFunctionList.Add(tuyaWeepRobot);
- break;
- case SPK.ElectricTuyaWaterValve:
- var tuyaWaterValve = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(functionDataString);
- List.waterValveList.Add(tuyaWaterValve);
- deviceFunctionList.Add(tuyaWaterValve);
- break;
- case SPK.SensorSmoke:
- case SPK.SensorWater:
- case SPK.SensorDoorWindow:
- case SPK.SensorPir:
- var ser = Newtonsoft.Json.JsonConvert.DeserializeObject<Sensor>(functionDataString);
- List.sensorsArm.Add(ser);
- deviceFunctionList.Add(ser);
- break;
- case SPK.ClothesHanger:
- var ch = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(functionDataString);
- List.clothesHangerList.Add(ch);
- deviceFunctionList.Add(ch);
- break;
- case SPK.IrModule:
- var irm = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(functionDataString);
- List.irModule.Add(irm);
- deviceFunctionList.Add(irm);
- break;
- }
- }
+
+
+ Functions.Add(tempFunction);
+
}
if (filePath.StartsWith("SceneData_"))
{
@@ -279,27 +223,6 @@
/// </summary>
public List<Function> GetDeviceFunctionList(SPK.BrandType brandType = SPK.BrandType.All)
{
- if (deviceFunctionList == null || deviceFunctionList.Count == 0)
- {
- deviceFunctionList = new List<Function>();
- deviceFunctionList.AddRange(aCs);
- deviceFunctionList.AddRange(lights);
- deviceFunctionList.AddRange(curtains);
- deviceFunctionList.AddRange(floorHeatings);
- deviceFunctionList.AddRange(electricals);
- deviceFunctionList.AddRange(sensorsEnvironmentalScience);
- deviceFunctionList.AddRange(sensorsArm);
- deviceFunctionList.AddRange(UI.Music.A31MusicModel.A31MusicModelList);
- try
- {
- deviceFunctionList = deviceFunctionList.OrderByDescending(o => o.controlCounter).ToList();
- }
- catch (Exception ex)
- {
- MainPage.Log($"璁惧鍔熻兘鎺掑簭寮傚父锛歿ex.Message}");
- }
- }
-
List<Function> resultFunctions = new List<Function>();
if (brandType == SPK.BrandType.All)
{
@@ -309,7 +232,7 @@
switch (brandType)
{
case SPK.BrandType.Hdl:
- foreach (var function in deviceFunctionList)
+ foreach (var function in Functions)
{
if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(function.spk))
{
@@ -319,7 +242,7 @@
break;
case SPK.BrandType.Tuya:
- foreach (var function in deviceFunctionList)
+ foreach (var function in Functions)
{
if (SPK.Get3tySpk(SPK.BrandType.Tuya).Contains(function.spk))
{
@@ -331,7 +254,7 @@
return resultFunctions;
}
- return deviceFunctionList;
+ return Functions;
}
/// <summary>
@@ -339,23 +262,7 @@
/// </summary>
public void Clear()
{
- List.aCs = new List<AC>();
- List.lights = new List<Light>();
- List.curtains = new List<Curtain>();
- List.floorHeatings = new List<FloorHeating>();
- List.sensorsEnvironmentalScience = new List<Sensor>();
- #region 瀹剁數
- List.fans = new List<Fan>();
- List.switchSockets = new List<SwitchSocket>();
- List.tVs = new List<TV>();
- List.airCleaners = new List<AirCleaner>();
- List.weepRobots = new List<WeepRobot>();
- List.waterValveList = new List<Function>();
- List.clothesHangerList = new List<Function>();
- #endregion
-
- List.scenes = new List<Scene>();
- List.deviceFunctionList = new List<Function>();
+ Functions = new List<Function>();
_FunctionList = null;
}
@@ -408,69 +315,8 @@
/// </summary>
public void DeleteFunction(Function delTemp)
{
- switch (delTemp.spk)
- {
- case SPK.LightSwitch:
- case SPK.LightDimming:
- case SPK.LightRGB:
- case SPK.LightRGBW:
- case SPK.LightCCT:
- List.lights.Remove(List.lights.Find((obj) => obj.deviceId == delTemp.deviceId));
- break;
- case SPK.CurtainRoller:
- case SPK.CurtainShades:
- case SPK.CurtainSwitch:
- case SPK.CurtainTrietex:
- List.curtains.Remove(List.curtains.Find((obj) => obj.deviceId == delTemp.deviceId));
- break;
- case SPK.AcStandard:
- List.aCs.Remove(List.aCs.Find((obj) => obj.deviceId == delTemp.deviceId));
- break;
- case SPK.FloorHeatStandard:
- List.floorHeatings.Remove(List.floorHeatings.Find((obj) => obj.deviceId == delTemp.deviceId));
- break;
- case SPK.SensorPm25:
- case SPK.SensorCO2:
- case SPK.SensorTVOC:
- case SPK.SensorTemperature:
- case SPK.SensorHumidity:
- List.sensorsEnvironmentalScience.Remove(List.sensorsEnvironmentalScience.Find((obj) => obj.deviceId == delTemp.deviceId));
- break;
- case SPK.ElectricSocket:
- List.switchSockets.Remove(List.switchSockets.Find((obj) => obj.deviceId == delTemp.deviceId));
- break;
- case SPK.ElectricTV:
- List.tVs.Remove(List.tVs.Find((obj) => obj.deviceId == delTemp.deviceId));
- break;
- case SPK.ElectricFan:
- case SPK.ElectricTuyaFan:
- List.fans.Remove(List.fans.Find((obj) => obj.deviceId == delTemp.deviceId));
- break;
- case SPK.ElectricTuyaAirCleaner:
- List.airCleaners.Remove(List.airCleaners.Find((obj) => obj.deviceId == delTemp.deviceId));
- break;
- case SPK.ElectricTuyaWaterValve:
- List.waterValveList.Remove(List.waterValveList.Find((obj) => obj.deviceId == delTemp.deviceId));
- break;
- case SPK.ElectricTuyaWeepRobot:
- List.weepRobots.Remove(List.weepRobots.Find((obj) => obj.deviceId == delTemp.deviceId));
- break;
- case SPK.ClothesHanger:
- List.clothesHangerList.Remove(List.clothesHangerList.Find((obj) => obj.deviceId == delTemp.deviceId));
- break;
- case SPK.SensorSmoke:
- case SPK.SensorWater:
- case SPK.SensorDoorWindow:
- case SPK.SensorPir:
- List.sensorsArm.Remove(List.sensorsArm.Find((obj)=>obj.deviceId == delTemp.deviceId));
- break;
- }
- var removeTemp = deviceFunctionList.Find((obj) => obj.deviceId == delTemp.deviceId);
- if(removeTemp!= null)
- {
- deviceFunctionList.Remove(removeTemp);
- }
- Common.FileUtlis.Files.DeleteFile(delTemp.savePath);
+ Functions.Remove(Functions.Find((obj) => obj.deviceId == delTemp.deviceId));
+ FileUtlis.Files.DeleteFile(delTemp.savePath);
}
bool lockReadFunctionStatus = false;
diff --git a/HDL_ON/Entity/Room.cs b/HDL_ON/Entity/Room.cs
index 055a4c6..e932b22 100644
--- a/HDL_ON/Entity/Room.cs
+++ b/HDL_ON/Entity/Room.cs
@@ -74,10 +74,11 @@
{
var roomUpdateList = spatials.FindAll((obj) => obj.roomType == "ROOM");
var floorUpdateList = spatials.FindAll((obj) => obj.roomType == "FLOOR");
+ CurrentSpatial.DeleteAllRoom();
+ FloorList.Clear();
//澶勭悊鎴块棿鍒楄〃
if (roomUpdateList != null && roomUpdateList.Count > 0)
{
- CurrentSpatial.DeleteAllRoom();
foreach (var newRoom in roomUpdateList)
{
newRoom.SaveRoomFile();
@@ -88,7 +89,6 @@
//妤煎眰鎴块棿鍒楄〃
if (floorUpdateList != null && floorUpdateList.Count > 0)
{
- FloorList.Clear();
foreach (var updateTemp in floorUpdateList)
{
FloorList.Add(updateTemp);
@@ -325,9 +325,10 @@
/// </summary>
public void DeleteAllRoom()
{
- foreach(var localRoom in RoomList)
+ for(int i=0;i< RoomList.Count;)
{
- Common.FileUtlis.Files.DeleteFile(localRoom.dataSavePath);
+ Common.FileUtlis.Files.DeleteFile(RoomList[i].dataSavePath);
+ RoomList.RemoveAt(i);
}
rooms = null;
}
diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems
index 4e35ba4..ddfcc5a 100644
--- a/HDL_ON/HDL_ON.projitems
+++ b/HDL_ON/HDL_ON.projitems
@@ -336,7 +336,6 @@
<Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmSensor\SensorWaterImmersionPage.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmSensor\SensorDoorWinwsPage.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmSensor\SensorSmokePage.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)Entity\Function\DeviceFunction.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Entity\Enumerative\ClothsHangerEnum.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\PirMain.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\TopView.cs" />
diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs
index 3a8d23e..7ee9323 100644
--- a/HDL_ON/UI/MainPage.cs
+++ b/HDL_ON/UI/MainPage.cs
@@ -26,7 +26,7 @@
/// <summary>
/// 鐗堟湰鍙�
/// </summary>
- public static string VersionString = "1.1.0303";
+ public static string VersionString = "1.1.0305";
///// <summary>
///// 瀹㈡埛绔被鍨�
///// </summary>
diff --git a/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs b/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs
index f6559b3..265dc13 100644
--- a/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs
+++ b/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs
@@ -11,7 +11,8 @@
/// <summary>
/// 鍔熻兘鎺у埗鐣岄潰璺宠浆浜嬩欢
/// </summary>
- public EventHandler<MouseEventArgs> LoadEvent_SkipFunctionControlPage(Function function,Button btnCollectionIcon, Button btnName, Button btnFromFloor)
+ public EventHandler<MouseEventArgs> LoadEvent_SkipFunctionControlPage(Function function, Button btnCollectionIcon, Button btnName, Button btnFromFloor
+ )
{
EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
{
@@ -20,71 +21,61 @@
switch (function.spk)
{
case SPK.LightSwitch:
- if (function.spk == SPK.ElectricSocket)
- {
- var s1View = new SocketPage(function as SwitchSocket);
- MainPage.BasePageView.AddChidren(s1View);
- s1View.LoadPage(btnCollectionIcon, btnName, btnFromFloor);
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
- }
- else
- {
- var relayView = new RelayPage(function as Light);
- MainPage.BasePageView.AddChidren(relayView);
- relayView.LoadPage(btnCollectionIcon, btnName, btnFromFloor);
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
- }
+ var relayView = new RelayPage(function);
+ MainPage.BasePageView.AddChidren(relayView);
+ relayView.LoadPage(btnCollectionIcon, btnName, btnFromFloor);
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
break;
case SPK.LightRGB:
- var rgbView = new RGBPage(function as Light);
+ var rgbView = new RGBPage(function);
MainPage.BasePageView.AddChidren(rgbView);
rgbView.LoadPage(btnCollectionIcon, btnName, btnFromFloor);
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
break;
case SPK.LightDimming:
- var dimmerView = new DimmerPage(function as Light);
+ var dimmerView = new DimmerPage(function);
MainPage.BasePageView.AddChidren(dimmerView);
dimmerView.LoadPage(btnCollectionIcon, btnName, btnFromFloor);
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
break;
case SPK.CurtainTrietex:
- var skinView = new MotorCurtainPage(function as Curtain);
+ var skinView = new MotorCurtainPage(function);
MainPage.BasePageView.AddChidren(skinView);
skinView.LoadPage(btnCollectionIcon, btnName, btnFromFloor);
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
break;
case SPK.CurtainSwitch:
- var curtainView = new CurtainModulePage(function as Curtain);
+ var curtainView = new CurtainModulePage(function);
MainPage.BasePageView.AddChidren(curtainView);
curtainView.LoadPage(btnCollectionIcon, btnName, btnFromFloor);
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
break;
case SPK.CurtainRoller:
- var rollingShutterView = new RollingShutterPage(function as Curtain);
+ var rollingShutterView = new RollingShutterPage(function);
MainPage.BasePageView.AddChidren(rollingShutterView);
rollingShutterView.LoadPage(btnCollectionIcon, btnName, btnFromFloor);
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
break;
case SPK.FloorHeatStandard:
- var fhView = new FloorHeatingPage(function as FloorHeating);
+ var fhView = new FloorHeatingPage(function);
MainPage.BasePageView.AddChidren(fhView);
fhView.LoadPage(btnCollectionIcon, btnName, btnFromFloor);
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
break;
case SPK.ElectricFan:
- var fanView = new FanPage(function as Fan);
+ var fanView = new FanPage(function);
MainPage.BasePageView.AddChidren(fanView);
fanView.LoadPage(btnCollectionIcon, btnName, btnFromFloor);
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
break;
case SPK.ElectricSocket:
- var sView = new SocketPage(function as SwitchSocket);
+ var sView = new SocketPage(function);
MainPage.BasePageView.AddChidren(sView);
sView.LoadPage(btnCollectionIcon, btnName, btnFromFloor);
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
break;
case SPK.ElectricTV:
- var tvView = new TVPage(function as TV);
+ var tvView = new TVPage(function);
MainPage.BasePageView.AddChidren(tvView);
tvView.LoadPage(btnCollectionIcon, btnName, btnFromFloor);
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
@@ -108,12 +99,12 @@
case SPK.MusicStandard:
Music.A31MusicModel.Current = (function as Music.A31MusicModel);//褰撳墠鎾斁鍣�
var a31PlayMusicPage = new Music.A31PlayMusicPage();
- MainPage.BasePageView.AddChidren(a31PlayMusicPage);
- a31PlayMusicPage.Show();
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ MainPage.BasePageView.AddChidren(a31PlayMusicPage);
+ a31PlayMusicPage.Show();
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
break;
case SPK.LightCCT:
- var TureView = new ColorTureLampPage(function as Light);
+ var TureView = new ColorTureLampPage(function);
MainPage.BasePageView.AddChidren(TureView);
TureView.LoadPage(btnCollectionIcon, btnName, btnFromFloor);
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
@@ -147,15 +138,9 @@
var acPage = new AcControlPage();
acPage.AddForm(function, btnCollectionIcon, btnName, btnFromFloor);
break;
- //case SPK.AcStandard:
- // var acView = new ACPage(function as AC);
- // MainPage.BasePageView.AddChidren(acView);
- // acView.LoadPage(btnCollectionIcon, btnName, btnFromFloor);
- // MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
- // break;
}
};
return eventHandler;
}
}
-}
+}
\ No newline at end of file
diff --git a/HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs b/HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs
index 984a091..b228052 100644
--- a/HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs
+++ b/HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs
@@ -44,9 +44,8 @@
//sidObj.bus.LoopId = Convert.ToByte(sidObj.sid.Substring(20, 4),16);
sidObj.bus.loopId = sidObj.sid.Substring(20, 4);
}
- FunctionList.List.AddDeviceFunction(sidObj);
+ //FunctionList.List.AddDeviceFunction(sidObj);
}
- //MainPage.GoUserPage();
}
}
diff --git a/HDL_ON/UI/UI1-Login/LoginPage.cs b/HDL_ON/UI/UI1-Login/LoginPage.cs
index 327f2ee..06ff41a 100644
--- a/HDL_ON/UI/UI1-Login/LoginPage.cs
+++ b/HDL_ON/UI/UI1-Login/LoginPage.cs
@@ -192,12 +192,12 @@
//return;
if (b)
{
- etAccount.Text = "15622703419";//"18316120654";//lcg "18316672920";//hzx;// "13415629083"//cf;//tujie"18316120654";
+ etAccount.Text = "18316672920";//"18316120654";//lcg "18316672920";//hzx;// "13415629083"//cf;//tujie"18316120654";
// "15622703419"lwn;// "18824864143";//"464027401@qq.com"; //"2791308028@qq.com";//13697499568
}
else
{
- etAccount.Text = "18316672920";//鍑夐湼"18666455392";//13375012446//13602944661//tzy 18778381374
+ etAccount.Text = "15971583093";//鍑夐湼"18666455392";//13375012446//13602944661//tzy 18778381374
//15971583093 gs
}
b = !b;
diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
index 687bc60..265043e 100644
--- a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
@@ -459,7 +459,6 @@
/// </summary>
void LoadDeviceFunctionControlZone()
{
-
#region ContextView
deviceFunctionView.RemoveAll();
functionViews.Clear();
@@ -769,7 +768,7 @@
};
view.AddChidren(btnCurtainOpen);
- LoadEvent_ControlCurtain(function as Curtain, btnCurtainClose, btnCurtainOpen);
+ LoadEvent_ControlCurtain(function, btnCurtainClose, btnCurtainOpen);
}
else if (function.spk == SPK.ElectricTV)
@@ -785,7 +784,7 @@
UnSelectedImagePath = "Public/PowerClose.png",
};
view.AddChidren(btnPower);
- LoadEvent_ControlTV(function as TV, btnPower);
+ LoadEvent_ControlTV(function, btnPower);
}
else if (function.spk == SPK.MusicStandard)
@@ -885,7 +884,7 @@
#region 鐏厜 Light
btnIcon.UnSelectedImagePath = "FunctionIcon/Light/LightIcon.png";
btnIcon.SelectedImagePath = "FunctionIcon/Light/LightOnIcon.png";
- UpdataFunctionStates(function as Light);
+ UpdataFunctionStates(function);
#endregion
break;
case FunctionCategory.AC:
@@ -948,6 +947,7 @@
function.CollectFunction();
};
+
var skipControlPageEvent = new PublicAssmebly().LoadEvent_SkipFunctionControlPage(function, btnCollection, btnName, btnZone);
view.MouseUpEventHandler = skipControlPageEvent;
btnName.MouseUpEventHandler = skipControlPageEvent;
diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
index c090e78..f2c7f27 100644
--- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
@@ -21,6 +21,16 @@
bodyView.btnPm25Values.Text = MainPage.cityInfo.pm25 == null ? "--" : MainPage.cityInfo.pm25;
}
}
+ /// <summary>
+ /// 鏇存柊鍔熻兘鍒楄〃涓婚〉
+ /// </summary>
+ public static void RefreshFunctionView()
+ {
+ if (bodyView != null)
+ {
+ bodyView.LoadDeviceFunctionControlZone();
+ }
+ }
/// <summary>
/// 鏇存柊杩炴帴鐘舵�佸浘鏍�
@@ -163,7 +173,7 @@
/// </summary>
public static void UpdataFunctionStates(Function function)
{
- Application.RunOnMainThread((Action)(() =>
+ Application.RunOnMainThread(() =>
{
try
{
@@ -213,7 +223,7 @@
{
MainPage.Log($"HomePage updata funciton states error {ex.Message}");
}
- }));
+ });
}
/// <summary>
@@ -293,18 +303,17 @@
Dictionary<string, string> d = new Dictionary<string, string>();
if (function.spk == SPK.LightDimming || function.spk == SPK.LightRGB)
{
- var light = function as Light;
- d.Add(FunctionAttributeKey.OnOff, light.trait_on_off.curValue.ToString());
+ d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString());
if (btnSwitch.IsSelected)
{
- d.Add(FunctionAttributeKey.Brightness, light.lastBrightness.ToString());
+ d.Add(FunctionAttributeKey.Brightness, function.lastBrightness.ToString());
}
else
{
- light.lastBrightness = light.brightness;
+ function.lastBrightness = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness));
}
- d.Add(FunctionAttributeKey.FadeTime, light.fadeTime.ToString());
- Control.Ins.SendWriteCommand(light, d);
+ d.Add(FunctionAttributeKey.FadeTime, function.GetAttrState(FunctionAttributeKey.FadeTime));
+ Control.Ins.SendWriteCommand(function, d);
}
else
{
@@ -321,26 +330,26 @@
/// </summary>
/// <param name="tV"></param>
/// <param name="button"></param>
- void LoadEvent_ControlTV(TV tV, Button button)
+ void LoadEvent_ControlTV(Function tV, Button button)
{
button.MouseUpEventHandler = (sender, e) =>
{
- tV.ControlTV(InfraredCode_TV.Power);
+ new TV().ControlTV(InfraredCode_TV.Power, tV);
};
}
/// <summary>
/// 鍔犺浇绐楀笜鎺у埗浜嬩欢
/// </summary>
- void LoadEvent_ControlCurtain(Curtain curtain, Button btnClose, Button btnOpen)
+ void LoadEvent_ControlCurtain(Function curtain, Button btnClose, Button btnOpen)
{
btnClose.MouseUpEventHandler = (sender, e) =>
{
btnClose.IsSelected = true;
curtain.trait_on_off.curValue = "off";
- curtain.percent = 0;
+ curtain.SetAttrState(FunctionAttributeKey.Percent, 0);
Dictionary<string, string> d = new Dictionary<string, string>();
- d.Add("on_off", curtain.trait_on_off.curValue.ToString());
+ d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString());
Control.Ins.SendWriteCommand(curtain, d);
};
@@ -348,9 +357,9 @@
{
btnOpen.IsSelected = true;
curtain.trait_on_off.curValue = "on";
- curtain.percent = 100;
+ curtain.SetAttrState(FunctionAttributeKey.Percent, 100);
Dictionary<string, string> d = new Dictionary<string, string>();
- d.Add("on_off", curtain.trait_on_off.curValue.ToString());
+ d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString());
Control.Ins.SendWriteCommand(curtain, d);
};
}
diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs b/HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs
index 279c70d..b86e4c5 100644
--- a/HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs
+++ b/HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs
@@ -77,14 +77,13 @@
{
try
{
+ (fcView.GetChildren(j) as DiyImageSeekBar).Progress = Convert.ToInt32(updataFunction.GetAttrState(FunctionAttributeKey.Brightness));
if (updataFunction.trait_on_off.curValue.ToString() == "on")
{
- (fcView.GetChildren(j) as DiyImageSeekBar).Progress = (updataFunction as Light).brightness;
(fcView.GetChildren(j) as DiyImageSeekBar).ProgressBarColor = CSS.CSS_Color.AuxiliaryColor1;
}
else
{
- (fcView.GetChildren(j) as DiyImageSeekBar).Progress = (updataFunction as Light).brightness;
(fcView.GetChildren(j) as DiyImageSeekBar).ProgressBarColor = CSS.CSS_Color.PromptingColor2;
}
}
diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
index de798f2..4e4505a 100644
--- a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
+++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
@@ -442,41 +442,41 @@
{
case ShowFunction.Light:
#region Light
- functionCount = FunctionList.List.lights.Count;
- functionOnCount = FunctionList.List.lights.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
+ functionCount = FunctionList.List.GetLightList().Count;
+ functionOnCount = FunctionList.List.GetLightList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
#endregion
break;
case ShowFunction.AC:
#region AC
- functionCount = FunctionList.List.aCs.Count;
- functionOnCount = FunctionList.List.aCs.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
+ functionCount = FunctionList.List.GetAcList().Count;
+ functionOnCount = FunctionList.List.GetAcList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
#endregion
break;
case ShowFunction.Curtain:
#region Curtain
- functionCount = FunctionList.List.curtains.Count;
- functionOnCount = FunctionList.List.curtains.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
+ functionCount = FunctionList.List.GetCurtainList().Count;
+ functionOnCount = FunctionList.List.GetCurtainList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
#endregion
break;
case ShowFunction.FloorHeating:
#region 鍦扮儹
- functionCount = FunctionList.List.floorHeatings.Count;
- functionOnCount = FunctionList.List.floorHeatings.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
+ functionCount = FunctionList.List.GetFloorHeatingList().Count;
+ functionOnCount = FunctionList.List.GetFloorHeatingList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
#endregion
break;
case ShowFunction.DoorLock:
break;
case ShowFunction.Electric:
#region 鐢靛櫒
- functionCount = FunctionList.List.electricals.Count;
- functionOnCount = FunctionList.List.electricals.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
+ functionCount = FunctionList.List.GetElectricals().Count;
+ functionOnCount = FunctionList.List.GetElectricals().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
#endregion
break;
case ShowFunction.EnergyMonitoring:
break;
case ShowFunction.Environmental:
#region 鐜鏁版嵁
- functionCount = FunctionList.List.sensorsEnvironmentalScience.Count;
+ functionCount = FunctionList.List.GetEnvirSensorsList().Count;
#endregion
break;
case ShowFunction.FreshAir:
@@ -491,7 +491,7 @@
functionCount = 1;
break;
case ShowFunction.Sensor:
- functionCount = FunctionList.List.sensorsArm.Count;
+ functionCount = FunctionList.List.GetArmSensorList().Count;
break;
case ShowFunction.VideoIntercom:
break;
@@ -597,8 +597,6 @@
case ShowFunction.Light:
#region Light
btnName.TextID = StringId.Lights;
- functionCount = FunctionList.List.lights.Count;
- functionOnCount = FunctionList.List.lights.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
Button btnLightPower = new Button()
{
X = Application.GetRealWidth(120),
@@ -623,8 +621,6 @@
case ShowFunction.AC:
#region AC
btnName.TextID = StringId.AC;
- functionCount = FunctionList.List.aCs.Count;
- functionOnCount = FunctionList.List.aCs.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
Button btnAcPower = new Button()
{
X = Application.GetRealWidth(120),
@@ -647,8 +643,6 @@
case ShowFunction.Curtain:
#region Curtain
btnName.TextID = StringId.Curtain;
- functionCount = FunctionList.List.curtains.Count;
- functionOnCount = FunctionList.List.curtains.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
Button btnClose;
btnClose = new Button()
{
@@ -682,8 +676,6 @@
case ShowFunction.FloorHeating:
#region 鍦扮儹
btnName.TextID = StringId.FloorHeating;
- functionCount = FunctionList.List.floorHeatings.Count;
- functionOnCount = FunctionList.List.floorHeatings.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
Button btnFhPower = new Button()
{
X = Application.GetRealWidth(120),
@@ -709,8 +701,6 @@
case ShowFunction.Electric:
#region 鐢靛櫒
btnName.TextID = StringId.Electric;
- functionCount = FunctionList.List.electricals.Count;
- functionOnCount = FunctionList.List.electricals.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
Button btnElectricPower = new Button()
{
X = Application.GetRealWidth(120),
@@ -750,8 +740,6 @@
break;
case ShowFunction.Music:
btnName.TextID = StringId.Music;
- functionCount = Music.A31MusicModel.A31MusicModelList.Count;
- functionOnCount = Music.A31MusicModel.A31MusicModelList.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
btnFunctionViewBg.MouseUpEventHandler = (sender, e) =>
{
var musicMain = new Music.MusicMain();
diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs
index b3624ab..dbf88dd 100644
--- a/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs
+++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs
@@ -17,7 +17,7 @@
/// <param name="function"></param>
public static void UpdataInfo(Function function)
{
- Application.RunOnMainThread((Action)(() => {
+ Application.RunOnMainThread(() => {
if (bodyView == null)
return;
try
@@ -48,6 +48,7 @@
case SPK.ElectricTuyaFan:
case SPK.ElectricTuyaWaterValve:
case SPK.ElectricTuyaWeepRobot:
+ case SPK.ClothesHanger:
vv = ShowFunction.Electric;
break;
}
@@ -57,7 +58,7 @@
catch
{
}
- }));
+ });
}
/// <summary>
@@ -99,51 +100,32 @@
var btn = view3.GetChildren(o) as Button;
if (btn.Tag != null)
{
+ string btnText = "0";
+ switch (functionCategory)
+ {
+ case ShowFunction.FloorHeating:
+ btnText = FunctionList.List.GetFloorHeatingList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString();
+ break;
+ case ShowFunction.AC:
+ btnText = FunctionList.List.GetAcList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString();
+ break;
+ case ShowFunction.Curtain:
+ btnText = FunctionList.List.GetCurtainList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString();
+ break;
+ case ShowFunction.Light:
+ btnText = FunctionList.List.GetLightList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString();
+ break;
+ case ShowFunction.Electric:
+ btnText = FunctionList.List.GetElectricals().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString();
+ break;
+ }
if (btn.Tag.ToString() == functionCategory + "_onCount")
{
- string btnText = "0";
- switch (functionCategory)
- {
- case ShowFunction.FloorHeating:
- btnText = FunctionList.List.floorHeatings.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString();
- break;
- case ShowFunction.AC:
- btnText = FunctionList.List.aCs.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString();
- break;
- case ShowFunction.Curtain:
- btnText = FunctionList.List.curtains.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString();
- break;
- case ShowFunction.Light:
- btnText = FunctionList.List.lights.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString();
- break;
- case ShowFunction.Electric:
- btnText = FunctionList.List.electricals.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString();
- break;
- }
btn.Text = btnText;
}
else if (btn.Tag.ToString() == functionCategory + "_AllControl")
{
- var openCount = 0;
- switch (functionCategory)
- {
- case ShowFunction.FloorHeating:
- openCount = FunctionList.List.floorHeatings.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
- break;
- case ShowFunction.AC:
- openCount = FunctionList.List.aCs.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
- break;
- case ShowFunction.Curtain:
- openCount = FunctionList.List.curtains.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
- break;
- case ShowFunction.Light:
- openCount = FunctionList.List.lights.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
- break;
- case ShowFunction.Electric:
- openCount = FunctionList.List.electricals.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
- break;
- }
- btn.IsSelected = openCount != 0;
+ btn.IsSelected = btnText != "0";
}
}
}
@@ -349,7 +331,7 @@
switch (functionCategory)
{
case ShowFunction.AC:
- foreach (var f in FunctionList.List.aCs)
+ foreach (var f in FunctionList.List.GetAcList())
{
f.trait_on_off.curValue = onoff;
Dictionary<string, string> d = new Dictionary<string, string>();
@@ -359,7 +341,7 @@
}
break;
case ShowFunction.FloorHeating:
- foreach (var f in FunctionList.List.floorHeatings)
+ foreach (var f in FunctionList.List.GetFloorHeatingList())
{
f.trait_on_off.curValue = onoff;
Dictionary<string, string> d = new Dictionary<string, string>();
@@ -369,7 +351,7 @@
}
break;
case ShowFunction.Light:
- foreach (var f in FunctionList.List.lights)
+ foreach (var f in FunctionList.List.GetLightList())
{
f.trait_on_off.curValue = onoff;
Dictionary<string, string> d = new Dictionary<string, string>();
@@ -379,7 +361,7 @@
}
break;
case ShowFunction.Electric:
- foreach (var f in FunctionList.List.electricals)
+ foreach (var f in FunctionList.List.GetElectricals())
{
f.trait_on_off.curValue = onoff;
Dictionary<string, string> d = new Dictionary<string, string>();
@@ -396,7 +378,7 @@
{
case ShowFunction.AC:
List<Function> acList = new List<Function>();
- foreach(var f in FunctionList.List.aCs)
+ foreach(var f in FunctionList.List.GetAcList())
{
acList.Add(f);
}
@@ -404,7 +386,7 @@
break;
case ShowFunction.FloorHeating:
List<Function> fhList = new List<Function>();
- foreach (var f in FunctionList.List.floorHeatings)
+ foreach (var f in FunctionList.List.GetFloorHeatingList())
{
fhList.Add(f);
}
@@ -412,7 +394,7 @@
break;
case ShowFunction.Light:
List<Function> lightList = new List<Function>();
- foreach (var f in FunctionList.List.lights)
+ foreach (var f in FunctionList.List.GetLightList())
{
lightList.Add(f);
}
@@ -420,7 +402,7 @@
break;
case ShowFunction.Electric:
List<Function> eleList = new List<Function>();
- foreach (var f in FunctionList.List.electricals)
+ foreach (var f in FunctionList.List.GetElectricals())
{
eleList.Add(f);
}
@@ -467,10 +449,10 @@
{
try
{
- foreach (var f in FunctionList.List.curtains)
+ foreach (var f in FunctionList.List.GetCurtainList())
{
f.trait_on_off.curValue = "on";
- f.percent = 100;
+ f.SetAttrState(FunctionAttributeKey.Percent, "100");
Dictionary<string, string> d = new Dictionary<string, string>();
d.Add("on_off", f.trait_on_off.curValue.ToString());
Control.Ins.SendWriteCommand(f, d);
@@ -498,10 +480,10 @@
DB_ResidenceData.Instance.GlobalCurtainStatus = false;
btnClose.IsSelected = true;
btnOpen.IsSelected = false;
- foreach (var f in FunctionList.List.curtains)
+ foreach (var f in FunctionList.List.GetCurtainList())
{
f.trait_on_off.curValue = "off";
- f.percent = 0;
+ f.SetAttrState(FunctionAttributeKey.Percent, "0");
Dictionary<string, string> d = new Dictionary<string, string>();
d.Add("on_off", f.trait_on_off.curValue.ToString());
Control.Ins.SendWriteCommand(f, d);
diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs
index f0a079e..4727b80 100644
--- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs
+++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs
@@ -331,7 +331,7 @@
ProgressTextColor = CSS_Color.FirstLevelTitleColor,
ProgressTextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
MaxValue = 100,
- Progress = (function as Light).brightness,
+ Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.BatteryState)),
Tag = function.sid + "_DimmerBar",
SeekBarPadding = Application.GetRealWidth(20),
};
@@ -399,7 +399,7 @@
IsSelected = function.GetAttrState(FunctionAttributeKey.Percent) != "0"
};
bodyDiv.AddChidren(btnCurtainOpen);
- LoadEvent_ControlCurtain(btnCurtainStop, btnCurtainOpen, btnCurtainClose, function as Curtain);
+ LoadEvent_ControlCurtain(btnCurtainStop, btnCurtainOpen, btnCurtainClose, function);
#endregion
}
/// <summary>
diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs
index 692d673..1c22cb3 100644
--- a/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs
+++ b/HDL_ON/UI/UI2/2-Classification/FunctionControlZoneBLL.cs
@@ -40,7 +40,7 @@
{
if (btn.Tag.ToString() == upfunc.sid + "_DimmerBar")
{
- //btn.Progress = (upfunc as Light).trait_brightness.value.value.ToString() == "on";
+ btn.Progress = Convert.ToInt32(upfunc.GetAttrState(FunctionAttributeKey.Brightness));
}
}
}
@@ -109,10 +109,8 @@
{
if (function.Spk_Prefix == FunctionCategory.Light)
{
- var light = function as Light;
- light.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
- //Control.Send(CommandType_A.write, function);
- System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+ function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
+ Dictionary<string, string> d = new Dictionary<string, string>();
d.Add("on_off", function.trait_on_off.curValue.ToString());
Control.Ins.SendWriteCommand(function, d);
}
@@ -128,7 +126,6 @@
{
if(function.spk == SPK.LightDimming || function.spk == SPK.LightRGB)
{
- var light = function as Light;
dimmerControlBar.OnStartTrackingTouchEvent = (sender, e) => {
onDimmerBar = true;
(bodyDiv.Parent as VerticalScrolViewLayout).ScrollEnabled = false;
@@ -136,10 +133,10 @@
dimmerControlBar.OnStopTrackingTouchEvent = (sender, e) => {
onDimmerBar = false;
(bodyDiv.Parent as VerticalScrolViewLayout).ScrollEnabled = true;
- light.brightness = dimmerControlBar.Progress;
+ function.SetAttrState(FunctionAttributeKey.Brightness, dimmerControlBar.Progress.ToString());
Dictionary<string, string> d = new Dictionary<string, string>();
- d.Add("brightness", light.brightness.ToString());
- Control.Ins.SendWriteCommand(light, d);
+ d.Add(FunctionAttributeKey.Brightness, dimmerControlBar.Progress.ToString());
+ Control.Ins.SendWriteCommand(function, d);
};
dimmerControlBar.OnProgressChangedEvent = (sender, e) => {
dimmerControlBar.ProgressBarColor = CSS.CSS_Color.AuxiliaryColor1;
@@ -183,7 +180,7 @@
/// <param name="btnStop"></param>
/// <param name="btnOpen"></param>
/// <param name="btnClose"></param>
- void LoadEvent_ControlCurtain(Button btnStop, Button btnOpen, Button btnClose, Curtain curtain)
+ void LoadEvent_ControlCurtain(Button btnStop, Button btnOpen, Button btnClose, Function curtain)
{
btnClose.MouseUpEventHandler = (sender, e) =>
{
@@ -191,9 +188,9 @@
btnStop.IsSelected = false;
btnOpen.IsSelected = false;
curtain.trait_on_off.curValue = "off";
- curtain.percent = 0;
+ curtain.SetAttrState(FunctionAttributeKey.Percent, 0);
Dictionary<string, string> d = new Dictionary<string, string>();
- d.Add("on_off", curtain.trait_on_off.curValue.ToString());
+ d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString());
Control.Ins.SendWriteCommand(curtain, d);
};
@@ -204,7 +201,7 @@
btnOpen.IsSelected = false;
curtain.trait_on_off.curValue = "stop";
Dictionary<string, string> d = new Dictionary<string, string>();
- d.Add("on_off", curtain.trait_on_off.curValue.ToString());
+ d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString());
Control.Ins.SendWriteCommand(curtain, d);
};
@@ -214,9 +211,9 @@
btnClose.IsSelected = false;
btnStop.IsSelected = false;
curtain.trait_on_off.curValue = "on";
- curtain.percent = 100;
+ curtain.SetAttrState(FunctionAttributeKey.Percent, 100);
Dictionary<string, string> d = new Dictionary<string, string>();
- d.Add("on_off", curtain.trait_on_off.curValue.ToString());
+ d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString());
Control.Ins.SendWriteCommand(curtain, d);
};
}
diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
index 91c286b..1536bbb 100644
--- a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
+++ b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
@@ -83,31 +83,31 @@
if (titleId == StringId.Lights)
{
- functionList.AddRange(FunctionList.List.lights);
+ functionList.AddRange(FunctionList.List.GetLightList());
}
else if (titleId == StringId.AC)
{
- functionList.AddRange(FunctionList.List.aCs);
+ functionList.AddRange(FunctionList.List.GetAcList());
}
else if (titleId == StringId.Curtain)
{
- functionList.AddRange(FunctionList.List.curtains);
+ functionList.AddRange(FunctionList.List.GetCurtainList());
}
else if (titleId == StringId.FloorHeating)
{
- functionList.AddRange(FunctionList.List.floorHeatings);
+ functionList.AddRange(FunctionList.List.GetFloorHeatingList());
}
else if (titleId == StringId.Electric)
{
- functionList.AddRange(FunctionList.List.electricals);
+ functionList.AddRange(FunctionList.List.GetElectricals());
}
else if (titleId == StringId.EnvironmentalScience)
{
- functionList.AddRange(FunctionList.List.sensorsEnvironmentalScience);
+ functionList.AddRange(FunctionList.List.GetEnvirSensorsList());
}
else if (titleId == StringId.Sensor)
{
- functionList.AddRange(FunctionList.List.sensorsArm);
+ functionList.AddRange(FunctionList.List.GetArmSensorList());
}
functionList.OrderByDescending(o => o.controlCounter).ToList();
diff --git a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs
index 800f8a5..89120fe 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPage.cs
@@ -66,7 +66,8 @@
#endregion
#region 鍖哄煙鍙橀噺
- AC aC;
+ AC acTemp = new AC();
+ Function function;
Button btnCollection_Out;
Button btnFunctionName_Out;
Button btnFromFloor_Out;
@@ -75,10 +76,10 @@
/// </summary>
Action actionRefresh;
#endregion
- public ACPage(AC func)
+ public ACPage(Function func)
{
bodyView = this;
- aC = func;
+ function = func;
}
public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut)
@@ -107,7 +108,7 @@
TextColor = CSS_Color.FirstLevelTitleColor,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
- Text = aC.name,
+ Text = function.name,
};
controlView.AddChidren(btnFunctionName);
@@ -120,7 +121,7 @@
TextColor = CSS_Color.PromptingColor1,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- Text = aC.GetRoomListName()
+ Text = function.GetRoomListName()
};
controlView.AddChidren(btnFromFoorAndRoom);
@@ -132,7 +133,7 @@
Height = Application.GetMinRealAverage(40),
SelectedImagePath = "Collection/CollectionIcon.png",
UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
- IsSelected = aC.collect
+ IsSelected = function.collect
};
//controlView.AddChidren(btnCollection);
//2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳�
@@ -145,16 +146,16 @@
{
Gravity = Gravity.CenterHorizontal,
OpenAngle = 160,
- ThumbImagePath = aC.trait_on_off.curValue.ToString() == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png",
+ ThumbImagePath = function.trait_on_off.curValue.ToString() == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png",
ThumbImageHeight = Application.GetRealWidth(50),
ProgressBarColor = CSS_Color.MainColor,
OfflineProgressBarColor = CSS_Color.PromptingColor2,
- IsOffline = aC.trait_on_off.curValue.ToString() == "off",
- MinValue = aC.GetAttribute(FunctionAttributeKey.SetTemp).min,
- MaxValue = aC.GetAttribute(FunctionAttributeKey.SetTemp).max,
- //IsClickable = aC.trait_on_off.curValue.ToString() == "on",
+ IsOffline = function.trait_on_off.curValue.ToString() == "off",
+ MinValue = function.GetAttribute(FunctionAttributeKey.SetTemp).min,
+ MaxValue = function.GetAttribute(FunctionAttributeKey.SetTemp).max,
+ //IsClickable = function.trait_on_off.curValue.ToString() == "on",
ArcColor = CSS_Color.BackgroundColor,
- Progress = Convert.ToInt32(aC.GetAttrState(FunctionAttributeKey.SetTemp)),
+ Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.SetTemp)),
#if __IOS__
Y = Application.GetRealHeight(120 + 25),
Width = Application.GetRealWidth(260 - 40),
@@ -179,7 +180,7 @@
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = 50,
IsBold = true,
- Text = aC.GetAttrState(FunctionAttributeKey.SetTemp),
+ Text = function.GetAttrState(FunctionAttributeKey.SetTemp),
TextAlignment = TextAlignment.Center,
};
controlView.AddChidren(btnTemp);
@@ -236,7 +237,7 @@
Y = Application.GetRealHeight(334),
Width = Application.GetRealWidth(30),
Height = Application.GetRealWidth(30),
- UnSelectedImagePath = aC.GetModeIconPath(),
+ UnSelectedImagePath = acTemp.GetModeIconPath(function.GetAttrState(FunctionAttributeKey.Mode)),
};
controlView.AddChidren(btnMode);
@@ -246,7 +247,7 @@
Y = Application.GetRealHeight(337),
Width = Application.GetRealWidth(30),
Height = Application.GetRealWidth(30),
- UnSelectedImagePath = aC.GetFanIconPath(),
+ UnSelectedImagePath = acTemp.GetFanIconPath(function.GetAttrState(FunctionAttributeKey.FanSpeed)),
};
controlView.AddChidren(btnWindSpeed);
@@ -258,15 +259,15 @@
Height = Application.GetRealWidth(32),
UnSelectedImagePath = "Public/PowerClose.png",
SelectedImagePath = "Public/PowerOpen.png",
- IsSelected = aC.trait_on_off.curValue.ToString() == "on"
+ IsSelected = function.trait_on_off.curValue.ToString() == "on"
};
controlView.AddChidren(btnSwitch);
LoadEventList();
- new TopViewDiv(bodyView,Language.StringByID(StringId.AC)).LoadTopView_FunctionTop(aC, actionRefresh);
+ new TopViewDiv(bodyView,Language.StringByID(StringId.AC)).LoadTopView_FunctionTop(function, actionRefresh);
new System.Threading.Thread(() =>
{
- DriverLayer.Control.Ins.SendReadCommand(aC);
+ DriverLayer.Control.Ins.SendReadCommand(function);
})
{ IsBackground = true }.Start();
}
@@ -318,7 +319,7 @@
};
modeChangeView.AddChidren(btnLine);
- var modeList = aC.GetAttribute(FunctionAttributeKey.Mode).value;
+ var modeList = function.GetAttribute(FunctionAttributeKey.Mode).value;
foreach (var m in modeList)
{
Button btnModeIcon = new Button()
@@ -327,7 +328,7 @@
Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8),
Width = Application.GetRealWidth(24),
Height = Application.GetRealWidth(24),
- IsSelected = aC.GetAttrState(FunctionAttributeKey.Mode) == m,
+ IsSelected = function.GetAttrState(FunctionAttributeKey.Mode) == m,
};
modeChangeView.AddChidren(btnModeIcon);
@@ -340,7 +341,7 @@
TextAlignment = TextAlignment.CenterLeft,
TextColor = CSS_Color.FirstLevelTitleColor,
SelectedTextColor = CSS_Color.MainColor,
- IsSelected = aC.GetAttrState(FunctionAttributeKey.Mode) == m,
+ IsSelected = function.GetAttrState(FunctionAttributeKey.Mode) == m,
TextSize = CSS_FontSize.TextFontSize,
};
modeChangeView.AddChidren(btnModeText);
@@ -441,7 +442,7 @@
};
modeChangeView.AddChidren(btnLine);
- var modeList = aC.GetAttribute(FunctionAttributeKey.FanSpeed).value;
+ var modeList = function.GetAttribute(FunctionAttributeKey.FanSpeed).value;
foreach (var m in modeList)
{
Button btnFanIcon = new Button()
@@ -450,7 +451,7 @@
Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8),
Width = Application.GetRealWidth(24),
Height = Application.GetRealWidth(24),
- IsSelected = aC.GetAttrState(FunctionAttributeKey.FanSpeed) == m,
+ IsSelected = function.GetAttrState(FunctionAttributeKey.FanSpeed) == m,
};
modeChangeView.AddChidren(btnFanIcon);
@@ -463,7 +464,7 @@
TextAlignment = TextAlignment.CenterLeft,
TextColor = CSS_Color.FirstLevelTitleColor,
SelectedTextColor = CSS_Color.MainColor,
- IsSelected = aC.GetAttrState(FunctionAttributeKey.FanSpeed) == m,
+ IsSelected = function.GetAttrState(FunctionAttributeKey.FanSpeed) == m,
TextSize = CSS_FontSize.TextFontSize,
};
modeChangeView.AddChidren(btnFanText);
diff --git a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs
index d00e469..dfbc2d6 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs
@@ -9,7 +9,7 @@
public partial class ACPage
{
static DateTime updataTime = DateTime.MinValue;
- public static void UpdataStates(AC uAc)
+ public static void UpdataStates(Function updateTemp)
{
try
{
@@ -23,18 +23,19 @@
{
return;
}
+ AC temp = new AC();
updataTime = DateTime.Now;
- bodyView.btnTemp.Text = uAc.GetAttrState(FunctionAttributeKey.SetTemp);
- bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(uAc.GetAttrState((string)FunctionAttributeKey.IndoorTemp))) + "掳C";
- bodyView.btnMode.UnSelectedImagePath = uAc.GetModeIconPath();
- bodyView.btnWindSpeed.UnSelectedImagePath = uAc.GetFanIconPath();
- bodyView.arcBar.Progress = Convert.ToInt32(Convert.ToDouble(uAc.GetAttrState(FunctionAttributeKey.SetTemp)));
- if (uAc.trait_on_off.curValue.ToString() == "on")
+ bodyView.btnTemp.Text = updateTemp.GetAttrState(FunctionAttributeKey.SetTemp);
+ bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState((string)FunctionAttributeKey.IndoorTemp))) + "掳C";
+ bodyView.btnMode.UnSelectedImagePath = temp.GetModeIconPath(updateTemp.GetAttrState(FunctionAttributeKey.Mode));
+ bodyView.btnWindSpeed.UnSelectedImagePath = temp.GetFanIconPath(updateTemp.GetAttrState(FunctionAttributeKey.FanSpeed));
+ bodyView.arcBar.Progress = Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState(FunctionAttributeKey.SetTemp)));
+ if (updateTemp.trait_on_off.curValue.ToString() == "on")
{
bodyView.arcBar.IsOffline = false;
bodyView.btnSwitch.IsSelected = true;
bodyView.arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png";
- if (uAc.GetAttrState((string)FunctionAttributeKey.Mode) == "fan")
+ if (updateTemp.GetAttrState((string)FunctionAttributeKey.Mode) == "fan")
{
bodyView.arcBar.IsClickable = false;
}
@@ -67,8 +68,8 @@
//鍥為��鍒锋柊淇℃伅浜嬩欢
actionRefresh = () =>
{
- btnFunctionName.Text = btnFunctionName_Out.Text = aC.name;
- btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = aC.GetRoomListName();
+ btnFunctionName.Text = btnFunctionName_Out.Text = function.name;
+ btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName();
};
}
@@ -79,8 +80,8 @@
{
btnCollection.MouseUpEventHandler += (sender, e) =>
{
- btnCollection.IsSelected = aC.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
- aC.CollectFunction();
+ btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
+ function.CollectFunction();
};
}
@@ -91,56 +92,56 @@
{
btnMinus.MouseUpEventHandler = (sender, e) =>
{
- if (aC.trait_on_off.curValue.ToString() == "off" || aC.GetAttrState(FunctionAttributeKey.Mode) == "fan")
+ if (function.trait_on_off.curValue.ToString() == "off" || function.GetAttrState(FunctionAttributeKey.Mode) == "fan")
{
return;
}
- var temp = Convert.ToInt32(aC.GetAttrState(FunctionAttributeKey.SetTemp));
- if (temp <= aC.GetAttribute(FunctionAttributeKey.Mode).min)
+ var temp = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.SetTemp));
+ if (temp <= function.GetAttribute(FunctionAttributeKey.Mode).min)
{
return;
}
temp--;
arcBar.Progress = temp;
btnTemp.Text = temp.ToString();
- aC.SetAttrState(FunctionAttributeKey.SetTemp,temp.ToString());
- //Control.Send(CommandType_A.write, aC);
+ function.SetAttrState(FunctionAttributeKey.SetTemp,temp.ToString());
+ //Control.Send(CommandType_A.write, function);
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
d.Add(FunctionAttributeKey.SetTemp, temp.ToString());
- Control.Ins.SendWriteCommand(aC, d);
+ Control.Ins.SendWriteCommand(function, d);
};
btnPlus.MouseUpEventHandler = (sender, e) =>
{
- if (aC.trait_on_off.curValue.ToString() == "off" || aC.GetAttrState(FunctionAttributeKey.Mode) == "fan")
+ if (function.trait_on_off.curValue.ToString() == "off" || function.GetAttrState(FunctionAttributeKey.Mode) == "fan")
{
return;
}
- var temp = Convert.ToInt32(aC.GetAttrState(FunctionAttributeKey.SetTemp));
- if (temp >= aC.GetAttribute(FunctionAttributeKey.SetTemp).max)
+ var temp = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.SetTemp));
+ if (temp >= function.GetAttribute(FunctionAttributeKey.SetTemp).max)
{
return;
}
temp++;
arcBar.Progress = temp;
btnTemp.Text = temp.ToString();
- aC.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString());
+ function.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString());
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
d.Add(FunctionAttributeKey.SetTemp, temp.ToString());
- Control.Ins.SendWriteCommand(aC, d);
- //aC.GetSendJObject
+ Control.Ins.SendWriteCommand(function, d);
+ //function.GetSendJObject
};
arcBar.OnStopTrackingTouchEvent = (sender, e) =>
{
- aC.SetAttrState(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString());
+ function.SetAttrState(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString());
btnTemp.Text = arcBar.Progress.ToString();
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
d.Add(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString());
- Control.Ins.SendWriteCommand(aC, d);
+ Control.Ins.SendWriteCommand(function, d);
};
arcBar.OnProgressChangedEvent = (sender, e) =>
{
- aC.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString());
+ function.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString());
btnTemp.Text = e.ToString();
};
}
@@ -151,7 +152,7 @@
{
btnMode.MouseUpEventHandler = (sender, e) =>
{
- if (aC.trait_on_off.curValue.ToString() == "off")
+ if (function.trait_on_off.curValue.ToString() == "off")
{
return;
}
@@ -159,7 +160,7 @@
};
btnWindSpeed.MouseUpEventHandler = (sender, e) =>
{
- if (aC.trait_on_off.curValue.ToString() == "off")
+ if (function.trait_on_off.curValue.ToString() == "off")
{
return;
}
@@ -169,8 +170,8 @@
btnSwitch.MouseUpEventHandler = (sender, e) =>
{
btnSwitch.IsSelected = !btnSwitch.IsSelected;
- aC.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
- if (aC.trait_on_off.curValue.ToString() == "on")
+ function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
+ if (function.trait_on_off.curValue.ToString() == "on")
{
arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png";
btnSwitch.IsSelected = true;
@@ -183,8 +184,8 @@
arcBar.IsOffline = true;
}
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.OnOff, aC.trait_on_off.curValue.ToString());
- Control.Ins.SendWriteCommand(aC, d);
+ d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString());
+ Control.Ins.SendWriteCommand(function, d);
};
}
@@ -200,14 +201,14 @@
EventHandler<MouseEventArgs> eventHandler1 = (sender, e) =>
{
btnModeIcon.IsSelected = btnModeText.IsSelected = true;
- aC.SetAttrState(FunctionAttributeKey.Mode, curMode);
- btnMode.UnSelectedImagePath = aC.GetModeIconPath();
+ function.SetAttrState(FunctionAttributeKey.Mode, curMode);
+ btnMode.UnSelectedImagePath = acTemp.GetModeIconPath(function.GetAttrState(FunctionAttributeKey.Mode));
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
btnMode.UnSelectedImagePath = btnModeIcon.UnSelectedImagePath;
d.Add(FunctionAttributeKey.Mode, curMode);
- Control.Ins.SendWriteCommand(aC, d);
+ Control.Ins.SendWriteCommand(function, d);
dialog.Close();
- if (aC.GetAttrState(FunctionAttributeKey.Mode) == "fan")
+ if (function.GetAttrState(FunctionAttributeKey.Mode) == "fan")
{
bodyView.arcBar.IsClickable = false;
}
@@ -232,11 +233,11 @@
EventHandler<MouseEventArgs> eventHandler1 = (sender, e) =>
{
btnFanIcon.IsSelected = btnFanText.IsSelected = true;
- aC.SetAttrState(FunctionAttributeKey.FanSpeed, curFan);
- btnWindSpeed.UnSelectedImagePath = aC.GetFanIconPath();
+ function.SetAttrState(FunctionAttributeKey.FanSpeed, curFan);
+ btnWindSpeed.UnSelectedImagePath = acTemp.GetFanIconPath(function.GetAttrState(FunctionAttributeKey.FanSpeed));
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
d.Add(FunctionAttributeKey.FanSpeed, curFan);
- Control.Ins.SendWriteCommand(aC, d);
+ Control.Ins.SendWriteCommand(function, d);
btnWindSpeed.UnSelectedImagePath = btnFanIcon.UnSelectedImagePath;
dialog.Close();
};
diff --git a/HDL_ON/UI/UI2/FuntionControlView/AC/AcControlPage.cs b/HDL_ON/UI/UI2/FuntionControlView/AC/AcControlPage.cs
index 1686f8f..629a706 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/AC/AcControlPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/AC/AcControlPage.cs
@@ -44,7 +44,9 @@
/// </summary>
Button btnSwitch;
- AC acDevice;
+ AC acFunction = new AC();
+
+
#endregion
@@ -55,7 +57,6 @@
/// </summary>
public override void InitFrameWhiteContent()
{
- acDevice = device as AC;
base.ShowColltionButton = false;
base.SetTitleText(Language.StringByID(StringId.Electric));
@@ -85,16 +86,10 @@
{
Gravity = Gravity.CenterHorizontal,
OpenAngle = 160,
- ThumbImagePath = device.GetAttrState(FunctionAttributeKey.OnOff) == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png",
ThumbImageHeight = Application.GetRealWidth(50),
ProgressBarColor = CSS_Color.MainColor,
OfflineProgressBarColor = CSS_Color.PromptingColor2,
- IsOffline = device.GetAttrState(FunctionAttributeKey.OnOff) == "off",
- MinValue = device.GetAttribute(FunctionAttributeKey.OnOff).min,
- MaxValue = device.GetAttribute(FunctionAttributeKey.OnOff).max,
- //IsClickable = acDevice.trait_on_off.curValue.ToString() == "on",
ArcColor = CSS_Color.BackgroundColor,
- Progress = Convert.ToInt32(device.GetAttrState(FunctionAttributeKey.SetTemp)),
#if __IOS__
Y = Application.GetRealHeight(120 + 25),
Width = Application.GetRealWidth(260 - 40),
@@ -109,6 +104,13 @@
};
FrameWhiteCentet1.AddChidren(arcBar);
+
+
+ arcBar.ThumbImagePath = device.GetAttrState(FunctionAttributeKey.OnOff) == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png";
+ arcBar.IsOffline = device.GetAttrState(FunctionAttributeKey.OnOff) == "off";
+ arcBar.MinValue = device.GetAttribute(FunctionAttributeKey.SetTemp).min;
+ arcBar.MaxValue = device.GetAttribute(FunctionAttributeKey.SetTemp).max;
+ arcBar.Progress = Convert.ToInt32(device.GetAttrState(FunctionAttributeKey.SetTemp));
btnTemp = new Button()
{
@@ -176,7 +178,7 @@
Y = Application.GetRealHeight(334),
Width = Application.GetRealWidth(30),
Height = Application.GetRealWidth(30),
- UnSelectedImagePath = acDevice.GetModeIconPath(),
+ UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode)),
};
FrameWhiteCentet1.AddChidren(btnMode);
@@ -186,7 +188,7 @@
Y = Application.GetRealHeight(337),
Width = Application.GetRealWidth(30),
Height = Application.GetRealWidth(30),
- UnSelectedImagePath = acDevice.GetFanIconPath(),
+ UnSelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed)),
};
FrameWhiteCentet1.AddChidren(btnWindSpeed);
@@ -281,9 +283,9 @@
};
modeChangeView.AddChidren(btnModeText);
- btnModeIcon.UnSelectedImagePath = acDevice.GetModeIconPath(false);
- btnModeIcon.SelectedImagePath = acDevice.GetModeIconPath();
- btnModeText.Text = acDevice.GetModeAttrText( m);
+ btnModeIcon.UnSelectedImagePath = acFunction.GetModeIconPath(m, false);
+ btnModeIcon.SelectedImagePath = acFunction.GetModeIconPath(m);
+ btnModeText.Text = acFunction.GetModeAttrText( m);
if (modeList.IndexOf(m) < modeList.Count - 1)
{
@@ -303,14 +305,14 @@
EventHandler<MouseEventArgs> eventHandler1 = (sender, e) =>
{
btnModeIcon.IsSelected = btnModeText.IsSelected = true;
- acDevice.SetAttrState(FunctionAttributeKey.Mode, m);
- btnMode.UnSelectedImagePath = acDevice.GetModeIconPath();
+ device.SetAttrState(FunctionAttributeKey.Mode, m);
+ btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(m);
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
btnMode.UnSelectedImagePath = btnModeIcon.UnSelectedImagePath;
d.Add(FunctionAttributeKey.Mode, m);
- Control.Ins.SendWriteCommand(acDevice, d);
+ Control.Ins.SendWriteCommand(device, d);
dialog.Close();
- if (acDevice.GetAttrState(FunctionAttributeKey.Mode) == "fan")
+ if (device.GetAttrState(FunctionAttributeKey.Mode) == "fan")
{
arcBar.IsClickable = false;
}
@@ -404,9 +406,9 @@
TextSize = CSS_FontSize.TextFontSize,
};
modeChangeView.AddChidren(btnFanText);
- btnFanIcon.UnSelectedImagePath = acDevice.GetModeIconPath(false);
- btnFanIcon.SelectedImagePath = acDevice.GetModeIconPath();
- btnFanText.Text = acDevice.GetModeAttrText(m);
+ btnFanIcon.UnSelectedImagePath = acFunction.GetModeIconPath(m,false);
+ btnFanIcon.SelectedImagePath = acFunction.GetModeIconPath(m);
+ btnFanText.Text = acFunction.GetModeAttrText(m);
if (modeList.IndexOf(m) < modeList.Count - 1)
{
@@ -427,11 +429,11 @@
EventHandler<MouseEventArgs> eventHandler1 = (sender, e) =>
{
btnFanIcon.IsSelected = btnFanText.IsSelected = true;
- acDevice.SetAttrState(FunctionAttributeKey.FanSpeed, m);
- btnWindSpeed.UnSelectedImagePath = acDevice.GetFanIconPath();
+ device.SetAttrState(FunctionAttributeKey.FanSpeed, m);
+ btnWindSpeed.UnSelectedImagePath = acFunction.GetFanIconPath(m);
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
d.Add(FunctionAttributeKey.FanSpeed, m);
- Control.Ins.SendWriteCommand(acDevice, d);
+ Control.Ins.SendWriteCommand(device, d);
btnWindSpeed.UnSelectedImagePath = btnFanIcon.UnSelectedImagePath;
dialog.Close();
};
@@ -473,53 +475,53 @@
{
btnMinus.MouseUpEventHandler = (sender, e) =>
{
- if (acDevice.trait_on_off.curValue.ToString() == "off" || acDevice.GetAttrState(FunctionAttributeKey.Mode) == "fan")
+ if (device.trait_on_off.curValue.ToString() == "off" || device.GetAttrState(FunctionAttributeKey.Mode) == "fan")
{
return;
}
- var temp = Convert.ToInt32(acDevice.GetAttrState(FunctionAttributeKey.SetTemp));
- if (temp <= acDevice.GetAttribute(FunctionAttributeKey.Mode).min)
+ var temp = Convert.ToInt32(device.GetAttrState(FunctionAttributeKey.SetTemp));
+ if (temp <= device.GetAttribute(FunctionAttributeKey.Mode).min)
{
return;
}
temp--;
arcBar.Progress = temp;
btnTemp.Text = temp.ToString();
- acDevice.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString());
+ device.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString());
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
d.Add(FunctionAttributeKey.SetTemp, temp.ToString());
- Control.Ins.SendWriteCommand(acDevice, d);
+ Control.Ins.SendWriteCommand(device, d);
};
btnPlus.MouseUpEventHandler = (sender, e) =>
{
- if (acDevice.trait_on_off.curValue.ToString() == "off" || acDevice.GetAttrState(FunctionAttributeKey.Mode) == "fan")
+ if (device.trait_on_off.curValue.ToString() == "off" || device.GetAttrState(FunctionAttributeKey.Mode) == "fan")
{
return;
}
- var temp = Convert.ToInt32(acDevice.GetAttrState(FunctionAttributeKey.SetTemp));
- if (temp >= acDevice.GetAttribute(FunctionAttributeKey.SetTemp).max)
+ var temp = Convert.ToInt32(device.GetAttrState(FunctionAttributeKey.SetTemp));
+ if (temp >= device.GetAttribute(FunctionAttributeKey.SetTemp).max)
{
return;
}
temp++;
arcBar.Progress = temp;
btnTemp.Text = temp.ToString();
- acDevice.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString());
+ device.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString());
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
d.Add(FunctionAttributeKey.SetTemp, temp.ToString());
- Control.Ins.SendWriteCommand(acDevice, d);
+ Control.Ins.SendWriteCommand(device, d);
};
arcBar.OnStopTrackingTouchEvent = (sender, e) =>
{
- acDevice.SetAttrState(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString());
+ device.SetAttrState(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString());
btnTemp.Text = arcBar.Progress.ToString();
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
d.Add(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString());
- Control.Ins.SendWriteCommand(acDevice, d);
+ Control.Ins.SendWriteCommand(device, d);
};
arcBar.OnProgressChangedEvent = (sender, e) =>
{
- acDevice.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString());
+ device.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString());
btnTemp.Text = e.ToString();
};
}
@@ -530,7 +532,7 @@
{
btnMode.MouseUpEventHandler = (sender, e) =>
{
- if (acDevice.trait_on_off.curValue.ToString() == "off")
+ if (device.trait_on_off.curValue.ToString() == "off")
{
return;
}
@@ -538,7 +540,7 @@
};
btnWindSpeed.MouseUpEventHandler = (sender, e) =>
{
- if (acDevice.trait_on_off.curValue.ToString() == "off")
+ if (device.trait_on_off.curValue.ToString() == "off")
{
return;
}
@@ -548,8 +550,8 @@
btnSwitch.MouseUpEventHandler = (sender, e) =>
{
btnSwitch.IsSelected = !btnSwitch.IsSelected;
- acDevice.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
- if (acDevice.trait_on_off.curValue.ToString() == "on")
+ device.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
+ if (device.trait_on_off.curValue.ToString() == "on")
{
arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png";
btnSwitch.IsSelected = true;
@@ -562,8 +564,8 @@
arcBar.IsOffline = true;
}
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.OnOff, acDevice.trait_on_off.curValue.ToString());
- Control.Ins.SendWriteCommand(acDevice, d);
+ d.Add(FunctionAttributeKey.OnOff, device.trait_on_off.curValue.ToString());
+ Control.Ins.SendWriteCommand(device, d);
};
}
@@ -579,16 +581,16 @@
Application.RunOnMainThread(() =>
{
btnTemp.Text = device.GetAttrState(FunctionAttributeKey.SetTemp);
- btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(acDevice.GetAttrState(FunctionAttributeKey.IndoorTemp))) + "掳C";
- btnMode.UnSelectedImagePath = acDevice.GetModeIconPath();
- btnWindSpeed.UnSelectedImagePath = acDevice.GetFanIconPath();
- arcBar.Progress = Convert.ToInt32(Convert.ToDouble(acDevice.GetAttrState(FunctionAttributeKey.SetTemp)));
- if (acDevice.trait_on_off.curValue.ToString() == "on")
+ btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.IndoorTemp))) + "掳C";
+ btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode));
+ btnWindSpeed.UnSelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed));
+ arcBar.Progress = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp)));
+ if (device.trait_on_off.curValue.ToString() == "on")
{
arcBar.IsOffline = false;
btnSwitch.IsSelected = true;
arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png";
- if (acDevice.GetAttrState(FunctionAttributeKey.Mode) == "fan")
+ if (device.GetAttrState(FunctionAttributeKey.Mode) == "fan")
{
arcBar.IsClickable = false;
}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePage.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePage.cs
index b8646de..6e8c66f 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePage.cs
@@ -40,7 +40,8 @@
#endregion
#region 鍖哄煙鍙橀噺
- Curtain curtain;
+ Curtain curtainTemp = new Curtain();
+ Function function;
Button btnCollection_Out;
Button btnFunctionName_Out;
Button btnFromFloor_Out;
@@ -49,10 +50,10 @@
/// </summary>
Action actionRefresh;
#endregion
- public CurtainModulePage(Curtain func)
+ public CurtainModulePage(Function func)
{
bodyView = this;
- curtain = func;
+ function = func;
}
public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut)
@@ -81,7 +82,7 @@
TextColor = CSS_Color.FirstLevelTitleColor,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
- Text = curtain.name,
+ Text = function.name,
};
controlView.AddChidren(btnFunctionName);
@@ -94,7 +95,7 @@
TextColor = CSS_Color.PromptingColor1,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- Text = curtain.GetRoomListName()
+ Text = function.GetRoomListName()
};
controlView.AddChidren(btnFromFoorAndRoom);
@@ -106,7 +107,7 @@
Height = Application.GetMinRealAverage(40),
SelectedImagePath = "Collection/CollectionIcon.png",
UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
- IsSelected = curtain.collect
+ IsSelected = function.collect
};
//controlView.AddChidren(btnCollection);
//2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳�
@@ -134,7 +135,7 @@
Height = Application.GetMinRealAverage(32),
UnSelectedImagePath = "FunctionIcon/Curtain/CurtainCloseIcon.png",
SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseOnIcon.png",
- IsSelected = curtain.trait_on_off.curValue.ToString() == "off",
+ IsSelected = function.trait_on_off.curValue.ToString() == "off",
};
controlView.AddChidren(btnCurtainClose);
@@ -146,7 +147,7 @@
Height = Application.GetMinRealAverage(32),
UnSelectedImagePath = "FunctionIcon/Curtain/CurtainStopIcon.png",
SelectedImagePath = "FunctionIcon/Curtain/CurtainStopOnIcon.png",
- IsSelected = curtain.trait_on_off.curValue.ToString() == "stop",
+ IsSelected = function.trait_on_off.curValue.ToString() == "stop",
};
controlView.AddChidren(btnCurtainStop);
@@ -158,15 +159,15 @@
Height = Application.GetMinRealAverage(32),
UnSelectedImagePath = "FunctionIcon/Curtain/CurtainOpenIcon.png",
SelectedImagePath = "FunctionIcon/Curtain/CurtainOpenOnIcon.png",
- IsSelected = curtain.trait_on_off.curValue.ToString() == "on",
+ IsSelected = function.trait_on_off.curValue.ToString() == "on",
};
controlView.AddChidren(btnCurtainOpen);
LoadEventList();
- new TopViewDiv(bodyView,Language.StringByID(StringId.Curtain)).LoadTopView_FunctionTop(curtain, actionRefresh);
+ new TopViewDiv(bodyView,Language.StringByID(StringId.Curtain)).LoadTopView_FunctionTop(function, actionRefresh);
new System.Threading.Thread(() =>
{
- DriverLayer.Control.Ins.SendReadCommand(curtain);
+ DriverLayer.Control.Ins.SendReadCommand(function);
})
{ IsBackground = true }.Start();
}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs
index 1579e5b..0087ce3 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePageBLL.cs
@@ -10,29 +10,29 @@
/// <summary>
/// 鏇存柊绐楀笜鐘舵��
/// </summary>
- public static void UpdataState(Curtain uCurtain)
+ public static void UpdataState(Function updataTemp)
{
- Application.RunOnMainThread((Action)(() => {
+ Application.RunOnMainThread(() => {
if(bodyView == null)
{
return;
}
- if (uCurtain.spk == bodyView.curtain.spk && uCurtain.sid == bodyView.curtain.sid)
+ if (updataTemp.spk == bodyView.function.spk && updataTemp.sid == bodyView.function.sid)
{
- if (uCurtain.trait_on_off.curValue.ToString() == "stop")
+ if (updataTemp.trait_on_off.curValue.ToString() == "stop")
{
//bodyView.btnCurtainOpen.IsSelected = false;
//bodyView.btnCurtainClose.IsSelected = false;
//bodyView.btnCurtainStop.IsSelected = true;
}
- else if (uCurtain.trait_on_off.curValue.ToString() == "on")
+ else if (updataTemp.trait_on_off.curValue.ToString() == "on")
{
//bodyView.btnCurtainOpen.IsSelected = true;
//bodyView.btnCurtainClose.IsSelected = false;
//bodyView.btnCurtainStop.IsSelected = false;
bodyView.btnCurtainBgIcon.IsSelected = true;
}
- else if (uCurtain.trait_on_off.curValue.ToString() == "off")
+ else if (updataTemp.trait_on_off.curValue.ToString() == "off")
{
//bodyView.btnCurtainOpen.IsSelected = false;
//bodyView.btnCurtainClose.IsSelected = true;
@@ -40,7 +40,7 @@
bodyView.btnCurtainBgIcon.IsSelected = false;
}
}
- }));
+ });
}
void LoadEventList()
@@ -49,11 +49,11 @@
LoadEvent_ControlEvent();
//鍥為��鍒锋柊淇℃伅浜嬩欢
actionRefresh = () => {
- btnFunctionName.Text = btnFunctionName_Out.Text = curtain.name;
- btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = curtain.GetRoomListName();
- //curtain.SaveFunctionData(true);
+ btnFunctionName.Text = btnFunctionName_Out.Text = function.name;
+ btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName();
+ //function.SaveFunctionData(true);
};
- UpdataState(curtain);
+ UpdataState(function);
}
/// <summary>
/// 鏀惰棌鍔熻兘鎸夐挳浜嬩欢
@@ -61,8 +61,8 @@
void LoadCollectionEvent()
{
btnCollection.MouseUpEventHandler += (sender, e) => {
- btnCollection.IsSelected = curtain.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
- curtain.CollectFunction();
+ btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
+ function.CollectFunction();
};
}
@@ -79,10 +79,10 @@
});
}) { IsBackground = true }.Start();
btnCurtainBgIcon.IsSelected = false;
- curtain.trait_on_off.curValue = "off";
+ function.trait_on_off.curValue = "off";
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add("on_off", curtain.trait_on_off.curValue.ToString());
- Control.Ins.SendWriteCommand(curtain, d);
+ d.Add("on_off", function.trait_on_off.curValue.ToString());
+ Control.Ins.SendWriteCommand(function, d);
};
btnCurtainStop.MouseDownEventHandler = (sender, e) =>
@@ -106,10 +106,10 @@
});
})
{ IsBackground = true }.Start();
- curtain.trait_on_off.curValue = "stop";
+ function.trait_on_off.curValue = "stop";
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add("on_off", curtain.trait_on_off.curValue.ToString());
- Control.Ins.SendWriteCommand(curtain, d);
+ d.Add("on_off", function.trait_on_off.curValue.ToString());
+ Control.Ins.SendWriteCommand(function, d);
};
btnCurtainOpen.MouseUpEventHandler = (sender, e) =>
{
@@ -121,10 +121,10 @@
})
{ IsBackground = true }.Start();
btnCurtainBgIcon.IsSelected = true;
- curtain.trait_on_off.curValue = "on";
+ function.trait_on_off.curValue = "on";
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add("on_off", curtain.trait_on_off.curValue.ToString());
- Control.Ins.SendWriteCommand(curtain, d);
+ d.Add("on_off", function.trait_on_off.curValue.ToString());
+ Control.Ins.SendWriteCommand(function, d);
};
}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPage.cs
index 85125ca..8a1097b 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPage.cs
@@ -52,7 +52,8 @@
#endregion
#region 鍖哄煙鍙橀噺
- Curtain curtain;
+ Curtain curtainTemp = new Curtain();
+ Function function;
Button btnCollection_Out;
Button btnFunctionName_Out;
Button btnFromFloor_Out;
@@ -66,10 +67,10 @@
/// </summary>
bool onControl = false;
- public MotorCurtainPage(Curtain func)
+ public MotorCurtainPage(Function func)
{
bodyView = this;
- curtain = func;
+ function = func;
}
public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut)
@@ -99,7 +100,7 @@
TextColor = CSS_Color.FirstLevelTitleColor,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
- Text = curtain.name,
+ Text = function.name,
};
controlView.AddChidren(btnFunctionName);
@@ -112,7 +113,7 @@
TextColor = CSS_Color.PromptingColor1,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- Text = curtain.GetRoomListName()
+ Text = function.GetRoomListName()
};
controlView.AddChidren(btnFromFoorAndRoom);
@@ -124,7 +125,7 @@
Height = Application.GetMinRealAverage(40),
SelectedImagePath = "Collection/CollectionIcon.png",
UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
- IsSelected = curtain.collect
+ IsSelected = function.collect
};
//controlView.AddChidren(btnCollection);
//2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳�
@@ -139,7 +140,7 @@
Y = Application.GetRealHeight(130),
Width = Application.GetRealWidth(250),
Height = Application.GetRealWidth(177),
- Progress = curtain.percent,
+ Progress = curtainTemp.GetPercent(function),
ProgressTextColor =0x00000000,
//IsInvertedProgress = true,
};
@@ -202,7 +203,7 @@
Height = Application.GetMinRealAverage(32),
UnSelectedImagePath = "FunctionIcon/Curtain/CurtainCloseIcon.png",
SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseOnIcon.png",
- IsSelected = curtain.GetAttrState(FunctionAttributeKey.Percent) == "0"
+ IsSelected = function.GetAttrState(FunctionAttributeKey.Percent) == "0"
};
controlView.AddChidren(btnCurtainClose);
@@ -225,15 +226,15 @@
Height = Application.GetMinRealAverage(32),
UnSelectedImagePath = "FunctionIcon/Curtain/CurtainOpenIcon.png",
SelectedImagePath = "FunctionIcon/Curtain/CurtainOpenOnIcon.png",
- IsSelected = curtain.GetAttrState(FunctionAttributeKey.Percent) != "0"
+ IsSelected = function.GetAttrState(FunctionAttributeKey.Percent) != "0"
};
controlView.AddChidren(btnCurtainOpen);
LoadEventList();
- new TopViewDiv(bodyView, Language.StringByID(StringId.Curtain)).LoadTopView_FunctionTop(curtain,actionRefresh);
+ new TopViewDiv(bodyView, Language.StringByID(StringId.Curtain)).LoadTopView_FunctionTop(function,actionRefresh);
new System.Threading.Thread(() =>
{
- DriverLayer.Control.Ins.SendReadCommand(curtain);
+ DriverLayer.Control.Ins.SendReadCommand(function);
})
{ IsBackground = true }.Start();
}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs
index 702c4d7..c94975f 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPageBLL.cs
@@ -9,17 +9,17 @@
/// <summary>
/// 鏇存柊绐楀笜
/// </summary>
- /// <param name="uCurtain"></param>
- public static void UpdataState(Curtain uCurtain)
+ /// <param name="updateTemp"></param>
+ public static void UpdataState(Function updateTemp)
{
Application.RunOnMainThread((Action)(() => {
if (bodyView == null)
return;
if (bodyView.onControl)
return;
- if (uCurtain.spk == bodyView.curtain.spk && uCurtain.sid == bodyView.curtain.sid)
+ if (updateTemp.spk == bodyView.function.spk && updateTemp.sid == bodyView.function.sid)
{
- var percentString = uCurtain.GetAttrState(FunctionAttributeKey.Percent);
+ var percentString = updateTemp.GetAttrState(FunctionAttributeKey.Percent);
if (percentString != null)
{
int percent = 0;
@@ -31,7 +31,7 @@
{
if (!bodyView.onCurtainAnimation)
{
- bodyView.CurtainAnimation(Convert.ToInt32(uCurtain.trait_percent.curValue.ToString()));
+ bodyView.CurtainAnimation(Convert.ToInt32(updateTemp.GetAttrState(FunctionAttributeKey.Percent)));
}
}
catch { }
@@ -112,9 +112,9 @@
//鍥為��鍒锋柊淇℃伅浜嬩欢
actionRefresh = () =>
{
- btnFunctionName.Text = btnFunctionName_Out.Text = curtain.name;
- btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = curtain.GetRoomListName();
- //curtain.SaveFunctionData(true);
+ btnFunctionName.Text = btnFunctionName_Out.Text = function.name;
+ btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName();
+ //function.SaveFunctionData(true);
};
}
/// <summary>
@@ -124,8 +124,8 @@
{
btnCollection.MouseUpEventHandler += (sender, e) =>
{
- btnCollection.IsSelected = curtain.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
- curtain.CollectFunction();
+ btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
+ function.CollectFunction();
};
}
@@ -143,12 +143,12 @@
// });
//})
//{ IsBackground = true }.Start();
- curtain.trait_on_off.curValue = "off";
- curtain.percent = 0;
+ function.trait_on_off.curValue = "off";
+ function.SetAttrState(FunctionAttributeKey.Percent, 0);
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString());
- DriverLayer.Control.Ins.SendWriteCommand(curtain, d);
- CurtainAnimation(curtain.percent);
+ d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString());
+ DriverLayer.Control.Ins.SendWriteCommand(function, d);
+ CurtainAnimation(0);
};
btnCurtainStop.MouseUpEventHandler = (sender, e) =>
@@ -163,10 +163,10 @@
});
})
{ IsBackground = true }.Start();
- curtain.trait_on_off.curValue = "stop";
+ function.trait_on_off.curValue = "stop";
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString());
- DriverLayer.Control.Ins.SendWriteCommand(curtain, d);
+ d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString());
+ DriverLayer.Control.Ins.SendWriteCommand(function, d);
};
btnCurtainOpen.MouseUpEventHandler = (sender, e) =>
@@ -178,12 +178,12 @@
// });
//})
//{ IsBackground = true }.Start();
- curtain.trait_on_off.curValue = "on";
- curtain.percent = 100;
+ function.trait_on_off.curValue = "on";
+ function.SetAttrState(FunctionAttributeKey.Percent, 100);
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString());
- DriverLayer.Control.Ins.SendWriteCommand(curtain, d);
- CurtainAnimation(curtain.percent);
+ d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString());
+ DriverLayer.Control.Ins.SendWriteCommand(function, d);
+ CurtainAnimation(100);
};
@@ -204,20 +204,20 @@
//btnMinusSignIcon.MouseUpEventHandler = (sender, e) =>
//{
- // curtain.percent--;
- // controlBar.Progress = curtain.percent;
+ // function.percent--;
+ // controlBar.Progress = function.percent;
// System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- // d.Add(FunctionAttributeKey.Percent, curtain.percent.ToString());
- // DriverLayer.Control.Ins.SendWriteCommand(curtain, d);
+ // d.Add(FunctionAttributeKey.Percent, function.percent.ToString());
+ // DriverLayer.Control.Ins.SendWriteCommand(function, d);
//};
//btnPlusSgnIcon.MouseUpEventHandler = (sender, e) =>
//{
- // curtain.percent++;
- // controlBar.Progress = curtain.percent;
+ // function.percent++;
+ // controlBar.Progress = function.percent;
// System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- // d.Add(FunctionAttributeKey.Percent, curtain.percent.ToString());
- // DriverLayer.Control.Ins.SendWriteCommand(curtain, d);
+ // d.Add(FunctionAttributeKey.Percent, function.percent.ToString());
+ // DriverLayer.Control.Ins.SendWriteCommand(function, d);
//};
//curtainSeekBar.OnProgressChangedEvent = (sender, e) =>
@@ -225,13 +225,13 @@
// controlBar.Progress = curtainSeekBar.Progress;
// new System.Threading.Thread(() =>
// {
- // if (controlBar.Progress == 0 || controlBar.Progress == 100 || (DateTime.Now - curtain.refreshTime).TotalMilliseconds > 300)
+ // if (controlBar.Progress == 0 || controlBar.Progress == 100 || (DateTime.Now - function.refreshTime).TotalMilliseconds > 300)
// {
- // curtain.percent = e;
- // curtain.refreshTime = DateTime.Now;
+ // function.percent = e;
+ // function.refreshTime = DateTime.Now;
// System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- // d.Add("percent", curtain.percent.ToString());
- // Control.SendWriteCommand(curtain, d);
+ // d.Add("percent", function.percent.ToString());
+ // Control.SendWriteCommand(function, d);
// }
// })
// { IsBackground = true }.Start();
@@ -241,11 +241,11 @@
//controlBar.Progress = curtainSeekBar.Progress;
new System.Threading.Thread(() =>
{
- curtain.percent = e;
- curtain.refreshTime = DateTime.Now;
+ function.SetAttrState(FunctionAttributeKey.Percent, e);
+ function.refreshTime = DateTime.Now;
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.Percent, curtain.percent.ToString());
- DriverLayer.Control.Ins.SendWriteCommand(curtain, d);
+ d.Add(FunctionAttributeKey.Percent, e.ToString());
+ DriverLayer.Control.Ins.SendWriteCommand(function, d);
})
{ IsBackground = true }.Start();
};
@@ -255,13 +255,13 @@
// curtainSeekBar.Progress = controlBar.Progress;
// new System.Threading.Thread(() =>
// {
- // if (controlBar.Progress == 0 || controlBar.Progress == 100 || (DateTime.Now - curtain.refreshTime).TotalMilliseconds > 300)
+ // if (controlBar.Progress == 0 || controlBar.Progress == 100 || (DateTime.Now - function.refreshTime).TotalMilliseconds > 300)
// {
- // curtain.percent = e;
- // curtain.refreshTime = DateTime.Now;
+ // function.percent = e;
+ // function.refreshTime = DateTime.Now;
// System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- // d.Add("percent", curtain.percent.ToString());
- // Control.SendWriteCommand(curtain, d);
+ // d.Add("percent", function.percent.ToString());
+ // Control.SendWriteCommand(function, d);
// }
// })
// { IsBackground = true }.Start();
@@ -272,11 +272,11 @@
// curtainSeekBar.Progress = controlBar.Progress;
// new System.Threading.Thread(() =>
// {
- // curtain.percent = e;
- // curtain.refreshTime = DateTime.Now;
+ // function.percent = e;
+ // function.refreshTime = DateTime.Now;
// System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- // d.Add("percent", curtain.percent.ToString());
- // DriverLayer.Control.Ins.SendWriteCommand(curtain, d);
+ // d.Add("percent", function.percent.ToString());
+ // DriverLayer.Control.Ins.SendWriteCommand(function, d);
// })
// { IsBackground = true }.Start();
//};
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs
index 434c27e..55ef055 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs
@@ -53,7 +53,8 @@
#endregion
#region 鍖哄煙鍙橀噺
- Curtain curtain;
+ Curtain curtainTemp = new Curtain();
+ Function function;
Button btnCollection_Out;
Button btnFunctionName_Out;
Button btnFromFloor_Out;
@@ -66,10 +67,10 @@
/// 姝e湪鎺у埗
/// </summary>
bool onControl = false;
- public RollingShutterPage(Curtain func)
+ public RollingShutterPage(Function func)
{
bodyView = this;
- curtain = func;
+ function = func;
}
public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut)
@@ -99,7 +100,7 @@
TextColor = CSS_Color.FirstLevelTitleColor,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
- Text = curtain.name,
+ Text = function.name,
};
controlView.AddChidren(btnFunctionName);
@@ -112,7 +113,7 @@
TextColor = CSS_Color.PromptingColor1,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- Text = curtain.GetRoomListName()
+ Text = function.GetRoomListName()
};
controlView.AddChidren(btnFromFoorAndRoom);
@@ -124,7 +125,7 @@
Height = Application.GetMinRealAverage(40),
SelectedImagePath = "Collection/CollectionIcon.png",
UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
- IsSelected = curtain.collect
+ IsSelected = function.collect
};
//controlView.AddChidren(btnCollection);
//2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳�
@@ -139,7 +140,7 @@
Y = Application.GetRealHeight(130),
Width = Application.GetRealWidth(170),
Height = Application.GetRealWidth(210),
- Progress = curtain.percent,
+ Progress = curtainTemp.GetPercent(function),
//IsInvertedProgress = true,
ProgressTextColor = 0x00000000,
};
@@ -173,7 +174,7 @@
ProgressTextSize = 0x00000000,
MaxValue = 100,
SeekBarPadding = Application.GetRealWidth(20),
- Progress = curtain.percent,
+ Progress = curtainTemp.GetPercent(function),
Visible = false,
Enable = false,
};
@@ -202,7 +203,7 @@
Height = Application.GetMinRealAverage(32),
UnSelectedImagePath = "FunctionIcon/Curtain/CurtainCloseIcon.png",
SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseOnIcon.png",
- IsSelected = curtain.GetAttrState(FunctionAttributeKey.Percent) == "0",
+ IsSelected = function.GetAttrState(FunctionAttributeKey.Percent) == "0",
};
controlView.AddChidren(btnCurtainClose);
@@ -225,15 +226,15 @@
Height = Application.GetMinRealAverage(32),
UnSelectedImagePath = "FunctionIcon/Curtain/CurtainOpenIcon.png",
SelectedImagePath = "FunctionIcon/Curtain/CurtainOpenOnIcon.png",
- IsSelected = curtain.GetAttrState(FunctionAttributeKey.Percent) != "0",
+ IsSelected = function.GetAttrState(FunctionAttributeKey.Percent) != "0",
};
controlView.AddChidren(btnCurtainOpen);
LoadEventList();
- new TopViewDiv(bodyView, Language.StringByID(StringId.Curtain)).LoadTopView_FunctionTop(curtain, actionRefresh);
+ new TopViewDiv(bodyView, Language.StringByID(StringId.Curtain)).LoadTopView_FunctionTop(function, actionRefresh);
new System.Threading.Thread(() =>
{
- DriverLayer.Control.Ins.SendReadCommand(curtain);
+ DriverLayer.Control.Ins.SendReadCommand(function);
})
{ IsBackground = true }.Start();
}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs
index 2fce988..511c748 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs
@@ -9,17 +9,17 @@
/// <summary>
/// 鏇存柊绐楀笜
/// </summary>
- /// <param name="uCurtain"></param>
- public static void UpdataState(Curtain uCurtain)
+ /// <param name="updateTemp"></param>
+ public static void UpdataState(Function updateTemp)
{
- Application.RunOnMainThread((Action)(() => {
+ Application.RunOnMainThread(() => {
if (bodyView == null)
return;
if (bodyView.onControl)
return;
- if (uCurtain.spk == bodyView.curtain.spk && uCurtain.sid == bodyView.curtain.sid)
+ if (updateTemp.spk == bodyView.function.spk && updateTemp.sid == bodyView.function.sid)
{
- var percentString = uCurtain.GetAttrState(FunctionAttributeKey.Percent);
+ var percentString = updateTemp.GetAttrState(FunctionAttributeKey.Percent);
int percent = 0;
int.TryParse(percentString, out percent);
bodyView.btnCurtainOpen.IsSelected = percent > 0;
@@ -28,12 +28,12 @@
{
if (!bodyView.onCurtainAnimation)
{
- bodyView.CurtainAnimation(Convert.ToInt32(uCurtain.trait_percent.curValue.ToString()));
+ bodyView.CurtainAnimation(Convert.ToInt32(updateTemp.GetAttrState(FunctionAttributeKey.Percent)));
}
}
catch { }
}
- }));
+ });
}
/// <summary>
@@ -109,9 +109,9 @@
//鍥為��鍒锋柊淇℃伅浜嬩欢
actionRefresh = () =>
{
- btnFunctionName.Text = btnFunctionName_Out.Text = curtain.name;
- btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = curtain.GetRoomListName();
- //curtain.SaveFunctionData(true);
+ btnFunctionName.Text = btnFunctionName_Out.Text = function.name;
+ btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName();
+ //function.SaveFunctionData(true);
};
}
/// <summary>
@@ -121,8 +121,8 @@
{
btnCollection.MouseUpEventHandler += (sender, e) =>
{
- btnCollection.IsSelected = curtain.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
- curtain.CollectFunction();
+ btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
+ function.CollectFunction();
};
}
@@ -140,12 +140,12 @@
// });
//})
//{ IsBackground = true }.Start();
- curtain.trait_on_off.curValue = "off";
- curtain.percent = 0;
+ function.trait_on_off.curValue = "off";
+ function.SetAttrState(FunctionAttributeKey.Percent, 0);
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString());
- DriverLayer.Control.Ins.SendWriteCommand(curtain, d);
- CurtainAnimation(curtain.percent);
+ d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString());
+ DriverLayer.Control.Ins.SendWriteCommand(function, d);
+ CurtainAnimation(0);
};
btnCurtainStop.MouseUpEventHandler = (sender, e) =>
@@ -157,10 +157,10 @@
});
})
{ IsBackground = true }.Start();
- curtain.trait_on_off.curValue = "stop";
+ function.trait_on_off.curValue = "stop";
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString());
- DriverLayer.Control.Ins.SendWriteCommand(curtain, d);
+ d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString());
+ DriverLayer.Control.Ins.SendWriteCommand(function, d);
onCurtainAnimation = false;
};
@@ -173,30 +173,30 @@
// });
//})
//{ IsBackground = true }.Start();
- curtain.trait_on_off.curValue = "on";
- curtain.percent = 100;
+ function.trait_on_off.curValue = "on";
+ function.SetAttrState(FunctionAttributeKey.Percent, 100);
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString());
- DriverLayer.Control.Ins.SendWriteCommand(curtain, d);
- CurtainAnimation(curtain.percent);
+ d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString());
+ DriverLayer.Control.Ins.SendWriteCommand(function, d);
+ CurtainAnimation(100);
};
btnMinusSignIcon.MouseUpEventHandler = (sender, e) =>
{
- curtain.percent--;
- controlBar.Progress = curtain.percent;
+ controlBar.Progress -= 1;
+ function.SetAttrState(FunctionAttributeKey.Percent, controlBar.Progress);
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.Percent, curtain.percent.ToString());
- DriverLayer.Control.Ins.SendWriteCommand(curtain, d);
+ d.Add(FunctionAttributeKey.Percent, controlBar.Progress.ToString());
+ DriverLayer.Control.Ins.SendWriteCommand(function, d);
};
btnPlusSgnIcon.MouseUpEventHandler = (sender, e) =>
{
- curtain.percent++;
- controlBar.Progress = curtain.percent;
+ controlBar.Progress += 1;
+ function.SetAttrState(FunctionAttributeKey.Percent, controlBar.Progress);
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.Percent, curtain.percent.ToString());
- DriverLayer.Control.Ins.SendWriteCommand(curtain, d);
+ d.Add(FunctionAttributeKey.Percent, controlBar.Progress.ToString());
+ DriverLayer.Control.Ins.SendWriteCommand(function, d);
};
@@ -221,13 +221,13 @@
// controlBar.Progress = curtainSeekBar.Progress;
// new System.Threading.Thread(() =>
// {
- // if (controlBar.Progress == 0 || controlBar.Progress == 100 || (DateTime.Now - curtain.refreshTime).TotalMilliseconds > 300)
+ // if (controlBar.Progress == 0 || controlBar.Progress == 100 || (DateTime.Now - function.refreshTime).TotalMilliseconds > 300)
// {
- // curtain.percent = e;
- // curtain.refreshTime = DateTime.Now;
+ // function.percent = e;
+ // function.refreshTime = DateTime.Now;
// System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- // d.Add("percent", curtain.percent.ToString());
- // Control.SendWriteCommand(curtain, d);
+ // d.Add("percent", function.percent.ToString());
+ // Control.SendWriteCommand(function, d);
// }
// })
// { IsBackground = true }.Start();
@@ -237,11 +237,11 @@
controlBar.Progress = curtainSeekBar.Progress;
new System.Threading.Thread(() =>
{
- curtain.percent = e;
- curtain.refreshTime = DateTime.Now;
+ function.SetAttrState(FunctionAttributeKey.Percent, e);
+ function.refreshTime = DateTime.Now;
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.Percent, curtain.percent.ToString());
- DriverLayer.Control.Ins.SendWriteCommand(curtain, d);
+ d.Add(FunctionAttributeKey.Percent, e.ToString());
+ DriverLayer.Control.Ins.SendWriteCommand(function, d);
})
{ IsBackground = true }.Start();
};
@@ -251,13 +251,13 @@
// curtainSeekBar.Progress = controlBar.Progress;
// new System.Threading.Thread(() =>
// {
- // if (controlBar.Progress == 0 || controlBar.Progress == 100 || (DateTime.Now - curtain.refreshTime).TotalMilliseconds > 300)
+ // if (controlBar.Progress == 0 || controlBar.Progress == 100 || (DateTime.Now - function.refreshTime).TotalMilliseconds > 300)
// {
- // curtain.percent = e;
- // curtain.refreshTime = DateTime.Now;
+ // function.percent = e;
+ // function.refreshTime = DateTime.Now;
// System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- // d.Add("percent", curtain.percent.ToString());
- // Control.SendWriteCommand(curtain, d);
+ // d.Add("percent", function.percent.ToString());
+ // Control.SendWriteCommand(function, d);
// }
// })
// { IsBackground = true }.Start();
@@ -268,11 +268,11 @@
curtainSeekBar.Progress = controlBar.Progress;
new System.Threading.Thread(() =>
{
- curtain.percent = e;
- curtain.refreshTime = DateTime.Now;
+ function.SetAttrState(FunctionAttributeKey.Percent, e);
+ function.refreshTime = DateTime.Now;
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add("percent", curtain.percent.ToString());
- DriverLayer.Control.Ins.SendWriteCommand(curtain, d);
+ d.Add("percent", e.ToString());
+ DriverLayer.Control.Ins.SendWriteCommand(function, d);
})
{ IsBackground = true }.Start();
};
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs
index 3255433..57119a2 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs
@@ -450,8 +450,6 @@
/// </summary>
public bool Lighting = false;
-
-
public ClothesHangerControl(string iconPath1, string iconPath2, string title, string time)
{
btnIcon = new Button()
@@ -478,7 +476,7 @@
btnTime = new Button()
{
Gravity = Gravity.CenterHorizontal,
- Y = btnTitle.Bottom,
+ Y = Application.GetRealHeight(74-32),
Height = Application.GetRealHeight(32),
Text = time,
TextColor = 0x00000000,
@@ -494,29 +492,28 @@
public void ChangeTime(string newTime)
{
int.TryParse(newTime, out leftTime);
- leftTime *= 60;
if (countdownThread == null)
{
countdownThread = new System.Threading.Thread(() =>
{
while (true)
{
- if (leftTime > 1)
+ if (leftTime > 0)
{
Application.RunOnMainThread(() =>
{
- btnTime.Text = new TimeSpan(0, 0, leftTime).ToString();
+ btnTime.Text = new TimeSpan(0, leftTime, 0).ToString().Remove(5,3) ;
});
- System.Threading.Thread.Sleep(1000);
leftTime--;
}
- else
+ else if(leftTime == 0)
{
Application.RunOnMainThread(() =>
{
btnTime.Text = "";
});
}
+ System.Threading.Thread.Sleep(60000);
}
})
{ IsBackground = true };
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPage.cs
index 7d8c20e..05e47f6 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPage.cs
@@ -31,7 +31,8 @@
#endregion
#region 鍖哄煙鍙橀噺
- Fan fan;
+ Fan fanTemp = new Fan();
+ Function function;
Button btnCollection_Out;
Button btnFunctionName_Out;
Button btnFromFloor_Out;
@@ -44,7 +45,7 @@
public FanPage(Function func)
{
bodyView = this;
- fan = func as Fan;
+ function = func;
}
@@ -74,7 +75,7 @@
TextColor = CSS_Color.FirstLevelTitleColor,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
- Text = fan.name,
+ Text = function.name,
};
controlView.AddChidren(btnFunctionName);
@@ -87,7 +88,7 @@
TextColor = CSS_Color.PromptingColor1,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- Text = fan.GetRoomListName()
+ Text = function.GetRoomListName()
};
controlView.AddChidren(btnFromFoorAndRoom);
@@ -99,7 +100,7 @@
Height = Application.GetMinRealAverage(40),
SelectedImagePath = "Collection/CollectionIcon.png",
UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
- IsSelected = fan.collect
+ IsSelected = function.collect
};
//controlView.AddChidren(btnCollection);
//2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳�
@@ -114,7 +115,7 @@
Y = Application.GetRealHeight(100),
Width = Application.GetRealWidth(198),
Height = Application.GetRealWidth(198),
- IsSelected = fan.trait_on_off.curValue.ToString() == "on",
+ IsSelected = function.trait_on_off.curValue.ToString() == "on",
SelectedImagePath = "FunctionIcon/Electrical/FanIconBg.png",
UnSelectedImagePath = "FunctionIcon/Electrical/FanIconBgGray.png",
};
@@ -166,17 +167,17 @@
Height = Application.GetMinRealAverage(40),
UnSelectedImagePath = "Public/PowerClose.png",
SelectedImagePath = "Public/PowerOpen.png",
- IsSelected = fan.trait_on_off.curValue.ToString() == "on"
+ IsSelected = function.trait_on_off.curValue.ToString() == "on"
};
controlView.AddChidren(btnSwitch);
LoadEventList();
- new TopViewDiv(bodyView, Language.StringByID(StringId.Fan)).LoadTopView_FunctionTop(fan, actionRefresh);
+ new TopViewDiv(bodyView, Language.StringByID(StringId.Fan)).LoadTopView_FunctionTop(function, actionRefresh);
new System.Threading.Thread(() =>
{
- DriverLayer.Control.Ins.SendReadCommand(fan);
+ DriverLayer.Control.Ins.SendReadCommand(function);
})
{ IsBackground = true }.Start();
}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs
index 11f6b3b..86a0e73 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/FanPageBLL.cs
@@ -10,7 +10,7 @@
/// <summary>
/// 鏇存柊鐏厜鐘舵��
/// </summary>
- public static void UpdataState(Fan uFan)
+ public static void UpdataState(Function updateTemp)
{
Application.RunOnMainThread(() =>
{
@@ -18,9 +18,9 @@
{
if (bodyView == null)
return;
- bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = uFan.trait_on_off.curValue.ToString() == "on";
- bodyView.barGradualChange.ProgressBarColor = uFan.trait_on_off.curValue.ToString() == "on" ? CSS.CSS_Color.MainColor : CSS.CSS_Color.PromptingColor2;
- bodyView.barGradualChange.Progress = uFan.openLevel;
+ bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = updateTemp.trait_on_off.curValue.ToString() == "on";
+ bodyView.barGradualChange.ProgressBarColor = updateTemp.trait_on_off.curValue.ToString() == "on" ? CSS.CSS_Color.MainColor : CSS.CSS_Color.PromptingColor2;
+ bodyView.barGradualChange.Progress = Convert.ToInt32(updateTemp.GetAttrState(FunctionAttributeKey.OpenLevel));
}
catch (Exception ex)
{
@@ -38,9 +38,9 @@
//鍥為��鍒锋柊淇℃伅浜嬩欢
actionRefresh = () => {
- btnFunctionName.Text = btnFunctionName_Out.Text = fan.name;
- btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = fan.GetRoomListName();
- //fan.SaveFunctionData(true);
+ btnFunctionName.Text = btnFunctionName_Out.Text = function.name;
+ btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName();
+ //function.SaveFunctionData(true);
};
}
@@ -50,8 +50,8 @@
void LoadCollectionEvent()
{
btnCollection.MouseUpEventHandler += (sender, e) => {
- btnCollection.IsSelected = fan.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
- fan.CollectFunction();
+ btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
+ function.CollectFunction();
};
}
@@ -66,11 +66,11 @@
new System.Threading.Thread(() =>
{
- fan.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
- //Control.Send(CommandType_A.write, this.fan);
+ function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
+ //Control.Send(CommandType_A.write, this.function);
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add("on_off", fan.trait_on_off.curValue.ToString());
- Control.Ins.SendWriteCommand(fan, d);
+ d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString());
+ Control.Ins.SendWriteCommand(function, d);
})
{ IsBackground = true }.Start();
};
@@ -80,24 +80,22 @@
new System.Threading.Thread(() =>
{
- fan.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
- //Control.Send(CommandType_A.write, this.fan);
+ function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add("on_off", fan.trait_on_off.curValue.ToString());
- Control.Ins.SendWriteCommand(fan, d);
+ d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString());
+ Control.Ins.SendWriteCommand(function, d);
})
{ IsBackground = true }.Start();
};
barGradualChange.OnProgressChangedEvent = (sender, e) => {
- fan.openLevel = e;
+ function.SetAttrState(FunctionAttributeKey.OpenLevel, e.ToString());
new System.Threading.Thread(() =>
{
- fan.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
- //Control.Send(CommandType_A.write, this.fan);
+ function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add("on_off", fan.trait_on_off.curValue.ToString());
- Control.Ins.SendWriteCommand(fan, d);
+ d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString());
+ Control.Ins.SendWriteCommand(function, d);
})
{ IsBackground = true }.Start();
};
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPage.cs
index 8c2b3dc..f34d757 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPage.cs
@@ -30,7 +30,8 @@
#endregion
#region 鍖哄煙鍙橀噺
- SwitchSocket socketFunction;
+ SwitchSocket socketTemp;
+ Function function;
Button btnCollection_Out;
Button btnFunctionName_Out;
Button btnFromFloor_Out;
@@ -43,7 +44,7 @@
public SocketPage(Function func)
{
bodyView = this;
- socketFunction = func as SwitchSocket;
+ function = func ;
}
@@ -73,7 +74,7 @@
TextColor = CSS_Color.FirstLevelTitleColor,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
- Text = socketFunction.name,
+ Text = function.name,
};
controlView.AddChidren(btnFunctionName);
@@ -86,7 +87,7 @@
TextColor = CSS_Color.PromptingColor1,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- Text = socketFunction.GetRoomListName()
+ Text = function.GetRoomListName()
};
controlView.AddChidren(btnFromFoorAndRoom);
@@ -98,7 +99,7 @@
Height = Application.GetMinRealAverage(40),
SelectedImagePath = "Collection/CollectionIcon.png",
UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
- IsSelected = socketFunction.collect
+ IsSelected = function.collect
};
//controlView.AddChidren(btnCollection);
//2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳�
@@ -113,7 +114,7 @@
Y = Application.GetRealHeight(100),
Width = Application.GetRealWidth(198),
Height = Application.GetRealWidth(198),
- IsSelected = socketFunction.trait_on_off.curValue.ToString() == "on",
+ IsSelected = function.trait_on_off.curValue.ToString() == "on",
UnSelectedImagePath = "FunctionIcon/Socket/SocketIconBg.png",
SelectedImagePath = "FunctionIcon/Socket/SocketIconOnBg.png",
};
@@ -127,16 +128,16 @@
Height = Application.GetMinRealAverage(40),
UnSelectedImagePath = "Public/PowerClose.png",
SelectedImagePath = "Public/PowerOpen.png",
- IsSelected = socketFunction.trait_on_off.curValue.ToString() == "on"
+ IsSelected = function.trait_on_off.curValue.ToString() == "on"
};
controlView.AddChidren(btnSwitch);
LoadEventList();
- new TopViewDiv(bodyView, Language.StringByID(StringId.Socket)).LoadTopView_FunctionTop(socketFunction, actionRefresh);
+ new TopViewDiv(bodyView, Language.StringByID(StringId.Socket)).LoadTopView_FunctionTop(function, actionRefresh);
new System.Threading.Thread(() =>
{
- DriverLayer.Control.Ins.SendReadCommand(socketFunction);
+ DriverLayer.Control.Ins.SendReadCommand(function);
})
{ IsBackground = true }.Start();
}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs
index 5dde93c..300b194 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs
@@ -10,7 +10,7 @@
/// <summary>
/// 鏇存柊鐏厜鐘舵��
/// </summary>
- public static void UpdataState(SwitchSocket uFan)
+ public static void UpdataState(Function uFan)
{
Application.RunOnMainThread(() =>
{
@@ -36,9 +36,9 @@
//鍥為��鍒锋柊淇℃伅浜嬩欢
actionRefresh = () => {
- btnFunctionName.Text = btnFunctionName_Out.Text = socketFunction.name;
- btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = socketFunction.GetRoomListName();
- socketFunction.UpdataFuncitonInfo();
+ btnFunctionName.Text = btnFunctionName_Out.Text = function.name;
+ btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName();
+ function.UpdataFuncitonInfo();
};
}
@@ -48,8 +48,8 @@
void LoadCollectionEvent()
{
btnCollection.MouseUpEventHandler += (sender, e) => {
- btnCollection.IsSelected = socketFunction.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
- socketFunction.CollectFunction();
+ btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
+ function.CollectFunction();
};
}
@@ -64,11 +64,11 @@
new System.Threading.Thread(() =>
{
- socketFunction.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
- //Control.Send(CommandType_A.write, this.socketFunction);
+ function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
+ //Control.Send(CommandType_A.write, this.function);
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add("on_off", socketFunction.trait_on_off.curValue.ToString());
- Control.Ins.SendWriteCommand(socketFunction, d);
+ d.Add("on_off", function.trait_on_off.curValue.ToString());
+ Control.Ins.SendWriteCommand(function, d);
})
{ IsBackground = true }.Start();
};
@@ -78,11 +78,11 @@
new System.Threading.Thread(() =>
{
- socketFunction.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
- //Control.Send(CommandType_A.write, this.socketFunction);
+ function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
+ //Control.Send(CommandType_A.write, this.function);
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add("on_off", socketFunction.trait_on_off.curValue.ToString());
- Control.Ins.SendWriteCommand(socketFunction, d);
+ d.Add("on_off", function.trait_on_off.curValue.ToString());
+ Control.Ins.SendWriteCommand(function, d);
})
{ IsBackground = true }.Start();
};
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPage.cs
index 737c59b..b9bc1a6 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPage.cs
@@ -43,7 +43,8 @@
#endregion
#region 鍖哄煙鍙橀噺
- TV tv;
+ TV tvTemp = new TV();
+ Function function;
Button btnCollection_Out;
Button btnFunctionName_Out;
Button btnFromFloor_Out;
@@ -56,7 +57,7 @@
public TVPage(Function func)
{
bodyView = this;
- tv = func as TV;
+ function = func;
}
@@ -86,7 +87,7 @@
TextColor = CSS_Color.FirstLevelTitleColor,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
- Text = tv.name,
+ Text = function.name,
};
controlView.AddChidren(btnFunctionName);
@@ -99,7 +100,7 @@
TextColor = CSS_Color.PromptingColor1,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- Text = tv.GetRoomListName()
+ Text = function.GetRoomListName()
};
controlView.AddChidren(btnFromFoorAndRoom);
@@ -111,7 +112,7 @@
Height = Application.GetMinRealAverage(40),
SelectedImagePath = "Collection/CollectionIcon.png",
UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
- IsSelected = tv.collect
+ IsSelected = function.collect
};
//controlView.AddChidren(btnCollection);
//2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳�
@@ -335,8 +336,8 @@
LoadEventList();
- new TopViewDiv(bodyView, Language.StringByID(StringId.TV)).LoadTopView_FunctionTop(tv, actionRefresh);
- DriverLayer.Control.Ins.SendReadCommand(tv);
+ new TopViewDiv(bodyView, Language.StringByID(StringId.TV)).LoadTopView_FunctionTop(function, actionRefresh);
+ DriverLayer.Control.Ins.SendReadCommand(function);
}
@@ -420,7 +421,7 @@
numberView.AddChidren(btn);
btn.MouseUpEventHandler = (sender, e) => {
btn.IsSelected = false;
- tv.ControlTV(i);
+ tvTemp.ControlTV(i,function);
};
btn.MouseDownEventHandler = (sender, e) => {
btn.IsSelected = true;
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs
index ea72033..2467e67 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs
@@ -16,9 +16,9 @@
//鍥為��鍒锋柊淇℃伅浜嬩欢
actionRefresh = () => {
- btnFunctionName.Text = btnFunctionName_Out.Text = tv.name;
- btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = tv.GetRoomListName();
- tv.UpdataFuncitonInfo();
+ btnFunctionName.Text = btnFunctionName_Out.Text = function.name;
+ btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName();
+ function.UpdataFuncitonInfo();
};
}
@@ -28,8 +28,8 @@
void LoadCollectionEvent()
{
btnCollection.MouseUpEventHandler += (sender, e) => {
- btnCollection.IsSelected = tv.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
- tv.CollectFunction();
+ btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
+ function.CollectFunction();
};
}
@@ -40,32 +40,32 @@
{
btnChangeTVAV.MouseUpEventHandler = (sender, e) =>
{
- tv.ControlTV(InfraredCode_TV.AV_TV);
+ tvTemp.ControlTV(InfraredCode_TV.AV_TV,function);
};
btnChlPlus.MouseUpEventHandler = (sender, e) =>
{
- tv.ControlTV(InfraredCode_TV.ChannelUp);
+ tvTemp.ControlTV(InfraredCode_TV.ChannelUp, function);
};
btnChlReduce.MouseUpEventHandler = (sender, e) =>
{
- tv.ControlTV(InfraredCode_TV.ChannelDown);
+ tvTemp.ControlTV(InfraredCode_TV.ChannelDown, function);
};
btnVolPlus.MouseUpEventHandler = (sender, e) =>
{
- tv.ControlTV(InfraredCode_TV.VolUp);
+ tvTemp.ControlTV(InfraredCode_TV.VolUp, function);
};
btnVolReduce.MouseUpEventHandler = (sender, e) =>
{
- tv.ControlTV(InfraredCode_TV.VolDown);
+ tvTemp.ControlTV(InfraredCode_TV.VolDown, function);
};
btnBack.MouseUpEventHandler = (sender, e) =>
{
- tv.ControlTV(InfraredCode_TV.Back);
+ tvTemp.ControlTV(InfraredCode_TV.Back, function);
};
btnMenu.MouseUpEventHandler = (sender, e) =>
{
- tv.ControlTV(InfraredCode_TV.Menu);
+ tvTemp.ControlTV(InfraredCode_TV.Menu, function);
};
btn123.MouseUpEventHandler = (sender, e) =>
{
@@ -73,27 +73,27 @@
};
btnMute.MouseUpEventHandler = (sender, e) =>
{
- tv.ControlTV(InfraredCode_TV.Mute);
+ tvTemp.ControlTV(InfraredCode_TV.Mute, function);
};
btnPower.MouseUpEventHandler = (sender, e) =>
{
- tv.ControlTV(InfraredCode_TV.Power);
+ tvTemp.ControlTV(InfraredCode_TV.Power, function);
};
btnTopMenuUp.MouseUpEventHandler = (sender, e) => {
- tv.ControlTV(InfraredCode_TV.Up);
+ tvTemp.ControlTV(InfraredCode_TV.Up, function);
};
btnTopMenuLeft.MouseUpEventHandler = (sender, e) => {
- tv.ControlTV(InfraredCode_TV.Left);
+ tvTemp.ControlTV(InfraredCode_TV.Left, function);
};
btnTopMenuRight.MouseUpEventHandler = (sender, e) => {
- tv.ControlTV(InfraredCode_TV.Right);
+ tvTemp.ControlTV(InfraredCode_TV.Right, function);
};
btnTopMenuDown.MouseUpEventHandler = (sender, e) => {
- tv.ControlTV(InfraredCode_TV.Down);
+ tvTemp.ControlTV(InfraredCode_TV.Down, function);
};
btnOk.MouseUpEventHandler = (sender, e) => {
- tv.ControlTV(InfraredCode_TV.Confrim);
+ tvTemp.ControlTV(InfraredCode_TV.Confrim, function);
};
}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs
index cbd8d7e..b830595 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs
@@ -50,6 +50,7 @@
#region 鍖哄煙鍙橀噺
Room room;
+ Sensor sensorTemp = new Sensor();
#endregion
@@ -349,7 +350,7 @@
{
sensorListView.RemoveAll();
int index = 0;
- foreach (var sensor in FunctionList.List.sensorsEnvironmentalScience)
+ foreach (var sensor in FunctionList.List.GetEnvirSensorsList())
{
LoadSensorDiv(sensor, index);
index++;
@@ -359,8 +360,11 @@
/// <summary>
/// 鍔犺浇浼犳劅鍣ㄥ垪琛�
/// </summary>
- void LoadSensorDiv(Sensor sensor,int index)
+ void LoadSensorDiv(Function sensor,int index)
{
+ var levelColorList = sensorTemp.GetLevelColorList(sensor.spk);
+ var levelTextList = sensorTemp.GetLevelTextList(sensor.spk);
+
if (room.roomId == "" || sensor.roomIds.Contains(room.roomId))
{
var sensorTag = sensor.sid;
@@ -388,10 +392,10 @@
Width = Application.GetRealWidth(48),
Height = Application.GetRealWidth(48),
OpenAngle = 10,
- ProgressBarColor = sensor.levelColorList[sensor.curLevel - 1],
+ ProgressBarColor = sensorTemp.GetLevelColorList(sensor.spk)[sensorTemp.GetCurLevel(sensor) - 1],
MinValue = 0,
MaxValue = 96,
- Progress = (96 / sensor.levelColorList.Count) * sensor.curLevel,
+ Progress = (96 / sensorTemp.GetLevelColorList(sensor.spk).Count * sensorTemp.GetCurLevel(sensor)),
IsClickable = false,
ArcColor = CSS_Color.BackgroundColor,
ArcWidth = Application.GetRealWidth(4),
@@ -409,7 +413,7 @@
TextAlignment = TextAlignment.Center,
TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
TextColor = CSS_Color.FirstLevelTitleColor,
- TextID = sensor.functionTypeNameId,
+ TextID = sensorTemp.GetFunctionTypeNameId(sensor.spk),
Tag = "SensorTitle"
};
sensorView.AddChidren(btnSensorTitle);
@@ -445,7 +449,7 @@
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.EmphasisFontSize_Secondary,
IsBold = true,
- Text = sensor.values.ToString(),
+ Text = sensor.GetAttrState(FunctionAttributeKey.Value),
Tag = "SensorValues"
};
sensorView.AddChidren(btnSensorValues);
@@ -457,9 +461,9 @@
Width = Application.GetRealWidth(50),
Height = Application.GetRealWidth(18),
TextAlignment = TextAlignment.CenterLeft,
- TextColor = sensor.levelColorList[sensor.curLevel - 1],
+ TextColor = levelColorList[sensorTemp.GetCurLevel( sensor) - 1],
TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
- TextID = sensor.levelTextList[sensor.curLevel - 1],
+ TextID = levelTextList[sensorTemp.GetCurLevel(sensor) - 1],
Tag = "SensorLevel"
};
sensorView.AddChidren(btnLevel);
@@ -471,8 +475,10 @@
/// <summary>
/// 鍔犺浇浼犳劅鍣ㄧ瓑绾х浉鍏充俊鎭�
/// </summary>
- void LoadInfo(Sensor sensor)
+ void LoadInfo(Function sensor)
{
+ var levelColorList = sensorTemp.GetLevelColorList(sensor.spk);
+ var levelTextList = sensorTemp.GetLevelTextList(sensor.spk);
Dialog dialog = new Dialog();
FrameLayout dialogBodyView = new FrameLayout();
@@ -481,13 +487,12 @@
{
dialog.Close();
};
-
VerticalScrolViewLayout infoView = new VerticalScrolViewLayout()
{
Gravity = Gravity.CenterHorizontal,
- Y = Application.GetRealHeight(667 - 94 - (sensor.levelColorList.Count * 44) - 20),
+ Y = Application.GetRealHeight(667 - 94 - (levelColorList.Count * 44) - 20),
Width = Application.GetRealWidth(343),
- Height = Application.GetRealHeight(94 + (sensor.levelColorList.Count * 44) + sensor.levelColorList.Count),
+ Height = Application.GetRealHeight(94 + (levelColorList.Count * 44) + levelColorList.Count),
Radius = (uint)Application.GetRealWidth(12),
BackgroundColor = CSS_Color.MainBackgroundColor,
Animate = Animate.DownToUp,
@@ -563,7 +568,7 @@
IsBold = true,
TextID = StringId.ColorValue,
});
- for (int index = 0; index < sensor.levelTextList.Count; index++)
+ for (int index = 0; index < levelTextList.Count; index++)
{
infoView.AddChidren(new Button()
{
@@ -587,7 +592,7 @@
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.TextFontSize,
IsBold = true,
- Text = sensor.intervalValue[index]
+ Text = sensorTemp.GetIntervalValue(sensor.spk)[index]
});
subInfoView.AddChidren(new Button()
@@ -598,7 +603,7 @@
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.TextFontSize,
IsBold = true,
- TextID = sensor.levelTextList[index]
+ TextID = levelTextList[index]
});
subInfoView.AddChidren(new Button()
@@ -608,7 +613,7 @@
Width = Application.GetRealWidth(38),
Height = Application.GetRealHeight(18),
Radius = (uint)Application.GetRealWidth(4),
- BackgroundColor = sensor.levelColorList[index]
+ BackgroundColor = levelColorList[index]
});
}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePageBLL.cs
index c9b08eb..0a37a2e 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePageBLL.cs
@@ -11,14 +11,14 @@
}
- public static void LoadEvent_UpdataStatus(Sensor sensor)
+ public static void LoadEvent_UpdataStatus(Function updateTemp)
{
Application.RunOnMainThread(() =>{
if (bodyView != null)
{
for (int i = 0; i < bodyView.sensorListView.ChildrenCount; i++)
{
- var sensorTag = sensor.sid;
+ var sensorTag = updateTemp.sid;
var view = bodyView.sensorListView.GetChildren(i);
if (view.GetType() == typeof(FrameLayout))
{
@@ -36,20 +36,20 @@
var tag = btn.Tag.ToString();
if (tag == "SensorValues")
{
- (btn as Button).Text = sensor.values.ToString();
+ (btn as Button).Text = updateTemp.GetAttrState(FunctionAttributeKey.Value);
}
else if (tag == "SensorLevel")
{
- (btn as Button).TextID = sensor.levelTextList[sensor.curLevel - 1];
- (btn as Button).TextColor = sensor.levelColorList[sensor.curLevel - 1];
+ (btn as Button).TextID = bodyView.sensorTemp.GetLevelTextList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1];
+ (btn as Button).TextColor = bodyView.sensorTemp.GetLevelColorList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1];
}
}
}
else if (btn.GetType() == typeof(ArcSeekBar))
{
- (btn as ArcSeekBar).ProgressBarColor = sensor.levelColorList[sensor.curLevel - 1];
+ (btn as ArcSeekBar).ProgressBarColor = bodyView.sensorTemp.GetLevelColorList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1];
- (btn as ArcSeekBar).Progress = (96 / sensor.levelColorList.Count) * sensor.curLevel;
+ (btn as ArcSeekBar).Progress = (96 / bodyView.sensorTemp.GetLevelColorList(updateTemp.spk).Count) * bodyView.sensorTemp.GetCurLevel(updateTemp);
}
}
}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs
index 594196b..cd98b4c 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs
@@ -21,9 +21,10 @@
MyEchartsViewOn myEchartsView;
- Sensor sensor;
+ Sensor sensorTemp = new Sensor();
- List<Sensor> showSensors;
+ Function function;
+ List<Function> showFunctions;
/// <summary>
/// 褰撳墠鏌ヨ绫诲瀷
/// </summary>
@@ -39,12 +40,12 @@
"#80AEFF","#FFD154","#FF9D54","#FE6A6A","#B183C3","#ADE764",
};
- public EnvironmentalSensorPage(Sensor ss)
+ public EnvironmentalSensorPage(Function ss)
{
bodyView = this;
- sensor = ss;
- showSensors = new List<Sensor>();
- showSensors.Add(ss);
+ function = ss;
+ showFunctions = new List<Function>();
+ showFunctions.Add(ss);
}
public void LoadPage()
@@ -163,7 +164,7 @@
};
diagramView.AddChidren(tipTextView);
- switch (sensor.spk)
+ switch (function.spk)
{
case SPK.SensorPm25:
tipValuesView.AddChidren(new Button()
@@ -552,7 +553,7 @@
TextAlignment = TextAlignment.CenterLeft,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.TextFontSize,
- Text = sensor.name,
+ Text = function.name,
IsBold = true,
};
selfInfoView.AddChidren(btnSeltSensorName);
@@ -566,7 +567,7 @@
TextColor = CSS_Color.PromptingColor1,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- Text = sensor.GetRoomListName()
+ Text = function.GetRoomListName()
};
selfInfoView.AddChidren(btnFromFoorAndRoom);
@@ -628,9 +629,9 @@
{
Action backAction = () =>
{
- btnSeltSensorName.Text = sensor.name;
+ btnSeltSensorName.Text = function.name;
};
- var infoView = new FunctionBaseInfoSetPage(sensor, backAction);
+ var infoView = new FunctionBaseInfoSetPage(function, backAction);
MainPage.BasePageView.AddChidren(infoView);
infoView.LoadPage();
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
@@ -642,13 +643,13 @@
bool initTitleButton = true;
- foreach (var tempSensor in FunctionList.List.sensorsEnvironmentalScience)
+ foreach (var tempSensor in FunctionList.List.GetEnvirSensorsList())
{
- if (tempSensor.sid == sensor.sid)
+ if (tempSensor.sid == function.sid)
{
continue;
}
- if (tempSensor.spk != sensor.spk)
+ if (tempSensor.spk != function.spk)
{
continue;
}
@@ -705,7 +706,7 @@
TextAlignment = TextAlignment.CenterLeft,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.TextFontSize,
- Text = sensor.name,
+ Text = function.name,
IsBold = true,
};
otherInfoView.AddChidren(btnSensorName);
@@ -772,16 +773,16 @@
btnShowData1.IsSelected = !btnShowData1.IsSelected;
if (btnShowData1.IsSelected)
{
- if (!showSensors.Contains(sensor))
+ if (!showFunctions.Contains(function))
{
- showSensors.Add(sensor);
+ showFunctions.Add(function);
}
}
else
{
- if (showSensors.Contains(sensor))
+ if (showFunctions.Contains(function))
{
- showSensors.Remove(sensor);
+ showFunctions.Remove(function);
}
}
LoadMothed_GetSensorHistoryData();
@@ -790,7 +791,7 @@
}
#endregion
- new TopViewDiv(bodyView, Language.StringByID(sensor.functionTypeNameId)).LoadTopView();
+ new TopViewDiv(bodyView, Language.StringByID(sensorTemp.GetFunctionTypeNameId(function.spk))).LoadTopView();
LoadMothed_GetSensorHistoryData();
LoadEvent_ChangeSensorHistoryShowType();
@@ -824,13 +825,13 @@
});
int i = 0;
- foreach (var sr in FunctionList.List.sensorsEnvironmentalScience)
+ foreach (var sr in FunctionList.List.GetEnvirSensorsList())
{
- if (sr.spk != sensor.spk)
+ if (sr.spk != function.spk)
{
continue;
}
- if (showSensors.Find((obj) => obj.sid == sr.sid) == null)
+ if (showFunctions.Find((obj) => obj.sid == sr.sid) == null)
{
i++;
continue;
diff --git a/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPage.cs b/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPage.cs
index e798a2e..7e1565f 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPage.cs
@@ -23,7 +23,7 @@
/// </summary>
Button btnCollection;
/// <summary>
- /// 绌鸿皟娓╁害鎺у埗鎺т欢
+ /// 娓╁害鎺у埗鎺т欢
/// </summary>
DiyArcSeekBar arcBar;
/// <summary>
@@ -62,7 +62,8 @@
#endregion
#region 鍖哄煙鍙橀噺
- FloorHeating fh;
+ FloorHeating fhTemp = new FloorHeating();
+ Function function;
Button btnCollection_Out;
Button btnFunctionName_Out;
Button btnFromFloor_Out;
@@ -71,10 +72,10 @@
/// </summary>
Action actionRefresh;
#endregion
- public FloorHeatingPage(FloorHeating func)
+ public FloorHeatingPage(Function func)
{
bodyView = this;
- fh = func;
+ function = func;
}
public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut)
@@ -103,7 +104,7 @@
TextColor = CSS_Color.FirstLevelTitleColor,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
- Text = fh.name,
+ Text = function.name,
};
controlView.AddChidren(btnFunctionName);
@@ -116,7 +117,7 @@
TextColor = CSS_Color.PromptingColor1,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- Text = fh.GetRoomListName()
+ Text = function.GetRoomListName()
};
controlView.AddChidren(btnFromFoorAndRoom);
@@ -128,7 +129,7 @@
Height = Application.GetMinRealAverage(40),
SelectedImagePath = "Collection/CollectionIcon.png",
UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
- IsSelected = fh.collect
+ IsSelected = function.collect
};
//controlView.AddChidren(btnCollection);
//2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳�
@@ -141,16 +142,15 @@
{
Gravity = Gravity.CenterHorizontal,
OpenAngle = 160,
- ThumbImagePath = fh.trait_on_off.curValue.ToString() == "on" ? "FunctionIcon/FloorHeating/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png",
+ ThumbImagePath = function.trait_on_off.curValue.ToString() == "on" ? "FunctionIcon/FloorHeating/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png",
ThumbImageHeight = Application.GetRealWidth(50),
ProgressBarColor = CSS_Color.AuxiliaryColor1, // 0xFFFC9C04,
OfflineProgressBarColor = CSS_Color.PromptingColor2,
- IsOffline = fh.trait_on_off.curValue.ToString() == "off",
- MinValue = fh.trait_temp.min,
- MaxValue = fh.trait_temp.max,
- //IsClickable = fh.trait_on_off.curValue.ToString() == "on",
+ IsOffline = function.trait_on_off.curValue.ToString() == "off",
+ MinValue = function.GetAttribute(FunctionAttributeKey.SetTemp).min,
+ MaxValue = function.GetAttribute(FunctionAttributeKey.SetTemp).max,
ArcColor = CSS_Color.BackgroundColor,
- Progress = Convert.ToInt32(fh.trait_temp.curValue),
+ Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.SetTemp)),
#if __IOS__
Y = Application.GetRealHeight(120+25),
Width = Application.GetRealWidth(260-40),
@@ -175,7 +175,7 @@
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = 56,
IsBold = true,
- Text = fh.trait_temp.curValue.ToString(),
+ Text = function.GetAttrState(FunctionAttributeKey.SetTemp),
TextAlignment = TextAlignment.Center,
};
controlView.AddChidren(btnTemp);
@@ -190,7 +190,7 @@
TextSize = CSS_FontSize.EmphasisFontSize_Secondary,
IsBold = true,
TextAlignment = TextAlignment.CenterLeft,
- Text = fh.tempUnitString
+ Text = fhTemp.GetTempUnitString(function)
};
controlView.AddChidren(btnTempUint);
@@ -232,7 +232,7 @@
Y = Application.GetRealHeight(337),
Width = Application.GetRealWidth(30),
Height = Application.GetRealWidth(30),
- UnSelectedImagePath = fh.curModeImage,
+ UnSelectedImagePath = fhTemp.GetModeImage(function)
};
controlView.AddChidren(btnMode);
@@ -244,15 +244,15 @@
Height = Application.GetRealWidth(32),
UnSelectedImagePath = "Public/PowerClose.png",
SelectedImagePath = "Public/PowerOpen.png",
- IsSelected = fh.trait_on_off.curValue.ToString() == "on"
+ IsSelected = function.trait_on_off.curValue.ToString() == "on"
};
controlView.AddChidren(btnSwitch);
LoadEventList();
- new TopViewDiv(bodyView, Language.StringByID(StringId.FloorHeating)).LoadTopView_FunctionTop(fh, actionRefresh);
+ new TopViewDiv(bodyView, Language.StringByID(StringId.FloorHeating)).LoadTopView_FunctionTop(function, actionRefresh);
new System.Threading.Thread(() =>
{
- DriverLayer.Control.Ins.SendReadCommand(fh);
+ DriverLayer.Control.Ins.SendReadCommand(function);
})
{ IsBackground = true }.Start();
}
@@ -304,28 +304,29 @@
};
modeChangeView.AddChidren(btnLine);
- foreach (var m in fh.trait_mode.value)
+ var modeList = function.GetAttribute(FunctionAttributeKey.Mode).value;
+ foreach (var m in modeList)
{
Button btnModeIcon = new Button()
{
X = btnTitle.X,
- Y = Application.GetRealHeight(44 * (fh.trait_mode.value.IndexOf(m) + 1) + 10 + 8),
+ Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8),
Width = Application.GetRealWidth(24),
Height = Application.GetRealWidth(24),
- IsSelected = fh.trait_mode.curValue.ToString() == m,
+ IsSelected = function.GetAttrState(FunctionAttributeKey.Mode) == m,
};
modeChangeView.AddChidren(btnModeIcon);
Button btnModeText = new Button()
{
X = Application.GetRealWidth(12) + btnModeIcon.Right,
- Y = Application.GetRealHeight(44 * (fh.trait_mode.value.IndexOf(m) + 1) + 8),
+ Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 8),
Height = Application.GetRealHeight(44),
Width = Application.GetRealWidth(70),
TextAlignment = TextAlignment.CenterLeft,
TextColor = CSS_Color.FirstLevelTitleColor,
SelectedTextColor = CSS_Color.MainColor,
- IsSelected = fh.trait_mode.curValue.ToString() == m,
+ IsSelected = function.GetAttrState(FunctionAttributeKey.Mode) == m,
};
modeChangeView.AddChidren(btnModeText);
@@ -358,7 +359,7 @@
break;
}
- if (fh.trait_mode.value.IndexOf(m) < fh.trait_mode.value.Count - 1)
+ if (modeList.IndexOf(m) < modeList.Count - 1)
{
modeChangeView.AddChidren(new Button()
{
diff --git a/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs
index 8a716e8..c60d77b 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPageBLL.cs
@@ -9,7 +9,7 @@
public partial class FloorHeatingPage
{
- public static void UpdataStates(FloorHeating uFh)
+ public static void UpdataStates(Function updateTemp)
{
try
{
@@ -19,11 +19,11 @@
{
return;
}
- bodyView.btnTemp.Text = uFh.trait_temp.curValue.ToString();
- bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(uFh.trait_IndoorTemp.curValue)) + "掳C";
- bodyView.btnMode.UnSelectedImagePath = uFh.curModeImage;
- bodyView.arcBar.Progress = Convert.ToInt32(Convert.ToDouble(uFh.trait_temp.curValue));
- if (uFh.trait_on_off.curValue.ToString() == "on")
+ bodyView.btnTemp.Text = updateTemp.GetAttrState(FunctionAttributeKey.SetTemp);
+ bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState(FunctionAttributeKey.IndoorTemp))) + "掳C";
+ bodyView.btnMode.UnSelectedImagePath = bodyView.fhTemp.GetModeImage(updateTemp);
+ bodyView.arcBar.Progress = Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState(FunctionAttributeKey.SetTemp)));
+ if (updateTemp.trait_on_off.curValue.ToString() == "on")
{
bodyView.arcBar.ThumbImagePath = "FunctionIcon/FloorHeating/DiyThumbIconOn.png";
bodyView.btnSwitch.IsSelected = true;
@@ -51,9 +51,9 @@
//鍥為��鍒锋柊淇℃伅浜嬩欢
actionRefresh = () =>
{
- btnFunctionName.Text = btnFunctionName_Out.Text = fh.name;
- btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = fh.GetRoomListName();
- //fh.SaveFunctionData(true);
+ btnFunctionName.Text = btnFunctionName_Out.Text = function.name;
+ btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName();
+ //function.SaveFunctionData(true);
};
}
@@ -64,8 +64,8 @@
{
btnCollection.MouseUpEventHandler += (sender, e) =>
{
- btnCollection.IsSelected = fh.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
- fh.CollectFunction();
+ btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
+ function.CollectFunction();
};
}
@@ -76,57 +76,55 @@
{
btnMinus.MouseUpEventHandler = (sender, e) =>
{
- if(fh.trait_on_off.curValue.ToString() == "off")
+ if(function.trait_on_off.curValue.ToString() == "off")
{
return;
}
- var temp = Convert.ToInt32(fh.trait_temp.curValue);
- if (temp < Convert.ToInt32(fh.trait_temp.min))
+ var temp = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.SetTemp));
+ if (temp < Convert.ToInt32(function.GetAttribute(FunctionAttributeKey.SetTemp).min))
{
return;
}
temp--;
arcBar.Progress = temp;
- fh.trait_temp.curValue = temp.ToString();
+ function.SetAttrState(FunctionAttributeKey.SetTemp, temp);
btnTemp.Text = temp.ToString();
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
d.Add(FunctionAttributeKey.SetTemp, temp.ToString());
- Control.Ins.SendWriteCommand(fh, d);
+ Control.Ins.SendWriteCommand(function, d);
};
btnPlus.MouseUpEventHandler = (sender, e) =>
{
- if (fh.trait_on_off.curValue.ToString() == "off")
+ if (function.trait_on_off.curValue.ToString() == "off")
{
return;
}
- var temp = Convert.ToInt32(fh.trait_temp.curValue);
- if (temp > Convert.ToInt32(fh.trait_temp.max))
+ var temp = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.SetTemp));
+ if (temp > Convert.ToInt32(function.GetAttribute(FunctionAttributeKey.SetTemp).max))
{
return;
}
temp++;
arcBar.Progress = temp;
btnTemp.Text = temp.ToString();
- fh.trait_temp.curValue = temp.ToString();
- //Control.Send(CommandType_A.write, fh);
+ function.SetAttrState(FunctionAttributeKey.SetTemp, temp);
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
d.Add(FunctionAttributeKey.SetTemp, temp.ToString());
- Control.Ins.SendWriteCommand(fh, d);
+ Control.Ins.SendWriteCommand(function, d);
};
arcBar.OnStopTrackingTouchEvent = (sender, e) =>
{
- fh.trait_temp.curValue = arcBar.Progress.ToString();
- btnTemp.Text = fh.trait_temp.curValue.ToString();
- //Control.Send(CommandType_A.write, fh);
+ function.SetAttrState(FunctionAttributeKey.SetTemp,arcBar.Progress);
+ btnTemp.Text = arcBar.Progress.ToString();
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.SetTemp, fh.trait_temp.curValue.ToString());
- Control.Ins.SendWriteCommand(fh, d);
+ d.Add(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString());
+ Control.Ins.SendWriteCommand(function, d);
};
arcBar.OnProgressChangedEvent = (sender, e) =>
{
- fh.trait_temp.curValue = e.ToString();
- btnTemp.Text = fh.trait_temp.curValue.ToString();
+ function.SetAttrState(FunctionAttributeKey.SetTemp, e);
+ btnTemp.Text = function.GetAttrState(FunctionAttributeKey.SetTemp);
};
}
/// <summary>
@@ -136,7 +134,7 @@
{
btnMode.MouseUpEventHandler = (sender, e) =>
{
- if (fh.trait_on_off.curValue.ToString() == "off")
+ if (function.trait_on_off.curValue.ToString() == "off")
{
return;
}
@@ -146,8 +144,8 @@
btnSwitch.MouseUpEventHandler = (sender, e) =>
{
btnSwitch.IsSelected = !btnSwitch.IsSelected;
- fh.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
- if (fh.trait_on_off.curValue.ToString() == "on")
+ function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
+ if (function.trait_on_off.curValue.ToString() == "on")
{
//arcBar.ProgressBarColor = CSS_Color.MainColor;
arcBar.ThumbImagePath = "FunctionIcon/FloorHeating/DiyThumbIconOn.png";
@@ -162,8 +160,8 @@
arcBar.IsOffline = true;
}
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.OnOff, fh.trait_on_off.curValue.ToString());
- Control.Ins.SendWriteCommand(fh, d);
+ d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString());
+ Control.Ins.SendWriteCommand(function, d);
};
}
@@ -181,14 +179,14 @@
EventHandler<MouseEventArgs> eventHandler1 = (sender, e) =>
{
btn1.IsSelected = btn2.IsSelected = true;
- fh.trait_mode.curValue = curMode;
+ function.SetAttrState(FunctionAttributeKey.Mode,curMode);
btnMode.UnSelectedImagePath = btn1.SelectedImagePath;
- byte pro = 6;
- fh.modeTemp.TryGetValue(curMode, out pro);
- arcBar.Progress = pro;
+ //byte pro = 6;//涓嶅鐞嗘俯搴︽樉绀猴紝绛夊緟鍥炲鏁版嵁鍐嶅鐞�
+ //function.Fh_Mode_Temp.TryGetValue(curMode, out pro);
+ //arcBar.Progress = pro;
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.Mode, fh.trait_mode.curValue.ToString());
- Control.Ins.SendWriteCommand(fh, d);
+ d.Add(FunctionAttributeKey.Mode, function.GetAttrState(FunctionAttributeKey.Mode));
+ Control.Ins.SendWriteCommand(function, d);
dialog.Close();
};
btn1.MouseUpEventHandler = eventHandler1;
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs
index a2014d0..c7305f0 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPage.cs
@@ -53,7 +53,8 @@
#endregion
#region 鍖哄煙鍙橀噺
- Light light;
+ Light lightTemp = new Light();
+ Function function;
Button btnCollection_Out;
Button btnFunctionName_Out;
Button btnFromFloor_Out;
@@ -70,10 +71,10 @@
bodyView = null;
}
- public ColorTureLampPage(Light func)
+ public ColorTureLampPage(Function func)
{
bodyView = this;
- light = func;
+ function = func;
}
public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut)
@@ -82,8 +83,6 @@
btnFunctionName_Out = btnFunctionNameOut;
btnFromFloor_Out = btnFromFloorOut;
bodyView.BackgroundColor = CSS_Color.BackgroundColor;
- //new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView(light,null);
- //new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.Lights), light);
controlView = new FrameLayout()
{
@@ -104,7 +103,7 @@
TextColor = CSS_Color.FirstLevelTitleColor,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
- Text = light.name,
+ Text = function.name,
};
controlView.AddChidren(btnFunctionName);
@@ -117,7 +116,7 @@
TextColor = CSS_Color.PromptingColor1,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- Text = light.GetRoomListName()
+ Text = function.GetRoomListName()
};
controlView.AddChidren(btnFromFoorAndRoom);
@@ -129,7 +128,7 @@
Height = Application.GetMinRealAverage(40),
SelectedImagePath = "Collection/CollectionIcon.png",
UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
- IsSelected = light.collect
+ IsSelected = function.collect
};
//controlView.AddChidren(btnCollection);
//2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳�
@@ -142,16 +141,16 @@
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealHeight(108),
- Width = Application.GetRealWidth(142 - 16 -16),
+ Width = Application.GetRealWidth(142 - 16 - 16),
Height = Application.GetRealHeight(222),
BorderColor = 0x00000000,
CornerRadius = Application.GetRealWidth(20),
BorderWidth = 0,
- Progress = light.brightness,
+ Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)),
IsProgressTextShow = false,
};
controlView.AddChidren(dimmerBar);
- if (light.trait_on_off.curValue.ToString() == "on")
+ if (function.trait_on_off.curValue.ToString() == "on")
{
dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
}
@@ -159,17 +158,17 @@
{
dimmerBar.SetProgressBarColors(CSS_Color.DividingLineColor, CSS_Color.DividingLineColor);
}
- dimmerBar.Progress = light.brightness;
+ dimmerBar.Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness));
btnBrightnessText = new Button()
{
Gravity = Gravity.CenterHorizontal,
- Y = ((100 - light.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",
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
- Text = light.brightness + "%",
+ Text = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)) + "%",
};
controlView.AddChidren(btnBrightnessText);
@@ -219,7 +218,7 @@
//鏄剧ず涓婃柟鐨凾xt
barColorTemplatrue.ShowCustomTextView(Application.GetRealWidth(50), CSS_FontSize.PromptFontSize_FirstLevel, CSS_Color.FirstLevelTitleColor);
var cct = 27;
- int.TryParse(light.Attr_CCT.curValue.ToString(), out cct);
+ int.TryParse(function.GetAttrState(FunctionAttributeKey.CCT), out cct);
barColorTemplatrue.Progress = cct;
//璁剧疆鍒濆鍊�
barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K");
@@ -282,7 +281,7 @@
// ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
// ProgressBarUnitSring = "s",
// MaxValue = 10,
- // Progress = light.fadeTime,
+ // Progress = function.fadeTime,
// SeekBarPadding = Application.GetRealWidth(20),
//};
//controlView.AddChidren(barFadeTime);
@@ -309,7 +308,7 @@
Height = Application.GetRealWidth(32),
UnSelectedImagePath = "Public/PowerClose.png",
SelectedImagePath = "Public/PowerOpen.png",
- IsSelected = light.trait_on_off.curValue.ToString() == "on",
+ IsSelected = function.trait_on_off.curValue.ToString() == "on",
};
controlView.AddChidren(btnSwitch);
@@ -329,10 +328,10 @@
LoadEventList();
- new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView_FunctionTop(light, actionRefresh);
+ new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView_FunctionTop(function, actionRefresh);
new System.Threading.Thread(() =>
{
- DriverLayer.Control.Ins.SendReadCommand(light);
+ DriverLayer.Control.Ins.SendReadCommand(function);
})
{ IsBackground = true }.Start();
}
@@ -347,7 +346,8 @@
var dialogBody = new FrameLayout();
frameBack.AddChidren(dialogBody);
- dialogBody.MouseUpEventHandler = (sender, e) => {
+ dialogBody.MouseUpEventHandler = (sender, e) =>
+ {
frameBack.Close();
};
@@ -393,12 +393,12 @@
btnCozyIcon.MouseUpEventHandler += (sender, e) =>
{
barColorTemplatrue.Progress = 27;
- light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100;
- barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K");
+ function.SetAttrState(FunctionAttributeKey.CCT, barColorTemplatrue.Progress * 100);
+ barColorTemplatrue.SetCustomText((barColorTemplatrue.Progress * 100) + "K");
frameBack.Close();
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
- DriverLayer.Control.Ins.SendWriteCommand(light, d);
+ d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString());
+ DriverLayer.Control.Ins.SendWriteCommand(function, d);
btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/CozyIconOn.png";
};
//娓╅Θ 2700k
@@ -416,12 +416,12 @@
btnCozy.MouseUpEventHandler += (sender, e) =>
{
barColorTemplatrue.Progress = 27;
- light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100;
- barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K");
+ function.SetAttrState(FunctionAttributeKey.CCT, barColorTemplatrue.Progress * 100);
+ barColorTemplatrue.SetCustomText((barColorTemplatrue.Progress * 100) + "K");
frameBack.Close();
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
- DriverLayer.Control.Ins.SendWriteCommand(light, d); barColorTemplatrue.Progress = 27;
+ d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString());
+ DriverLayer.Control.Ins.SendWriteCommand(function, d); barColorTemplatrue.Progress = 27;
barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K");
frameBack.Close();
btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/CozyIconOn.png";
@@ -439,12 +439,12 @@
btnMeetIcon.MouseUpEventHandler += (sender, e) =>
{
barColorTemplatrue.Progress = 30;
- light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100;
- barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K");
+ function.SetAttrState(FunctionAttributeKey.CCT, barColorTemplatrue.Progress * 100);
+ barColorTemplatrue.SetCustomText((barColorTemplatrue.Progress * 100) + "K");
frameBack.Close();
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
- DriverLayer.Control.Ins.SendWriteCommand(light, d);
+ d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString());
+ DriverLayer.Control.Ins.SendWriteCommand(function, d);
btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/MeetingGuestsIconOn.png";
};
@@ -463,12 +463,12 @@
btnMeet.MouseUpEventHandler += (sender, e) =>
{
barColorTemplatrue.Progress = 30;
- light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100;
- barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K");
+ function.SetAttrState(FunctionAttributeKey.CCT, barColorTemplatrue.Progress * 100);
+ barColorTemplatrue.SetCustomText((barColorTemplatrue.Progress * 100) + "K");
frameBack.Close();
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
- DriverLayer.Control.Ins.SendWriteCommand(light, d);
+ d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString());
+ DriverLayer.Control.Ins.SendWriteCommand(function, d);
btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/MeetingGuestsIconOn.png";
};
@@ -484,12 +484,12 @@
btnReadIcon.MouseUpEventHandler += (sender, e) =>
{
barColorTemplatrue.Progress = 65;
- light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100;
- barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K");
+ function.SetAttrState(FunctionAttributeKey.CCT, barColorTemplatrue.Progress * 100);
+ barColorTemplatrue.SetCustomText((barColorTemplatrue.Progress * 100) + "K");
frameBack.Close();
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
- DriverLayer.Control.Ins.SendWriteCommand(light, d);
+ d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString());
+ DriverLayer.Control.Ins.SendWriteCommand(function, d);
btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/ReadIconOn.png";
};
//闃呰 6500k
@@ -507,12 +507,12 @@
btnRead.MouseUpEventHandler += (sender, e) =>
{
barColorTemplatrue.Progress = 65;
- light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100;
- barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K");
+ function.SetAttrState(FunctionAttributeKey.CCT, barColorTemplatrue.Progress * 100);
+ barColorTemplatrue.SetCustomText((barColorTemplatrue.Progress * 100) + "K");
frameBack.Close();
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
- DriverLayer.Control.Ins.SendWriteCommand(light, d);
+ d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString());
+ DriverLayer.Control.Ins.SendWriteCommand(function, d);
btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/ReadIconOn.png";
};
btnCozy.IsSelected = false;
@@ -521,17 +521,17 @@
btnMeetIcon.IsSelected = false;
btnRead.IsSelected = false;
btnReadIcon.IsSelected = false;
- if (light.Attr_CCT.curValue.ToString() == "2700")
+ if (function.GetAttrState(FunctionAttributeKey.CCT) == "2700")
{
btnCozy.IsSelected = true;
btnCozyIcon.IsSelected = true;
}
- if (light.Attr_CCT.curValue.ToString() == "3000")
+ if (function.GetAttrState(FunctionAttributeKey.CCT) == "3000")
{
btnMeet.IsSelected = true;
btnMeetIcon.IsSelected = true;
}
- if (light.Attr_CCT.curValue.ToString() == "6500")
+ if (function.GetAttrState(FunctionAttributeKey.CCT) == "6500")
{
btnRead.IsSelected = true;
btnReadIcon.IsSelected = true;
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs
index 03b6752..2bb7c7b 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs
@@ -10,34 +10,34 @@
/// <summary>
/// 鏇存柊鍔熻兘鐘舵��
/// </summary>
- public static void UpdataStates(Light uFunction)
+ public static void UpdataStatus(Function updataTemp)
{
- Application.RunOnMainThread((Action)(() =>
+ Application.RunOnMainThread(() =>
{
try
{
if (bodyView == null)
return;
- if (uFunction.spk == bodyView.light.spk && uFunction.sid == bodyView.light.sid)
+ if (updataTemp.spk == bodyView.function.spk && updataTemp.sid == bodyView.function.sid)
{
- if (uFunction.trait_on_off.curValue.ToString() == "on")
+ if (updataTemp.trait_on_off.curValue.ToString() == "on")
{
bodyView.dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
if (!bodyView.onDimmerBar)
{
- bodyView.dimmerBar.Progress = uFunction.brightness;
+ bodyView.dimmerBar.Progress = Convert.ToInt32( updataTemp.GetAttrState(FunctionAttributeKey.Brightness));
}
- bodyView.btnBrightnessText.Text = uFunction.brightness + "%";
- bodyView.btnBrightnessText.Y = ((100 - uFunction.brightness) * Application.GetRealHeight(222 - 16) / 100) + Application.GetRealWidth(80);
+ bodyView.btnBrightnessText.Text = updataTemp.GetAttrState(FunctionAttributeKey.Brightness) + "%";
+ bodyView.btnBrightnessText.Y = ((100 - Convert.ToInt32(updataTemp.GetAttrState(FunctionAttributeKey.Brightness))) * Application.GetRealHeight(222 - 16) / 100) + Application.GetRealWidth(80);
}
else
{
bodyView.dimmerBar.SetProgressBarColors(CSS_Color.DividingLineColor, CSS_Color.DividingLineColor);
}
- bodyView.btnSwitch.IsSelected = uFunction.trait_on_off.curValue.ToString() == "on";
- bodyView.barColorTemplatrue.Enable = uFunction.trait_on_off.curValue.ToString() == "on";
+ bodyView.btnSwitch.IsSelected = updataTemp.trait_on_off.curValue.ToString() == "on";
+ bodyView.barColorTemplatrue.Enable = updataTemp.trait_on_off.curValue.ToString() == "on";
var cct = 27;
- int.TryParse(uFunction.Attr_CCT.curValue.ToString(), out cct);
+ int.TryParse(updataTemp.GetAttrState(FunctionAttributeKey.CCT), out cct);
bodyView.barColorTemplatrue.Progress = cct / 100;
//璁剧疆鍒濆鍊�
bodyView.barColorTemplatrue.SetCustomText(bodyView.barColorTemplatrue.Progress * 100 + "K");
@@ -48,7 +48,7 @@
{
MainPage.Log($"{bodyView.GetType().Name } UpdataStates error : {ex.Message}");
}
- }));
+ });
}
void LoadEventList()
@@ -60,9 +60,9 @@
LoadEvet_ChangeColorTemplatrue();
//鍥為��鍒锋柊淇℃伅浜嬩欢
actionRefresh = () => {
- btnFunctionName.Text = btnFunctionName_Out.Text = light.name;
- btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = light.GetRoomListName();
- //light.SaveFunctionData(true);
+ btnFunctionName.Text = btnFunctionName_Out.Text = function.name;
+ btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName();
+ //function.SaveFunctionData(true);
};
}
/// <summary>
@@ -72,8 +72,8 @@
{
//barFadeTime.OnStopTrackingTouchEvent = (sender, e) =>
//{
- // light.fadeTime = e;
- // light.SaveFunctionData(true);
+ // function.fadeTime = e;
+ // function.SaveFunctionData(true);
//};
}
@@ -90,10 +90,10 @@
{
//璁剧疆鑷畾涔夌殑鏂囨湰
barColorTemplatrue.SetCustomText(value * 100 + "K");
- light.Attr_CCT.curValue = value * 100;
+ function.SetAttrState(FunctionAttributeKey.CCT, value * 100);
//System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- //d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
- //Control.Ins.SendWriteCommand(light, d);
+ //d.Add(FunctionAttributeKey.CCT, function.Attr_CCT.curValue.ToString());
+ //Control.Ins.SendWriteCommand(function, d);
});
//System.Threading.Thread.Sleep(200);
}).Start();
@@ -101,10 +101,10 @@
barColorTemplatrue.OnStopTrackingTouchEvent = (sender, value) =>
{
- light.Attr_CCT.curValue = value * 100;
+ function.SetAttrState(FunctionAttributeKey.CCT, value * 100);
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
- Control.Ins.SendWriteCommand(light, d);
+ d.Add(FunctionAttributeKey.CCT, (value * 100 ).ToString());
+ Control.Ins.SendWriteCommand(function, d);
};
}
@@ -115,8 +115,8 @@
void LoadCollectionEvent()
{
btnCollection.MouseUpEventHandler += (sender, e) => {
- btnCollection.IsSelected = light.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
- light.CollectFunction();
+ btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
+ function.CollectFunction();
};
}
@@ -131,11 +131,11 @@
dimmerBar.OnStopTrackingTouchEvent = (sender, e) =>
{
onDimmerBar = false;
- light.brightness = dimmerBar.Progress;
+ function.SetAttrState(FunctionAttributeKey.Brightness, dimmerBar.Progress);
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
- Control.Ins.SendWriteCommand(light, d);
- //light.fadeTime = barFadeTime.Progress;
+ d.Add(FunctionAttributeKey.Brightness, dimmerBar.Progress.ToString());
+ Control.Ins.SendWriteCommand(function, d);
+ //function.fadeTime = barFadeTime.Progress;
btnBrightnessText.Text = dimmerBar.Progress + "%";
dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
@@ -143,38 +143,38 @@
dimmerBar.OnProgressChangedEvent = (sender, e) =>
{
dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
- //light.fadeTime = 0;
+ //function.fadeTime = 0;
//if (!btnSwitch.IsSelected)
//{
// dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
//}
//btnSwitch.IsSelected = e > 0 ? true : false;
- //light.brightness = e;
- //light.trait_on_off.curValue = e > 0 ? "on" : "off";
+ //function.brightness = e;
+ //function.trait_on_off.curValue = e > 0 ? "on" : "off";
//if (e == 0 || e == 100)
//{
// System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- // d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
- // Control.Ins.SendWriteCommand(light, d);
+ // d.Add(FunctionAttributeKey.Brightness, function.brightness.ToString());
+ // Control.Ins.SendWriteCommand(function, d);
//}
//else
//{
- // if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds)
+ // if (200 < (DateTime.Now - function.refreshTime).TotalMilliseconds)
// {
- // light.refreshTime = DateTime.Now;
+ // function.refreshTime = DateTime.Now;
// new System.Threading.Thread(() =>
// {
// System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- // d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
- // Control.Ins.SendWriteCommand(light, d);
+ // d.Add(FunctionAttributeKey.Brightness, function.brightness.ToString());
+ // Control.Ins.SendWriteCommand(function, d);
// })
// { IsBackground = true }.Start();
// }
//}
//btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16 - 16) / 100) + Application.GetRealWidth(40);
- //btnBrightnessText.Text = light.brightness + "%";
+ //btnBrightnessText.Text = function.brightness + "%";
btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100) + Application.GetRealWidth(80);
btnBrightnessText.Text = dimmerBar.Progress + "%";
@@ -190,7 +190,7 @@
{
btnSwitch.MouseUpEventHandler += (sender, e) =>
{
- //light.fadeTime = barFadeTime.Progress;
+ //function.fadeTime = barFadeTime.Progress;
btnSwitch.IsSelected = !btnSwitch.IsSelected;
if (btnSwitch.IsSelected)
{
@@ -202,19 +202,19 @@
}
new System.Threading.Thread(() =>
{
- light.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
+ function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.OnOff, light.trait_on_off.curValue.ToString());
- d.Add(FunctionAttributeKey.FadeTime, light.fadeTime.ToString());
+ d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString());
+ d.Add(FunctionAttributeKey.FadeTime, function.GetAttrState(FunctionAttributeKey.FadeTime));
if (btnSwitch.IsSelected)
{
- d.Add(FunctionAttributeKey.Brightness, light.lastBrightness.ToString());
+ d.Add(FunctionAttributeKey.Brightness, function.lastBrightness.ToString());
}
else
{
- light.lastBrightness = light.brightness;
+ function.lastBrightness = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness));
}
- Control.Ins.SendWriteCommand(light, d);
+ Control.Ins.SendWriteCommand(function, d);
})
{ IsBackground = true }.Start();
};
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPage.cs
index 1a9040b..3bbb89d 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPage.cs
@@ -45,7 +45,8 @@
#endregion
#region 鍖哄煙鍙橀噺
- Light light;
+ Light lightTemp = new Light();
+ Function function;
Button btnCollection_Out;
Button btnFunctionName_Out;
Button btnFromFloor_Out;
@@ -62,10 +63,10 @@
bodyView = null;
}
- public DimmerPage(Light func)
+ public DimmerPage(Function func)
{
bodyView = this;
- light = func;
+ function = func;
}
public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut)
@@ -74,8 +75,8 @@
btnFunctionName_Out = btnFunctionNameOut;
btnFromFloor_Out = btnFromFloorOut;
bodyView.BackgroundColor = CSS_Color.BackgroundColor;
- //new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView(light,null);
- //new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.Lights), light);
+ //new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView(function,null);
+ //new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.Lights), function);
controlView = new FrameLayout()
{
@@ -96,7 +97,7 @@
TextColor = CSS_Color.FirstLevelTitleColor,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
- Text = light.name,
+ Text = function.name,
};
controlView.AddChidren(btnFunctionName);
@@ -109,7 +110,7 @@
TextColor = CSS_Color.PromptingColor1,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- Text = light.GetRoomListName()
+ Text = function.GetRoomListName()
};
controlView.AddChidren(btnFromFoorAndRoom);
@@ -121,7 +122,7 @@
Height = Application.GetMinRealAverage(40),
SelectedImagePath = "Collection/CollectionIcon.png",
UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
- IsSelected = light.collect
+ IsSelected = function.collect
};
//controlView.AddChidren(btnCollection);
//2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳�
@@ -139,11 +140,11 @@
BorderColor = 0x00000000,
CornerRadius = Application.GetRealWidth(30),
BorderWidth = 0,
- Progress = light.brightness,
+ Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)),
IsProgressTextShow = false,
};
controlView.AddChidren(dimmerBar);
- if(light.trait_on_off.curValue.ToString() == "on")
+ if(function.trait_on_off.curValue.ToString() == "on")
{
dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
}
@@ -151,7 +152,7 @@
{
dimmerBar.SetProgressBarColors(CSS_Color.DividingLineColor, CSS_Color.DividingLineColor);
}
- dimmerBar.Progress = light.brightness;
+ dimmerBar.Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness));
btnBrightnessText = new Button()
{
Gravity = Gravity.CenterHorizontal,
@@ -161,7 +162,7 @@
UnSelectedImagePath = "FunctionIcon/Light/BrightnessBg.png",
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
- Text = light.brightness + "%",
+ Text = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)) + "%",
};
controlView.AddChidren(btnBrightnessText);
@@ -176,8 +177,8 @@
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
TextID = StringId.SpeedOfChange,
- Visible = light.HadFadeTime,
- Enable = light.HadFadeTime,
+ Visible = function.GetAttribute(FunctionAttributeKey.FadeTime)!= null,
+ Enable = function.GetAttribute(FunctionAttributeKey.FadeTime)!= null,
};
controlView.AddChidren(btnGradualChangeText);
@@ -191,8 +192,8 @@
TextAlignment = TextAlignment.CenterLeft,
TextColor = CSS_Color.PromptingColor1,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- Visible = light.HadFadeTime,
- Enable = light.HadFadeTime,
+ Visible = function.GetAttribute(FunctionAttributeKey.FadeTime) != null,
+ Enable = function.GetAttribute(FunctionAttributeKey.FadeTime) != null,
};
controlView.AddChidren(btnGradualChangeMinValuesText);
@@ -210,10 +211,10 @@
ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
ProgressBarUnitSring = "s",
MaxValue = 10,
- Progress = light.fadeTime,
+ Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.FadeTime)),
SeekBarPadding = Application.GetRealWidth(20),
- Visible = light.HadFadeTime,
- Enable = light.HadFadeTime,
+ Visible = function.GetAttribute(FunctionAttributeKey.FadeTime) != null,
+ Enable = function.GetAttribute(FunctionAttributeKey.FadeTime) != null,
};
controlView.AddChidren(barFadeTime);
@@ -227,8 +228,8 @@
TextAlignment = TextAlignment.CenterLeft,
TextColor = CSS_Color.PromptingColor1,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- Visible = light.HadFadeTime,
- Enable = light.HadFadeTime,
+ Visible = function.GetAttribute(FunctionAttributeKey.FadeTime) != null,
+ Enable = function.GetAttribute(FunctionAttributeKey.FadeTime) != null,
};
controlView.AddChidren(btnGradualChangeMaxValuesText);
#endregion
@@ -241,16 +242,16 @@
Height = Application.GetMinRealAverage(40),
UnSelectedImagePath = "Public/PowerClose.png",
SelectedImagePath = "Public/PowerOpen.png",
- IsSelected = light.trait_on_off.curValue.ToString() == "on",
+ IsSelected = function.trait_on_off.curValue.ToString() == "on",
};
controlView.AddChidren(btnSwitch);
LoadEventList();
- new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView_FunctionTop(light, actionRefresh);
+ new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView_FunctionTop(function, actionRefresh);
new System.Threading.Thread(() =>
{
- DriverLayer.Control.Ins.SendReadCommand(light);
+ DriverLayer.Control.Ins.SendReadCommand(function);
})
{ IsBackground = true }.Start();
}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs
index 709243b..8b08cbb 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs
@@ -10,31 +10,31 @@
/// <summary>
/// 鏇存柊鍔熻兘鐘舵��
/// </summary>
- public static void UpdataStates(Light uFunction)
+ public static void UpdataStates(Function updataTemp)
{
- Application.RunOnMainThread((Action)(() =>
+ Application.RunOnMainThread((() =>
{
try
{
if (bodyView == null)
return;
- if (uFunction.spk == bodyView.light.spk && uFunction.sid == bodyView.light.sid)
+ if (updataTemp.spk == bodyView.function.spk && updataTemp.sid == bodyView.function.sid)
{
- bodyView.btnBrightnessText.Text = uFunction.brightness + "%";
- bodyView.btnBrightnessText.Y = ((100 - uFunction.brightness) * Application.GetRealHeight(288 - 16 - 16) / 100) + Application.GetRealWidth(40);
- if (uFunction.trait_on_off.curValue.ToString() == "on")
+ bodyView.btnBrightnessText.Text = updataTemp.GetAttrState(FunctionAttributeKey.Brightness) + "%";
+ bodyView.btnBrightnessText.Y = ((100 - Convert.ToInt32( updataTemp.GetAttrState(FunctionAttributeKey.Brightness))) * Application.GetRealHeight(288 - 16 - 16) / 100) + Application.GetRealWidth(40);
+ if (updataTemp.trait_on_off.curValue.ToString() == "on")
{
bodyView.dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
if (!bodyView.onDimmerBar)
{
- bodyView.dimmerBar.Progress = uFunction.brightness;
+ bodyView.dimmerBar.Progress = Convert.ToInt32(updataTemp.GetAttrState(FunctionAttributeKey.Brightness));
}
}
else
{
bodyView.dimmerBar.SetProgressBarColors(CSS_Color.DividingLineColor, CSS_Color.DividingLineColor);
}
- bodyView.btnSwitch.IsSelected = uFunction.trait_on_off.curValue.ToString() == "on";
+ bodyView.btnSwitch.IsSelected = updataTemp.trait_on_off.curValue.ToString() == "on";
}
}
catch (Exception ex)
@@ -52,9 +52,9 @@
LoadEvet_ChangeFadeTime();
//鍥為��鍒锋柊淇℃伅浜嬩欢
actionRefresh = () => {
- btnFunctionName.Text = btnFunctionName_Out.Text = light.name;
- btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = light.GetRoomListName();
- //light.SaveFunctionData(true);
+ btnFunctionName.Text = btnFunctionName_Out.Text = function.name;
+ btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName();
+ //function.SaveFunctionData(true);
};
}
/// <summary>
@@ -64,8 +64,8 @@
{
barFadeTime.OnStopTrackingTouchEvent = (sender, e) =>
{
- light.fadeTime = e;
- light.UpdataFuncitonInfo();
+ function.SetAttrState(FunctionAttributeKey.FadeTime, e.ToString());
+ function.UpdataFuncitonInfo();
};
}
@@ -75,8 +75,8 @@
void LoadCollectionEvent()
{
btnCollection.MouseUpEventHandler += (sender, e) => {
- btnCollection.IsSelected = light.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
- light.CollectFunction();
+ btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
+ function.CollectFunction();
};
}
@@ -90,43 +90,42 @@
};
dimmerBar.OnStopTrackingTouchEvent = (sender, e) => {
onDimmerBar = false;
- light.brightness = dimmerBar.Progress;
- //Control.Send(CommandType_A.write, light);
+ function.SetAttrState(FunctionAttributeKey.Brightness, dimmerBar.Progress);
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
- Control.Ins.SendWriteCommand(light, d);
- light.fadeTime = barFadeTime.Progress;
+ d.Add(FunctionAttributeKey.Brightness, dimmerBar.Progress.ToString());
+ Control.Ins.SendWriteCommand(function, d);
+ function.SetAttrState(FunctionAttributeKey.FadeTime, barFadeTime.Progress);
btnBrightnessText.Text = dimmerBar.Progress + "%";
};
//20201223 鍒犻櫎婊戝姩鍙戦�佸懡浠わ紝闃叉鎺т欢璺冲姩
dimmerBar.OnProgressChangedEvent = (sender, e) =>
{
dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
- //light.fadeTime = 0;
+ //function.fadeTime = 0;
//if (!btnSwitch.IsSelected)
//{
// dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
//}
//btnSwitch.IsSelected = e > 0 ? true : false;
- //light.brightness = e;
- //light.trait_on_off.curValue = e > 0 ? "on" : "off";
+ //function.brightness = e;
+ //function.trait_on_off.curValue = e > 0 ? "on" : "off";
//if (e == 0 || e == 100)
//{
- // //Control.Send(CommandType_A.write, this.light);
+ // //Control.Send(CommandType_A.write, this.function);
// System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- // d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
- // Control.Ins.SendWriteCommand(light, d);
+ // d.Add(FunctionAttributeKey.Brightness, function.brightness.ToString());
+ // Control.Ins.SendWriteCommand(function, d);
//}
//else
//{
- // if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds)
+ // if (200 < (DateTime.Now - function.refreshTime).TotalMilliseconds)
// {
- // light.refreshTime = DateTime.Now;
+ // function.refreshTime = DateTime.Now;
// new System.Threading.Thread(() =>
// {
// System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- // d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
- // Control.Ins.SendWriteCommand(light, d);
+ // d.Add(FunctionAttributeKey.Brightness, function.brightness.ToString());
+ // Control.Ins.SendWriteCommand(function, d);
// })
// { IsBackground = true }.Start();
// }
@@ -143,7 +142,7 @@
{
btnSwitch.MouseUpEventHandler += (sender, e) =>
{
- light.fadeTime = barFadeTime.Progress;
+ function.SetAttrState(FunctionAttributeKey.FadeTime, barFadeTime.Progress);
btnSwitch.IsSelected = !btnSwitch.IsSelected;
if (btnSwitch.IsSelected)
{
@@ -155,23 +154,23 @@
}
new System.Threading.Thread(() =>
{
- light.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
+ function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.OnOff, light.trait_on_off.curValue.ToString());
- d.Add(FunctionAttributeKey.FadeTime, light.fadeTime.ToString());
+ d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString());
+ d.Add(FunctionAttributeKey.FadeTime, function.GetAttrState(FunctionAttributeKey.FadeTime));
if (btnSwitch.IsSelected)
{
- if(light.lastBrightness == 0)
+ if(function.lastBrightness == 0)
{
- light.lastBrightness = 100;
+ function.lastBrightness = 100;
}
- d.Add(FunctionAttributeKey.Brightness, light.lastBrightness.ToString());
+ d.Add(FunctionAttributeKey.Brightness, function.lastBrightness.ToString());
}
else
{
- light.lastBrightness = light.brightness;
+ function.lastBrightness = Convert.ToInt32( function.GetAttrState(FunctionAttributeKey.Brightness));
}
- Control.Ins.SendWriteCommand(light, d);
+ Control.Ins.SendWriteCommand(function, d);
})
{ IsBackground = true }.Start();
};
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs
index 6a6d92b..c9291ea 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs
@@ -52,11 +52,12 @@
#endregion
#region 鍖哄煙鍙橀噺
- Light light;
+ Light lightTemp;
Button btnCollection_Out;
Button btnFunctionName_Out;
Button btnFromFloor_Out;
bool onDimmerBar = false;
+ Function function;
/// <summary>
/// 鍒锋柊鏄剧ず淇℃伅
/// </summary>
@@ -66,7 +67,7 @@
public RGBPage(Function func)
{
bodyView = this;
- light = func as Light;
+ function = func;
}
public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut)
@@ -97,7 +98,7 @@
TextColor = CSS_Color.FirstLevelTitleColor,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
- Text = light.name,
+ Text = function.name,
};
controlView.AddChidren(btnFunctionName);
@@ -110,7 +111,7 @@
TextColor = CSS_Color.PromptingColor1,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- Text = light.GetRoomListName()
+ Text = function.GetRoomListName()
};
controlView.AddChidren(btnFromFoorAndRoom);
@@ -123,7 +124,7 @@
Radius = (uint)Application.GetMinRealAverage(8),
BorderColor = CSS_Color.PromptingColor2,
BorderWidth = 1,
- BackgroundColor = (uint)(0xFF000000 + light.GetRGBcolor())
+ BackgroundColor = (uint)(0xFF000000 + lightTemp.GetRGBcolor(function))
};
controlView.AddChidren(btnCurColor);
@@ -135,7 +136,7 @@
Height = Application.GetMinRealAverage(40),
SelectedImagePath = "Collection/CollectionIcon.png",
UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
- IsSelected = light.collect
+ IsSelected = function.collect
};
//controlView.AddChidren(btnCollection);
//2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳�
@@ -157,7 +158,7 @@
ColorImagePath = "FunctionIcon/Light/ColorWheel.png",
};
framePickerBack.AddChidren(colorPicker);
- if(light.trait_on_off.curValue.ToString() == "off")
+ if(function.trait_on_off.curValue.ToString() == "off")
{
colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheelGray.png";
}
@@ -199,7 +200,7 @@
dimmerBar = new DiyImageSeekBar()
{
- X = Application.GetRealWidth(35 +22),
+ X = Application.GetRealWidth(35 + 22),
Y = Application.GetRealHeight(312),
Width = Application.GetRealWidth(210),
Height = Application.GetRealHeight(54),
@@ -208,9 +209,9 @@
ThumbImageHeight = Application.GetRealHeight(54),
ProgressTextColor = CSS_Color.FirstLevelTitleColor,
ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- ProgressBarColor = light.trait_on_off.curValue.ToString() == "on" ? CSS_Color.AuxiliaryColor1 : CSS_Color.DividingLineColor,
+ ProgressBarColor = function.trait_on_off.curValue.ToString() == "on" ? CSS_Color.AuxiliaryColor1 : CSS_Color.DividingLineColor,
MaxValue = 100,
- Progress = light.brightness,
+ Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)),
SeekBarPadding = Application.GetRealWidth(20),
};
controlView.AddChidren(dimmerBar);
@@ -253,8 +254,8 @@
TextAlignment = TextAlignment.CenterLeft,
TextColor = CSS_Color.PromptingColor1,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- Visible = light.HadFadeTime,
- Enable = light.HadFadeTime,
+ Visible = function.GetAttribute(FunctionAttributeKey.FadeTime) != null,
+ Enable = function.GetAttribute(FunctionAttributeKey.FadeTime) != null,
};
controlView.AddChidren(btnGradualChangeMinValuesText);
@@ -273,10 +274,10 @@
ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
ProgressBarUnitSring = "s",
MaxValue = 10,
- Progress = light.fadeTime,
+ Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.FadeTime)),
SeekBarPadding = Application.GetRealWidth(20),
- Visible = light.HadFadeTime,
- Enable = light.HadFadeTime,
+ Visible = function.GetAttribute(FunctionAttributeKey.FadeTime) != null,
+ Enable = function.GetAttribute(FunctionAttributeKey.FadeTime) != null,
};
controlView.AddChidren(barFadeTime);
@@ -290,8 +291,8 @@
TextAlignment = TextAlignment.CenterLeft,
TextColor = CSS_Color.PromptingColor1,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- Visible = light.HadFadeTime,
- Enable = light.HadFadeTime,
+ Visible = function.GetAttribute(FunctionAttributeKey.FadeTime) != null,
+ Enable = function.GetAttribute(FunctionAttributeKey.FadeTime) != null,
};
controlView.AddChidren(btnGradualChangeMaxValuesText);
#endregion
@@ -315,15 +316,15 @@
Height = Application.GetMinRealAverage(32),
UnSelectedImagePath = "Public/PowerClose.png",
SelectedImagePath = "Public/PowerOpen.png",
- IsSelected = light.trait_on_off.curValue.ToString() == "on"
+ IsSelected = function.trait_on_off.curValue.ToString() == "on"
};
controlView.AddChidren(btnSwitch);
LoadEventList();
- new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView_FunctionTop(light, actionRefresh);
+ new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView_FunctionTop(function, actionRefresh);
new System.Threading.Thread(() =>
{
- DriverLayer.Control.Ins.SendReadCommand(light);
+ DriverLayer.Control.Ins.SendReadCommand(function);
})
{ IsBackground = true }.Start();
}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs
index 89900c2..b20523e 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs
@@ -9,18 +9,18 @@
/// <summary>
/// 鏇存柊鍔熻兘鐘舵��
/// </summary>
- public static void UpdataStates(Light uFunction)
+ public static void UpdataStates(Function updateTemp)
{
- Application.RunOnMainThread((Action)(() =>
+ Application.RunOnMainThread((() =>
{
try
{
if (bodyView == null)
return;
- if (uFunction.spk == bodyView.light.spk && uFunction.sid == bodyView.light.sid)
+ if (updateTemp.spk == bodyView.function.spk && updateTemp.sid == bodyView.function.sid)
{
- if (uFunction.trait_on_off.curValue.ToString() == "on")
+ if (updateTemp.trait_on_off.curValue.ToString() == "on")
{
//瑙e喅閮ㄥ垎瀹夊崜鎵嬫満锛屽埛鏂板浘鐗囨椂浼氬彉灏忛棶棰�
if (bodyView.colorPicker.ColorImagePath != "FunctionIcon/Light/ColorWheel.png")
@@ -31,11 +31,11 @@
bodyView.btnSwitch.IsSelected = true;
if (!bodyView.onDimmerBar)
{
- bodyView.dimmerBar.Progress = uFunction.brightness;
+ bodyView.dimmerBar.Progress = Convert.ToInt32(updateTemp.GetAttrState(FunctionAttributeKey.Brightness));
}
}
//鐘舵�佷竴鏍锋椂,涓嶅啀鍒锋柊瑙嗗浘
- else if (uFunction.trait_on_off.curValue.ToString() == "off" && bodyView.btnSwitch.IsSelected == true)
+ else if (updateTemp.trait_on_off.curValue.ToString() == "off" && bodyView.btnSwitch.IsSelected == true)
{
//瑙e喅閮ㄥ垎瀹夊崜鎵嬫満锛屽埛鏂板浘鐗囨椂浼氬彉灏忛棶棰�
if (bodyView.colorPicker.ColorImagePath != "FunctionIcon/Light/ColorWheelGray.png")
@@ -48,8 +48,8 @@
//鑹茬洏鐨勫渾鐐归殣钘�
bodyView.btnWhiteRound.Visible = false;
}
- bodyView.btnCurColor.BackgroundColor = (uint)(0xFF000000 + bodyView.light.GetRGBcolor());
- if (bodyView.light.GetRGBcolor() == 16777215 && bodyView.btnCurColor.BorderColor != 0x00000000)
+ bodyView.btnCurColor.BackgroundColor = (uint)(0xFF000000 + bodyView.lightTemp.GetRGBcolor(updateTemp));
+ if (bodyView.lightTemp.GetRGBcolor(updateTemp) == 16777215 && bodyView.btnCurColor.BorderColor != 0x00000000)
{
bodyView.btnCurColor.BorderColor = CSS.CSS_Color.PromptingColor2;
}
@@ -77,8 +77,8 @@
LoadEvet_ChangeFadeTime();
//鍥為��鍒锋柊淇℃伅浜嬩欢
actionRefresh = () => {
- btnFunctionName.Text = btnFunctionName_Out.Text = light.name;
- btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = light.GetRoomListName();
+ btnFunctionName.Text = btnFunctionName_Out.Text = function.name;
+ btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName();
};
}
@@ -95,7 +95,7 @@
int circleR = colorPicker.Width / 2 - Application.GetRealWidth(12);
colorPicker.ColorChaged += (sender2, e2) => {
- if (light.trait_on_off.curValue.ToString() == "off"
+ if (function.trait_on_off.curValue.ToString() == "off"
|| pointIsRight == false)
{
//pointIsRight:鐐圭殑鍖哄煙涓嶆槸鍦嗙洏鍐�
@@ -103,17 +103,17 @@
}
if ((DateTime.Now - colorChangeTime).TotalMilliseconds > 200)
{
- light.SetRGBcolor(e2);
+ lightTemp.SetRGBcolor(e2,function);
colorChangeTime = DateTime.Now;
- btnCurColor.BackgroundColor = (uint)(0xFF000000 + light.GetRGBcolor());
+ btnCurColor.BackgroundColor = (uint)(0xFF000000 + lightTemp.GetRGBcolor(function));
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.RGB, light.GetRGBcolorString());
- Control.Ins.SendWriteCommand(light, d);
+ d.Add(FunctionAttributeKey.RGB, lightTemp.GetRGBcolorString(function));
+ Control.Ins.SendWriteCommand(function, d);
}
};
colorPicker.MouseDownEventHandler += (sender, e) =>
{
- if (light.trait_on_off.curValue.ToString() == "off")
+ if (function.trait_on_off.curValue.ToString() == "off")
{
return;
}
@@ -144,8 +144,8 @@
void LoadCollectionEvent()
{
btnCollection.MouseUpEventHandler += (sender, e) => {
- btnCollection.IsSelected = light.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
- light.CollectFunction();
+ btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
+ function.CollectFunction();
};
}
@@ -163,39 +163,39 @@
onDimmerBar = false;
})
{ IsBackground = true }.Start();
- light.brightness = dimmerBar.Progress;
+ function.SetAttrState(FunctionAttributeKey.Brightness, dimmerBar.Progress);
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
- Control.Ins.SendWriteCommand(light, d);
- light.fadeTime = barFadeTime.Progress;
+ d.Add(FunctionAttributeKey.Brightness, dimmerBar.Progress.ToString());
+ Control.Ins.SendWriteCommand(function, d);
+ function.SetAttrState(FunctionAttributeKey.FadeTime, barFadeTime.Progress);
};
dimmerBar.OnProgressChangedEvent = (sender, e) => {
- //light.fadeTime = 0;
+ //function.fadeTime = 0;
//if (!btnSwitch.IsSelected)
//{
// dimmerBar.ProgressBarColor = CSS.CSS_Color.AuxiliaryColor1;
//}
//btnSwitch.IsSelected = e > 0 ? true : false;
- //light.brightness = e;
- //light.trait_on_off.curValue = e > 0 ? "on" : "off";
+ //function.brightness = e;
+ //function.trait_on_off.curValue = e > 0 ? "on" : "off";
//if (e == 0 || e == 100)
//{
// System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- // d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
- // Control.Ins.SendWriteCommand(light, d);
+ // d.Add(FunctionAttributeKey.Brightness, function.brightness.ToString());
+ // Control.Ins.SendWriteCommand(function, d);
//}
//else
//{
- // if (200 < (DateTime.Now - light.refreshTime).TotalMilliseconds)
+ // if (200 < (DateTime.Now - function.refreshTime).TotalMilliseconds)
// {
- // light.refreshTime = DateTime.Now;
+ // function.refreshTime = DateTime.Now;
// new System.Threading.Thread(() =>
// {
- // //Control.Send(CommandType_A.write, light);
+ // //Control.Send(CommandType_A.write, function);
// System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- // d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString());
- // Control.Ins.SendWriteCommand(light, d);
+ // d.Add(FunctionAttributeKey.Brightness, function.brightness.ToString());
+ // Control.Ins.SendWriteCommand(function, d);
// })
// { IsBackground = true }.Start();
// }
@@ -214,8 +214,8 @@
{
barFadeTime.OnStopTrackingTouchEvent = (sender, e) =>
{
- light.fadeTime = barFadeTime.Progress;
- light.UpdataFuncitonInfo();
+ function.SetAttrState(FunctionAttributeKey.FadeTime, barFadeTime.Progress);
+ function.UpdataFuncitonInfo();
};
}
/// <summary>
@@ -230,24 +230,24 @@
bodyView.colorPicker.ColorImagePath = btnSwitch.IsSelected ? "FunctionIcon/Light/ColorWheel.png" : "FunctionIcon/Light/ColorWheelGray.png";
new System.Threading.Thread(() =>
{
- light.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
+ function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.OnOff, light.trait_on_off.curValue.ToString());
- d.Add(FunctionAttributeKey.FadeTime, light.fadeTime.ToString());
+ d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString());
+ d.Add(FunctionAttributeKey.FadeTime, function.GetAttrState(FunctionAttributeKey.FadeTime));
if (btnSwitch.IsSelected)
{
- if(light.lastBrightness == 0)
+ if(function.lastBrightness == 0)
{
- light.lastBrightness = 100;
+ function.lastBrightness = 100;
dimmerBar.Progress = 100;
}
- d.Add(FunctionAttributeKey.Brightness, light.lastBrightness.ToString());
+ d.Add(FunctionAttributeKey.Brightness, function.lastBrightness.ToString());
}
else
{
- light.lastBrightness = light.brightness;
+ function.lastBrightness = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness));
}
- Control.Ins.SendWriteCommand(light, d);
+ Control.Ins.SendWriteCommand(function, d);
})
{ IsBackground = true }.Start();
};
@@ -259,19 +259,19 @@
{
btnRestoredPoint.MouseUpEventHandler = (sender, e) =>
{
- if(light.trait_on_off.curValue.ToString() == "off")
+ if(function.trait_on_off.curValue.ToString() == "off")
{
return;
}
btnWhiteRound.Visible = true;
btnWhiteRound.Gravity = Gravity.Center;
- light.SetRGBcolor(new byte[] { 255, 255, 255 });
+ lightTemp.SetRGBcolor(new byte[] { 255, 255, 255 },function);
btnCurColor.BackgroundColor = 0xFFFFFFFF;
btnCurColor.BorderColor = CSS.CSS_Color.PromptingColor2;
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.RGB, light.GetRGBcolorString());
- Control.Ins.SendWriteCommand(light, d);
+ d.Add(FunctionAttributeKey.RGB, lightTemp.GetRGBcolorString(function));
+ Control.Ins.SendWriteCommand(function, d);
};
}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPage.cs
index 78ede19..42728f6 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPage.cs
@@ -37,7 +37,8 @@
#endregion
#region 鍖哄煙鍙橀噺
- Light light;
+ Light lightTemp = new Light();
+ Function function;
Button btnCollection_Out;
Button btnFunctionName_Out;
Button btnFromFloor_Out;
@@ -47,10 +48,10 @@
Action actionRefresh;
#endregion
- public RelayPage(Light func)
+ public RelayPage(Function func)
{
bodyView = this;
- light = func;
+ function = func;
}
/// <summary>
@@ -74,7 +75,7 @@
btnFromFloor_Out = btnFromFloorOut;
}
bodyView.BackgroundColor = CSS_Color.BackgroundColor;
- //new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.Lights), light);
+ //new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.Lights), function);
controlView = new FrameLayout()
{
@@ -95,7 +96,7 @@
TextColor = CSS_Color.FirstLevelTitleColor,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
- Text = light.name,
+ Text = function.name,
};
controlView.AddChidren(btnFunctionName);
@@ -108,7 +109,7 @@
TextColor = CSS_Color.PromptingColor1,
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- Text = light.GetRoomListName()
+ Text = function.GetRoomListName()
};
controlView.AddChidren(btnFromFoorAndRoom);
@@ -120,7 +121,7 @@
Height = Application.GetMinRealAverage(40),
SelectedImagePath = "Collection/CollectionIcon.png",
UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
- IsSelected = light.collect
+ IsSelected = function.collect
};
//controlView.AddChidren(btnCollection);
//2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳�
@@ -137,7 +138,7 @@
Height = Application.GetRealWidth(288),
UnSelectedImagePath = "FunctionIcon/Light/RelayBg.png",
SelectedImagePath = "FunctionIcon/Light/RelayOnBg.png",
- IsSelected = light.trait_on_off.curValue.ToString() == "on"
+ IsSelected = function.trait_on_off.curValue.ToString() == "on"
};
controlView.AddChidren(btnSwitchIcon);
@@ -149,16 +150,16 @@
Height = Application.GetMinRealAverage(32),
UnSelectedImagePath = "Public/PowerClose.png",
SelectedImagePath = "Public/PowerOpen.png",
- IsSelected = light.trait_on_off.curValue.ToString() == "on"
+ IsSelected = function.trait_on_off.curValue.ToString() == "on"
};
controlView.AddChidren(btnSwitch);
LoadEventList();
- new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView_FunctionTop(light, actionRefresh);
+ new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView_FunctionTop(function, actionRefresh);
new System.Threading.Thread(() =>
{
- DriverLayer.Control.Ins.SendReadCommand(light);
+ DriverLayer.Control.Ins.SendReadCommand(function);
})
{ IsBackground = true }.Start();
}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs
index 82b44f0..089c4e8 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs
@@ -9,7 +9,7 @@
/// <summary>
/// 鏇存柊鐏厜鐘舵��
/// </summary>
- public static void UpdataState(Light uLight)
+ public static void UpdataState(Function updataTemp)
{
Application.RunOnMainThread(() =>
{
@@ -17,7 +17,7 @@
{
if (bodyView == null)
return;
- bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = uLight.trait_on_off.curValue.ToString() == "on";
+ bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = updataTemp.trait_on_off.curValue.ToString() == "on";
}
catch (Exception ex)
{
@@ -35,9 +35,9 @@
//鍥為��鍒锋柊淇℃伅浜嬩欢
actionRefresh = () => {
- btnFunctionName.Text = btnFunctionName_Out.Text = light.name;
- btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = light.GetRoomListName();
- //light.SaveFunctionData(true);
+ btnFunctionName.Text = btnFunctionName_Out.Text = function.name;
+ btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName();
+ //function.SaveFunctionData(true);
};
}
@@ -47,8 +47,8 @@
void LoadCollectionEvent()
{
btnCollection.MouseUpEventHandler += (sender, e) => {
- btnCollection.IsSelected = light.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
- light.CollectFunction();
+ btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
+ function.CollectFunction();
};
}
@@ -62,10 +62,10 @@
btnSwitch.IsSelected = btnSwitchIcon.IsSelected = !btnSwitchIcon.IsSelected;
new System.Threading.Thread(() =>
{
- light.trait_on_off.curValue = btnSwitchIcon.IsSelected ? "on" : "off";
+ function.trait_on_off.curValue = btnSwitchIcon.IsSelected ? "on" : "off";
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add("on_off", light.trait_on_off.curValue.ToString());
- DriverLayer.Control.Ins.SendWriteCommand(light, d);
+ d.Add("on_off", function.trait_on_off.curValue.ToString());
+ DriverLayer.Control.Ins.SendWriteCommand(function, d);
})
{ IsBackground = true }.Start();
};
@@ -74,11 +74,11 @@
btnSwitchIcon.IsSelected = btnSwitch.IsSelected = !btnSwitch.IsSelected;
new System.Threading.Thread(() =>
{
- light.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
+ function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add("on_off", light.trait_on_off.curValue.ToString());
- DriverLayer.Control.Ins.SendWriteCommand(light, d);
- //Control.Send(CommandType_A.write, light);
+ d.Add("on_off", function.trait_on_off.curValue.ToString());
+ DriverLayer.Control.Ins.SendWriteCommand(function, d);
+ //Control.Send(CommandType_A.write, function);
})
{ IsBackground = true }.Start();
};
--
Gitblit v1.8.0