Merge branch 'temp-wxr' into WJC
2 文件已复制
4个文件已添加
56个文件已删除
100个文件已修改
3 文件已重命名
| | |
| | | bld/ |
| | | [Bb]in/ |
| | | [Oo]bj/ |
| | | .vs/ |
| | | .DS_Store |
| | | .gitignore |
| | | |
| | | # Roslyn cache directories |
| | | *.ide/ |
| | |
| | | <Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default"> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008020-001674E61438002E" /> |
| | | <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs"> |
| | | <Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default"> |
| | | <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/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" Line="276" Column="82" /> |
| | | <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" Line="294" Column="1" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs" Line="170" Column="1" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs" Line="12" Column="33" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs" Line="10" Column="23" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs" Line="50" Column="46" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/SaveView.cs" Line="11" Column="57" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs" Line="267" Column="70" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs" Line="435" Column="63" /> |
| | | <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs" Line="147" Column="32" /> |
| | | <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs" Line="8" Column="16" /> |
| | | <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs" Line="252" Column="18" /> |
| | | <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/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="DAL" expanded="True"> |
| | | <Node name="Mqtt" expanded="True" /> |
| | | <Node name="Server" expanded="True" /> |
| | | </Node> |
| | | <Node name="Entity" expanded="True"> |
| | | <Node name="Function" expanded="True" /> |
| | | </Node> |
| | | <Node name="UI" expanded="True"> |
| | | <Node name="UI2" expanded="True"> |
| | | <Node name="3-Intelligence" expanded="True"> |
| | | <Node name="Automation" expanded="True" /> |
| | | </Node> |
| | | <Node name="4-PersonalCenter" expanded="True"> |
| | | <Node name="PirDevice" expanded="True"> |
| | | <Node name="View" expanded="True" /> |
| | | <Node name="Method.cs" selected="True" /> |
| | | </Node> |
| | | </Node> |
| | | <Node name="UI1-Login" expanded="True"> |
| | | <Node name="LoginPage.cs" selected="True" /> |
| | | </Node> |
| | | </Node> |
| | | </Node> |
| | | <Node name="HDL-ON_iOS" expanded="True" /> |
| | | </Node> |
| | | </State> |
| | | </Pad> |
| | |
| | | <String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String> |
| | | <String>Shared.IOS/Shared.IOS.csproj</String> |
| | | </DisabledProjects> |
| | | <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" /> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.4b65c4650918" /> |
| | | <MonoDevelop.Ide.Workspace ActiveConfiguration="Release" /> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.SelectDevice" /> |
| | | <MonoDevelop.Ide.DebuggingService.Breakpoints> |
| | | <BreakpointStore> |
| | | <Breakpoint file="/Users/hdl/Desktop/wjc/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" line="274" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/DriverLayer/Control.cs" relfile="HDL_ON/DAL/DriverLayer/Control.cs" line="458" column="1" /> |
| | | </BreakpointStore> |
| | | </MonoDevelop.Ide.DebuggingService.Breakpoints> |
| | | <MultiItemStartupConfigurations /> |
copy from CommonLib/.DS_Store
copy to DLL/.DS_Store
Binary files differ
copy from CommonLib/.DS_Store
copy to HDL-ON_Android/.DS_Store
Binary files differ
| | |
| | | 414=Controller on |
| | | 415=Someone |
| | | 416=Log |
| | | 417=Water Leakage |
| | | 418=In Alarm |
| | | 419=Normal |
| | | 420=Hot dry |
| | | 421=Air dry |
| | | 422=Disinfect |
| | | 423=Lighting |
| | | 424=Time |
| | | 425=Hot dry time |
| | | 426=Air dry time |
| | | 427=Disinfect time |
| | | 428=Anion Time |
| | | |
| | | |
| | | 1002=Anion |
| | | |
| | | 5000=Music |
| | | 5001=Group |
| | |
| | | 413=æ§å¶å¨æªå¼å¯ |
| | | 414=æ§å¶å¨å·²å¼å¯ |
| | | 415=æäºº |
| | | 516=æ¥å¿ |
| | | 416=æ¥å¿ |
| | | 417=æ¼æ°´ |
| | | 418=æ¥è¦ |
| | | 419=æ£å¸¸ |
| | | 420=çå¹² |
| | | 421=é£å¹² |
| | | 422=æ¶æ¯ |
| | | 423=ç
§æ |
| | | 424=æ¶é´ |
| | | 425=çå¹²æ¶é´ |
| | | 426=é£å¹²æ¶é´ |
| | | 427=æ¶æ¯æ¶é´ |
| | | 428=è´ç¦»åæ¶é´ |
| | | |
| | | |
| | | 1000=室å
湿度 |
| | | 1001=ç«¥é |
| | |
| | | 1033=èæç®¡ç |
| | | 1034=åå²è®°å½ |
| | | 1035=èªå¨æ¸
æ« |
| | | 1036=å®ç¹æ¸
æ« |
| | | 1036=éæºæ¸
æ« |
| | | 1037=æ²¿å¢æ¸
æ« |
| | | 1038=åºåæ¸
æ« |
| | | 1038=èºææ¸
æ« |
| | | 1039=æ»æ¸
æ´é¢ç§¯ |
| | | 1040=æ»æ¸
æ´æ¶é´ |
| | | 1041=è¾¹å·å©ä½å¯¿å½ |
| | |
| | | 5047=ä½ ææºææªå®è£
"QQé³ä¹"{\r\n}请å徿æºååºå®è£
|
| | | |
| | | |
| | | |
| | | 6000=æ£å¸¸ |
| | | 6001=设å¤ç¶æ |
| | | 6002=个 |
| | |
| | | 6012=红å¤é¥æ§ |
| | | 6013=设å¤ç®¡ç |
| | | 6014=æ·»å 饿§å¨ |
| | | |
| | | |
| | | 6015=å¨çº¿ |
| | | 6016=离线 |
| | | 6017=çæ¬å· |
| | |
| | | <AndroidResource Include="Resources\mipmap-anydpi-v26\ic_launcher.xml" /> |
| | | <AndroidResource Include="Resources\mipmap-anydpi-v26\ic_launcher_round.xml" /> |
| | | <AndroidResource Include="Resources\drawable\Loading.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\Icon.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\mipmap-xxhdpi\Icon.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\xml\network_security_config.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\xml\file_paths.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\layout\zxing_layout.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\mipmap-xhdpi\Icon.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\mipmap-mdpi\Icon.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\mipmap-hdpi\Icon.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\mipmap-anydpi-v26\Icon.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\mipmap-xxxhdpi\Icon.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | <SubType> |
| | | </SubType> |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | |
| | | <Folder Include="Assets\Phone\FunctionIcon\Electrical\ClothesHanger\" /> |
| | | <Folder Include="Assets\Phone\PirIcon\" /> |
| | | </ItemGroup> |
| | | <ItemGroup /> |
| | | <ItemGroup> |
| | | <PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.3" /> |
| | | <PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="28.0.0.3" /> |
| | |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\-.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\+.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\point.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\ selected+.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\selected-.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\link.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\selectTheFun.png" /> |
| | |
| | | <AndroidAsset Include="Assets\Phone\PirIcon\icon1.png" /> |
| | | <AndroidAsset Include="Assets\Phone\PirIcon\icon2.png" /> |
| | | <AndroidAsset Include="Assets\Phone\PirIcon\succeed.png" /> |
| | | <AndroidAsset Include="Assets\Phone\PirIcon\left.png" /> |
| | | <AndroidAsset Include="Assets\Phone\PirIcon\right.png" /> |
| | | <AndroidAsset Include="Assets\Phone\PirIcon\1.png" /> |
| | | <AndroidAsset Include="Assets\Phone\PirIcon\2.png" /> |
| | | <AndroidAsset Include="Assets\Phone\PirIcon\3.png" /> |
| | | <AndroidAsset Include="Assets\Phone\PirIcon\4.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\selected+.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidNativeLibrary Include="libs\armeabi-v7a\libelianjni.so" /> |
| | | <AndroidNativeLibrary Include="libs\armeabi-v7a\libjcore127.so" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ProjectReference Include="..\ys\ys.csproj"> |
| | | <Project>{DF065E3F-C3A1-4908-9582-000974B7C290}</Project> |
| | | <Name>ys</Name> |
| | | </ProjectReference> |
| | | </ItemGroup> |
| | | <Import Project="..\HDL_ON\HDL_ON.projitems" Label="Shared" Condition="Exists('..\HDL_ON\HDL_ON.projitems')" /> |
| | | <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> |
| | | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202102252" android:versionName="1.1.202102252" 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" /> |
| | |
| | | <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> |
| | |
| | | <BundleResource Include="Resources\Phone\LogicIcon\-.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\+.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\point.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\ selected+.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\selected-.png" /> |
| | | <BundleResource Include="Resources\Phone\oRobot.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\Light\ColorWheelGray.png" /> |
| | |
| | | <BundleResource Include="Resources\Phone\PirIcon\online.png" /> |
| | | <BundleResource Include="Resources\Phone\PirIcon\adddevice.png" /> |
| | | <BundleResource Include="Resources\Phone\PirIcon\next.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\selected+.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ITunesArtwork Include="iTunesArtwork" /> |
| | |
| | | <key>UIStatusBarStyle</key> |
| | | <string>UIStatusBarStyleLightContent</string> |
| | | <key>CFBundleShortVersionString</key> |
| | | <string>1.1.202102242</string> |
| | | <string>1.1.202103051</string> |
| | | <key>CFBundleVersion</key> |
| | | <string>202102242</string> |
| | | <string>202103051</string> |
| | | <key>NSLocationWhenInUseUsageDescription</key> |
| | | <string>Use geographic location to provide services such as weather</string> |
| | | <key>NSAppleMusicUsageDescription</key> |
| | |
| | | <constraints> |
| | | <constraint firstAttribute="height" constant="40" id="vLh-9U-8RO"/> |
| | | </constraints> |
| | | <color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
| | | <fontDescription key="fontDescription" type="system" pointSize="14"/> |
| | | <textInputTraits key="textInputTraits" keyboardType="alphabet"/> |
| | | <connections> |
| | |
| | | <constraints> |
| | | <constraint firstAttribute="height" constant="40" id="DjM-dg-5en"/> |
| | | </constraints> |
| | | <color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
| | | <fontDescription key="fontDescription" type="system" pointSize="14"/> |
| | | <textInputTraits key="textInputTraits" keyboardType="alphabet"/> |
| | | <connections> |
| | |
| | | <constraints> |
| | | <constraint firstAttribute="height" constant="34" id="FPO-BB-N1L"/> |
| | | </constraints> |
| | | <color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
| | | <fontDescription key="fontDescription" type="system" pointSize="14"/> |
| | | <textInputTraits key="textInputTraits" secureTextEntry="YES"/> |
| | | </textField> |
| | |
| | | <inferredMetricsTieBreakers> |
| | | <segue reference="9TP-S2-hhI"/> |
| | | <segue reference="MFl-yy-ZsP"/> |
| | | <segue reference="VYk-37-nb6"/> |
| | | <segue reference="ikM-Zn-H8f"/> |
| | | </inferredMetricsTieBreakers> |
| | | <resources> |
| | | <image name="addDevice_success" width="320" height="185"/> |
| | |
| | | <subviews> |
| | | <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请è¾å
¥è®¾å¤åç§°" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="r1W-d8-Rg7"> |
| | | <rect key="frame" x="0.0" y="94" width="375" height="40"/> |
| | | <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
| | | <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
| | | <constraints> |
| | | <constraint firstAttribute="height" constant="40" id="NLX-OK-XZ7"/> |
| | | </constraints> |
| | | <color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
| | | <fontDescription key="fontDescription" type="system" pointSize="14"/> |
| | | <textInputTraits key="textInputTraits"/> |
| | | </textField> |
| | |
| | | <inferredMetricsTieBreakers> |
| | | <segue reference="Qls-Y0-o2u"/> |
| | | <segue reference="X3Q-o5-p8V"/> |
| | | <segue reference="q2I-Q5-CUY"/> |
| | | <segue reference="9Tu-UR-Cms"/> |
| | | <segue reference="vdt-wN-aOY"/> |
| | | </inferredMetricsTieBreakers> |
| | | <color key="tintColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
| | |
| | | 417=Water Leakage |
| | | 418=In Alarm |
| | | 419=Normal |
| | | 420=Hot Dry |
| | | 421=Air Dry |
| | | 420=Hot dry |
| | | 421=Air dry |
| | | 422=Disinfect |
| | | 423=Lighting |
| | | 424=Time |
| | | 425=Hot dry time |
| | | 426=Air dry time |
| | | 427=Disinfect time |
| | | 428=Anion Time |
| | | 429=h |
| | | 430=m |
| | | |
| | | |
| | | 1002=Anion |
| | | |
| | | 5000=Music |
| | | 5001=Group |
| | |
| | | 421=é£å¹² |
| | | 422=æ¶æ¯ |
| | | 423=ç
§æ |
| | | 424=æ¶é´ |
| | | 425=çå¹²æ¶é´ |
| | | 426=é£å¹²æ¶é´ |
| | | 427=æ¶æ¯æ¶é´ |
| | | 428=è´ç¦»åæ¶é´ |
| | | 429=å°æ¶ |
| | | 430=åé |
| | | |
| | | |
| | | 1000=室å
湿度 |
| | |
| | | 1033=èæç®¡ç |
| | | 1034=åå²è®°å½ |
| | | 1035=èªå¨æ¸
æ« |
| | | 1036=å®ç¹æ¸
æ« |
| | | 1036=éæºæ¸
æ« |
| | | 1037=æ²¿å¢æ¸
æ« |
| | | 1038=åºåæ¸
æ« |
| | | 1038=èºææ¸
æ« |
| | | 1039=æ»æ¸
æ´é¢ç§¯ |
| | | 1040=æ»æ¸
æ´æ¶é´ |
| | | 1041=è¾¹å·å©ä½å¯¿å½ |
| | |
| | | "ad_restart_tip"="é¿æè®¾å¤ä¸çreseté®10ç§åæ¾å¼ï¼å¹¶çå¾
大约30ç§ç´å°è®¾å¤å¯å¨å®æ"; |
| | | "ad_restart_done"="æå·²éå¯å¥½"; |
| | | "ad_get_device_info_msg"="æ£å¨æ¥è¯¢è®¾å¤ä¿¡æ¯ï¼è¯·ç¨å..."; |
| | | "ad_already_added"="æ¨å·²æ·»å è¿æ¤è®¾å¤"; |
| | | "ad_already_added"="æ¤è®¾å¤å·²è¢«æ·»å "; |
| | | "ad_added_by_others"="æ¤è®¾å¤å·²è¢«å«äººæ·»å "; |
| | | "get_info_fail"="æ¥è¯¢å¤±è´¥ï¼ç½ç»ä¸ç»å"; |
| | | "ad_input_manual"="æå¨è¾å
¥"; |
| | |
| | | ShowAlarmPushMessage(jpushMessageInfo); |
| | | //new Alert(jpushMessageInfo.Title, jpushMessageInfo.Content, Language.StringByID(StringId.Close)).Show(); |
| | | } |
| | | |
| | | |
| | | }); |
| | | return; |
| | | } |
| | |
| | | { |
| | | //Dialog |
| | | alarmPushConfirmDialog = null; |
| | | Action backAction = () => { |
| | | |
| | | Action backAction = () => |
| | | { |
| | | |
| | | }; |
| | | var skipPage = new MessageCenterPage(); |
| | | MainPage.BasePageView.AddChidren(skipPage); |
| | |
| | | { |
| | | MainPage.InternetStatus = 1; |
| | | Control.Ins.SearchLoaclGateway(); |
| | | |
| | | |
| | | } |
| | | else if (internetStatus == 2)//WiFiç½ç» |
| | | { |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 跳转æå¼è¤ç³äºæ¹æ³ |
| | | |
| | | /// <summary> |
| | | /// è·ååè´¦å·token并跳转设å¤åè¡¨é¡µé¢ |
| | | /// </summary> |
| | | /// <param name="bodyView"></param> |
| | | public void Go2EZvizMonitor(FrameLayout bodyView) |
| | | { |
| | | var waitPage = new Loading(); |
| | | bodyView.AddChidren(waitPage); |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | |
| | | new Thread(() => |
| | | { |
| | | try |
| | | { |
| | | //å
è·åè¤ç³äºåè´¦å·token |
| | | var result = new HttpServerRequest().EZGetChildToken(); |
| | | if (result.Code == StateCode.SUCCESS) |
| | | { |
| | | var ezChildAccessToken = Newtonsoft.Json.JsonConvert.DeserializeObject<EZChildAccessToken>(result.Data.ToString()); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (!string.IsNullOrEmpty(ezChildAccessToken.accessToken)) |
| | | { |
| | | #if __IOS__ |
| | | //iOS |
| | | |
| | | //1.设置æéæ²³ä¸çAccessTokenåRefreshTokenãååå°å |
| | | EZSDK.IOS.EZSDK.SetHDlAccessToken(UserInfo.Current.LoginTokenString, UserInfo.Current.RefreshToken); |
| | | EZSDK.IOS.EZSDK.SetRequestHttpsHost(OnAppConfig.Instance.RequestHttpsHost); |
| | | //2.设置è¤ç³åè´¦å·çAccessTokenå°SDK |
| | | EZSDK.IOS.EZSDK.SetEZAccessToken(ezChildAccessToken.accessToken); |
| | | //3.æå¼æå头设å¤åè¡¨é¡µé¢ |
| | | EZSDK.IOS.EZSDK.Go2EZvizMonitor(); |
| | | |
| | | #else |
| | | //Android |
| | | //1.设置æéæ²³ä¸çtokenãååå°å |
| | | //2.设置è¤ç³åè´¦å·çtoken |
| | | //3.æå¼æå头设å¤åè¡¨é¡µé¢ |
| | | ((BaseActivity)Shared.Application.Activity).SetCamera(b => |
| | | { |
| | | if (b) |
| | | { |
| | | Android.Content.Intent intent = new Android.Content.Intent(); |
| | | intent.SetComponent(new Android.Content.ComponentName(Shared.Application.Activity, "com.videogo.MainActivity")); |
| | | Shared.Application.Activity.StartActivity(intent); |
| | | } |
| | | }); |
| | | #endif |
| | | |
| | | |
| | | } |
| | | |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | IMessageCommon.Current.ShowErrorInfoAlter(result.Code); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.RemoveFromParent(); |
| | | waitPage = null; |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | { |
| | | public static class StringId |
| | | { |
| | | public const int Lightint = 433; |
| | | public const int MinuteUint = 430; |
| | | public const int HourUint = 429; |
| | | public const int AnionTime = 428; |
| | | public const int DisinfectTime = 427; |
| | | public const int WindDryTime = 426; |
| | | public const int HotDryTime = 425; |
| | | public const int Time = 424; |
| | | public const int Lightint = 423; |
| | | public const int Disinfect = 422; |
| | | public const int WindDry = 421; |
| | | public const int HotDry = 420; |
| | |
| | | /// </summary> |
| | | public const int AutoClean = 1035; |
| | | /// <summary> |
| | | /// å®ç¹æ¸
æ« |
| | | /// éæºæ¸
æ« |
| | | /// </summary> |
| | | public const int FixedPointClean = 1036; |
| | | public const int RandomClean = 1036; |
| | | /// <summary> |
| | | /// æ²¿å¢æ¸
æ« |
| | | /// </summary> |
| | | public const int WallClean = 1037; |
| | | /// <summary> |
| | | /// åºåæ¸
æ« |
| | | /// èºææ¸
æ« |
| | | /// </summary> |
| | | public const int AreaClean = 1038; |
| | | public const int SpiralClean = 1038; |
| | | /// <summary> |
| | | /// æ»æ¸
æ´é¢ç§¯ |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | public bool IsSearchLocalGatewaySuccessful = false; |
| | | |
| | | ///// <summary> |
| | | ///// |
| | | ///// </summary> |
| | | //bool _gatewayOnline1 = false; |
| | | ///// <summary> |
| | | ///// ç½å
³æ¯å¦å¨çº¿ |
| | | ///// </summary> |
| | | //public bool GatewayOnline1 |
| | | //{ |
| | | // get |
| | | // { |
| | | // return _gatewayOnline; |
| | | // } |
| | | // set |
| | | // { |
| | | // if (_gatewayOnline != value) |
| | | // { |
| | | // if(value) |
| | | // { |
| | | // if (IsRemote)//妿æ¯è¿ç¨ |
| | | // { |
| | | // if(DB_ResidenceData.Instance.HomeGateway == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // if (!DB_ResidenceData.Instance.HomeGateway.gatewayStatus)//è¿ç¨æ
åµä¸ï¼ç½å
³æªé¾æ¥æå¡å¨ä¸è½ä¿®æ¹ä¸»é¡µç½å
³ç¶æ |
| | | // { |
| | | // new System.Threading.Thread(() => { |
| | | // System.Threading.Thread.Sleep(3000); |
| | | // var pm = new DAL.Server.HttpServerRequest(); |
| | | // pm.GetGatewayInfo(); |
| | | // }) { IsBackground = true }.Start(); |
| | | // return; |
| | | // } |
| | | // } |
| | | // _gatewayOnline = value; |
| | | // //ä¿®æ¹ä¸»é¡µè¿æ¥ç¶æ |
| | | // HomePage.LoadEvent_CheckLinkStatus(); |
| | | // MainPage.Log($"ç½å
³å¨çº¿ï¼å·æ°è®¾å¤ç¶æ"); |
| | | // new System.Threading.Thread(() => |
| | | // { |
| | | // System.Threading.Thread.Sleep(1000); |
| | | // FunctionList.List.ReadAllFunctionStatus(); |
| | | // }) |
| | | // { IsBackground = true, Priority = System.Threading.ThreadPriority.AboveNormal }.Start(); |
| | | // } |
| | | // else |
| | | // { |
| | | // _gatewayOnline = value; |
| | | // //ä¿®æ¹ä¸»é¡µè¿æ¥ç¶æ |
| | | // HomePage.LoadEvent_CheckLinkStatus(); |
| | | // } |
| | | // } |
| | | // } |
| | | //} |
| | | |
| | | |
| | | bool _GatewayOnline_Local = false; |
| | | /// <summary> |
| | | /// ç½å
³å¨çº¿-å±åç½ |
| | |
| | | var pack = pm.GetDeviceInfoList(functionIds); |
| | | if(pack!= null&& pack.Data!=null) |
| | | { |
| | | var ddd = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Function>>(pack.Data.ToString()); |
| | | //å¾
æµè¯2021-03-04 |
| | | var ddd = Newtonsoft.Json.JsonConvert.DeserializeObject<List<AlinkStatusData>>(pack.Data.ToString()); |
| | | if(ddd!= null) |
| | | { |
| | | foreach(var function in ddd) |
| | |
| | | var temp = FunctionList.List.GetDeviceFunctionList().Find((obj) => obj.deviceId == function.deviceId); |
| | | if(temp!= null) |
| | | { |
| | | temp = function; |
| | | if (SPK.Get3tySpk(SPK.BrandType.Tuya).Contains(temp.spk)) |
| | | { |
| | | Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(temp.sid, temp.status); |
| | | Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(temp.sid, function.status); |
| | | } |
| | | } |
| | | } |
| | |
| | | var pack = pm.RefreshDeviceStatus(new List<string>() { function.deviceId }); |
| | | } |
| | | } |
| | | ///// <summary> |
| | | ///// åéAå议读åå½ä»¤ |
| | | ///// </summary> |
| | | //public void SendReadCommand(List<Dictionary<string, string>> keyValuePairs) |
| | | //{ |
| | | // var readDataObj = new GatewayAlinkReadObj() |
| | | // { |
| | | // id = Ins.msg_id.ToString(), |
| | | // objects = keyValuePairs, |
| | | // time_stamp = Utlis.GetTimestamp() |
| | | // }; |
| | | // var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(readDataObj); |
| | | // var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.ReadStatus, functionControlDataJson); |
| | | // Ins.myUdp.SendLocalHdlLinkData(sendBytes); |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// aåè®®æ§å¶åºæ¯ |
| | |
| | | { |
| | | if (!Ins.GatewayOnline_Local)//ç½å
³æ¬å°ä¸å¨çº¿ |
| | | { |
| | | //äºç«¯åå¤çåéä¸ç«¯å£åºæ¯ |
| | | //if (DB_ResidenceData.Instance.GatewayType == 0) |
| | | //{ |
| | | // new Control_Udp().ControlBusScenes(scene); |
| | | //} |
| | | //else |
| | | { |
| | | var pm = new DAL.Server.HttpServerRequest(); |
| | | var result = pm.ExecuteScene(scene.userSceneId); |
| | | } |
| | | var pm = new DAL.Server.HttpServerRequest(); |
| | | var result = pm.ExecuteScene(scene.userSceneId); |
| | | } |
| | | else |
| | | { |
| | |
| | | /// Aåè®®æ°æ® |
| | | /// </summary> |
| | | /// <param name="updateBytes"></param> |
| | | public void UpdataFunctionStatus(string revString, byte[] usefulBytes) |
| | | public void UpdataFunctionStatus(string revString, byte[] usefulBytes,bool isCloudData = false) |
| | | { |
| | | MainPage.Log($"Aåè®®æ´æ°ç¶æ:{revString}"); |
| | | |
| | | if (Ins.GatewayOnline_Local && isCloudData)//æ¬å°é¾æ¥ï¼é¤äºæ¶é¸¦è®¾å¤æ°æ®ä¹å¤çäºç«¯æ°æ®ä¸å¤ç |
| | | { |
| | | if (FunctionList.List.GetDeviceFunctionList(SPK.BrandType.Tuya).Count == 0) |
| | | { |
| | | //MainPage.Log($"Aåè®®æ´æ°ç¶æ:æ¬å°é¾æ¥ï¼é¤äºæ¶é¸¦è®¾å¤æ°æ®ä¹å¤çäºç«¯æ°æ®ä¸å¤ç..."); |
| | | return; |
| | | } |
| | | } |
| | | var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<AlinkFunctionStatusObj>(revString); |
| | | if (temp != null) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | //bool hadChange = false;//ç¶ææåååæ´æ°çé¢ |
| | | var localFunction = allLocalFuntion.Find((obj) => obj.sid == updateTemp.sid); |
| | | if (localFunction != null) |
| | | if (localFunction == null) |
| | | { |
| | | //æ´æ°çé¢ç¶æ |
| | | Function localObj = null; |
| | | switch (localFunction.spk) |
| | | continue; |
| | | } |
| | | if (Ins.GatewayOnline_Local && isCloudData)//æ¬å°é¾æ¥ï¼é¤äºæ¶é¸¦è®¾å¤æ°æ®ä¹å¤çäºç«¯æ°æ®ä¸å¤ç |
| | | { |
| | | if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(localFunction.spk)) |
| | | { |
| | | case SPK.LightSwitch: |
| | | var localSwitch = FunctionList.List.lights.Find((obj) => obj.sid == updateTemp.sid); |
| | | if (localSwitch != null) |
| | | { |
| | | 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; |
| | | } |
| | | } |
| | | //rgb.lastState = Language.StringByID(StringId.Brightness) + " : " + rgb.brightness + "%"; |
| | | RelayPage.UpdataState(localSwitch); |
| | | } |
| | | break; |
| | | case SPK.LightDimming: |
| | | var dimming = FunctionList.List.lights.Find((obj) => obj.sid == updateTemp.sid); |
| | | if (dimming != null) |
| | | { |
| | | 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); |
| | | } |
| | | break; |
| | | case SPK.ElectricFan: |
| | | var fan = FunctionList.List.fans.Find((obj) => obj.sid == updateTemp.sid); |
| | | if (fan != null) |
| | | { |
| | | localObj = fan; |
| | | foreach (var attr in updateTemp.status) |
| | | { |
| | | var localAttr = fan.attributes.Find((obj) => obj.key == attr.key); |
| | | if (localAttr != null) |
| | | { |
| | | 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) |
| | | { |
| | | localObj = rgb; |
| | | foreach (var attr in updateTemp.status) |
| | | { |
| | | var localAttr = rgb.attributes.Find((obj) => obj.key == attr.key); |
| | | if (localAttr != null) |
| | | { |
| | | 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.trait_mode.curValue.ToString()) |
| | | { |
| | | 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.trait_fan.curValue.ToString()) |
| | | { |
| | | 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.trait_temp.curValue + 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: |
| | | //设å¤ç¶ææ¨é |
| | | var myDevice = Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid,updateTemp.status); |
| | | if (myDevice != null)
|
| | | {
|
| | | localObj = myDevice;
|
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | if (localObj != null)
|
| | | {
|
| | | HomePage.UpdataFunctionStates(localObj);
|
| | | RoomPage.UpdataStates(localObj);
|
| | | FunctionPage.UpdataStates(localObj);
|
| | | ClassificationPage.UpdataInfo(localObj);
|
| | | //MainPage.Log($"Aåè®®æ´æ°ç¶æ:æ¬å°é¾æ¥ï¼é¤äºæ¶é¸¦è®¾å¤æ°æ®ä¹å¤çäºç«¯æ°æ®ä¸å¤ç........"); |
| | | return; |
| | | } |
| | | } |
| | | MainPage.Log($"Aåè®®æ´æ°ç¶æ:{revString}"); |
| | | foreach (var attr in updateTemp.status) |
| | | { |
| | | localFunction.SetAttrState(attr.key, attr.value); |
| | | } |
| | | |
| | | //æ´æ°çé¢ç¶æ |
| | | Function localObj = null; |
| | | switch (localFunction.spk) |
| | | { |
| | | 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)) |
| | | { |
| | | 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; |
| | | } |
| | | switch (localFunction.GetAttrState(FunctionAttributeKey.FanSpeed)) |
| | | { |
| | | 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; |
| | | } |
| | | 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) |
| | | { |
| | | 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.GetElectricSocketList().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; |
| | | } |
| | | |
| | | HomePage.UpdataFunctionStates(localFunction); |
| | | RoomPage.UpdataStates(localFunction); |
| | | FunctionPage.UpdataStates(localFunction); |
| | | ClassificationPage.UpdataInfo(localFunction); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | } |
| | | 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.trait_mode.curValue = attr.value; |
| | | break; |
| | | case FunctionAttributeKey.FanSpeed: |
| | | tempAc.trait_fan.curValue = attr.value; |
| | | break; |
| | | case FunctionAttributeKey.SetTemp: |
| | | tempAc.trait_temp.curValue = 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.trait_temp.curValue), 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: |
| | |
| | | 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) |
| | |
| | | switch (function.Spk_Prefix) |
| | | { |
| | | case FunctionCategory.Light: |
| | | var light = function as Light; |
| | | switch (light.spk) |
| | | switch (function.spk) |
| | | { |
| | | case SPK.LightCCT: |
| | | byte b0 = 100;//å¼å
³æä½ä¾æ®on_offåæ®µï¼å®é
å¼å
³å¼ä¾æ®brightnessï¼å½on_off为æå¼ï¼brightnessä¸è½ä¸º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;//å¼å
³æä½ä¾æ®on_offåæ®µï¼å®é
å¼å
³å¼ä¾æ®brightnessï¼å½on_off为æå¼ï¼brightnessä¸è½ä¸º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; |
| | | } |
| | |
| | | { |
| | | 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; |
| | |
| | | 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.trait_temp.curValue), 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; |
| | |
| | | modeKey = 2; |
| | | break; |
| | | } |
| | | ControlBytesSend(Command.InstructionPanelKey, aC.bus.SubnetID, aC.bus.DeviceID, new byte[] { modeKey, Convert.ToByte(aC.trait_temp.curValue), 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}"); |
| | |
| | | } |
| | | 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; |
| | | } |
| | |
| | | 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; |
| | |
| | | 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) |
| | | { |
| | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | { |
| | | 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]) |
| | |
| | | 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; |
| | | } |
| | |
| | | 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; |
| | |
| | | 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) |
| | |
| | | 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); |
| | |
| | | } |
| | | 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; |
| | | } |
| | | } |
| | |
| | | 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]) |
| | | { |
| | |
| | | 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); |
| | |
| | | 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) |
| | | { |
| | |
| | | { |
| | | 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 |
| | | { |
| | |
| | | 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.trait_IndoorTemp.curValue = receiveBytes[2].ToString(); |
| | | ac.trait_on_off.curValue = receiveBytes[8] == 1 ? "on" : "off"; |
| | | ac.curModeIndex = receiveBytes[9]; |
| | | ac.curFanIndex = receiveBytes[10]; |
| | | ac.trait_temp.curValue = receiveBytes[11].ToString(); |
| | | ac.lastState = ""; |
| | | switch (ac.trait_mode.curValue.ToString()) |
| | | 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.trait_fan.curValue.ToString()) |
| | | 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.trait_temp.curValue + 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) |
| | |
| | | { |
| | | 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); |
| | |
| | | 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) |
| | |
| | | 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); |
| | |
| | | { |
| | | 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.trait_temp.curValue = receiveBytes[1].ToString(); |
| | | function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[1].ToString()); |
| | | break; |
| | | case 5: |
| | | ac.curFanIndex = receiveBytes[1]; |
| | | acFunction.SetFan ( receiveBytes[1],function); |
| | | break; |
| | | case 6: |
| | | ac.curModeIndex = receiveBytes[1]; |
| | | acFunction.SetMode ( receiveBytes[1],function); |
| | | break; |
| | | |
| | | } |
| | | ac.lastState = ""; |
| | | ac.lastState += " " + ac.trait_temp.curValue + 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]) |
| | | { |
| | | ac.trait_IndoorTemp.curValue = receiveBytes[1].ToString(); |
| | | ac.SetAttrState(FunctionAttributeKey.IndoorTemp, receiveBytes[1].ToString()); |
| | | FunctionPage.UpdataStates(ac); |
| | | } |
| | | } |
| | |
| | | { |
| | | var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey); |
| | | var revString = Encoding.UTF8.GetString(bytes); |
| | | Control.Ins.UpdataFunctionStatus(revString, null); |
| | | Control.Ins.UpdataFunctionStatus(revString, null,true); |
| | | } |
| | | //ä¸ç«¯å£æ°æ®è§£æ |
| | | else |
| | |
| | | { |
| | | } |
| | | |
| | | #region kaede ___________ä¼ æå¨å岿°æ®__________________ |
| | | /// <summary> |
| | | /// è·åä¼ æå¨å岿°æ® |
| | | /// </summary> |
| | | /// <param name="subnetId"></param> |
| | | /// <param name="deviceId"></param> |
| | | /// <param name="bigClass"></param> |
| | | /// <param name="minClass"></param> |
| | | /// <param name="queryType"></param> |
| | | /// <param name="loopId"></param> |
| | | /// <param name="nowMonth"></param> |
| | | /// <param name="mac"></param> |
| | | /// <param name="qType">æ¶é´æ¥è¯¢ç±»åï¼hour=è¿24å°æ¶ãweek=è¿ä¸å¨ãmonth = è¿ä¸æ </param> |
| | | /// <param name="deviceId">设å¤ID</param> |
| | | /// <param name="deviceKey">åè½æ¥è¯¢ç±»åï¼pm25</param> |
| | | /// <returns></returns> |
| | | public ResponsePack GetSensorHistory(int subnetId, int deviceId, int bigClass, int minClass, int queryType, int loopId, int nowMonth, string mac) |
| | | public ResponsePackNew GetSensorHistory(string qType, string deviceId,string deviceKey) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("SubnetID", subnetId); |
| | | d.Add("DeviceID", deviceId); |
| | | d.Add("LargeType", bigClass); |
| | | d.Add("SmallType", minClass); |
| | | d.Add("QueryType", queryType); |
| | | d.Add("loopId", loopId); |
| | | d.Add("NowMonth", nowMonth); |
| | | d.Add("MAC", DB_ResidenceData.Instance.residenceGatewayMAC); |
| | | d.Add("LocalTimeZone", 8); |
| | | var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d); |
| | | return RequestHttps("https://developer.hdlcontrol.com/api/GetSensorPushHistory", jsonString, true); |
| | | d.Add("type", qType); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | d.Add("deviceId", new List<string>() { deviceId }); |
| | | d.Add("key", new List<string>() { deviceKey }); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_EnvironmentalSensorHistoricalData, requestJson); |
| | | } |
| | | /// <summary> |
| | | /// è·åå®é²ä¼ æå¨å岿°æ® |
| | | /// </summary> |
| | | /// <param name="deviceId">设å¤ID</param> |
| | | /// <param name="pageSize">页é¢å¤§å°</param> |
| | | /// <param name="pageNo">页å·</param> |
| | | /// <returns></returns> |
| | | public ResponsePackNew GetArmSensorHistory( string deviceId,string pageSize, string pageNo) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | d.Add("deviceId", deviceId); |
| | | d.Add("pageSize", pageSize); |
| | | d.Add("pageNo", pageNo); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_ArmSensorHistoricalData, requestJson); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | | //public string GetRequestResultMsg(string resultCode) |
| | | //{ |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region è¤ç³äºSDKç¸å
³æ¥å£ |
| | | /// <summary> |
| | | /// æ²³ä¸è·åè¤ç³äºåè´¦å·tokençæ¥å£ |
| | | /// </summary> |
| | | public ResponsePackNew EZGetChildToken() |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | //d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_EZ_GetChildToken, requestJson); |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | } |
| | |
| | | { |
| | | public class NewAPI |
| | | { |
| | | #region æ°å¾®æå¡æ¥å£ |
| | | //#region æ°å¾®æå¡æ¥å£ |
| | | //*********************************************** |
| | | //注æï¼åä½å®
ç¸å
³çæ¥å£è¦è¯·æ±ä½å®
æå¨åºåçåå regionUrl |
| | | //*********************************************** |
| | |
| | | /// åæ¶æ¶èè®¾å¤ |
| | | /// </summary> |
| | | public const string Api_Post_CancelCollectDevice = "/home-wisdom/app/device/cancelCollect"; |
| | | /// <summary> |
| | | /// è·åç¯å¢ä¼ æå¨å岿°æ® å°æ¶/å¨/æç»è®¡æ°æ® |
| | | /// </summary> |
| | | public const string Api_Post_EnvironmentalSensorHistoricalData = "/home-wisdom/app/statistics/device/hourWeekMonth"; |
| | | /// <summary> |
| | | /// è·åå®é²ä¼ æå¨å岿°æ® |
| | | /// </summary> |
| | | public const string Api_Post_ArmSensorHistoricalData = "/home-wisdom/app/device/message"; |
| | | #endregion |
| | | |
| | | #region Kaede -- åºæ¯æ¥å£____________________________ |
| | |
| | | /// 饿§å¨èªå¦æé®å é¤ |
| | | /// </summary> |
| | | public const string API_POST_Ir_CodeRemove = "/home-wisdom/app/device/ir/codeRemove"; |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region â -- è¤ç³SDKç¸å
³æ¥å£___________________________ |
| | | /// <summary> |
| | | /// æ²³ä¸è·åè¤ç³äºåè´¦å·tokençæ¥å£ |
| | | /// </summary> |
| | | public const string API_POST_EZ_GetChildToken = "/home-wisdom/platform/childToken"; |
| | | /// <summary> |
| | | /// 红å¤å®/饿§å¨å é¤ |
| | | /// </summary> |
| | |
| | | public string messageType; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è¤ç³äºåè´¦å·token |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class EZChildAccessToken |
| | | { |
| | | /// <summary> |
| | | /// token |
| | | /// </summary> |
| | | public string accessToken; |
| | | /// <summary> |
| | | /// è¿ææ¶é´ |
| | | /// </summary> |
| | | public string expireTime; |
| | | } |
| | | |
| | | |
| | | //#region æ§æ¥å£ |
| | | ///// <summary> |
| | | ///// |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.Entity |
| | | { |
| | | public class AC : Function |
| | | public class AC |
| | | { |
| | | /* |
| | | * 空è°ï¼trait: [switch, mode, fan, set_temp, swing, lock]
|
| | | * 屿§ æè¿°
|
| | | * on_off on/off
|
| | | * mode mode: auto, cool, heat, dry, fan
|
| | | * fan high, medium, low, auto
|
| | | * set_temp up,down,value
|
| | | * swing up/down/left/right
|
| | | * lock boolean (Locké宿§å¶) |
| | | */ |
| | | public 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"); |
| | | } |
| | | } |
| | | |
| | |
| | | /// å½å模å¼ç´¢å¼ |
| | | /// busæ§å¶å½ä»¤ä½¿ç¨ |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public byte curModeIndex |
| | | public byte GetModeIndex(Function function) |
| | | { |
| | | get |
| | | var value = function.GetAttrState(FunctionAttributeKey.Mode); |
| | | byte index = 0; |
| | | switch (value) |
| | | { |
| | | try |
| | | { |
| | | byte index = 0; |
| | | switch (trait_mode.curValue.ToString()) |
| | | { |
| | | 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; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"get curModeIndex error : {ex.Message}"); |
| | | return 0; |
| | | } |
| | | 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; |
| | | } |
| | | set |
| | | { |
| | | switch (value) |
| | | { |
| | | case 0: |
| | | trait_mode.curValue = "cool"; |
| | | break; |
| | | case 1: |
| | | trait_mode.curValue = "heat"; |
| | | break; |
| | | case 2: |
| | | trait_mode.curValue = "fan"; |
| | | break; |
| | | case 3: |
| | | trait_mode.curValue = "auto"; |
| | | break; |
| | | case 4: |
| | | trait_mode.curValue = "dry"; |
| | | break; |
| | | default: |
| | | trait_mode.curValue = "cool"; |
| | | break; |
| | | |
| | | } |
| | | } |
| | | return index; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置busåè®®æ 记设置aåè®®æ°æ® |
| | | /// </summary> |
| | | public void SetMode(int index , Function function) |
| | | { |
| | | string value = "auto"; |
| | | switch (index) |
| | | { |
| | | case 3: |
| | | value = "auto"; |
| | | break; |
| | | case 0: |
| | | value = "cool"; |
| | | break; |
| | | case 1: |
| | | value = "heat"; |
| | | break; |
| | | case 4: |
| | | value = "dry"; |
| | | break; |
| | | case 2: |
| | | value = "fan"; |
| | | break; |
| | | } |
| | | function.SetAttrState(FunctionAttributeKey.Mode, value); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å½åé£éç´¢å¼ |
| | | /// busæ§å¶å½ä»¤ä½¿ç¨ |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public byte curFanIndex |
| | | public byte GetFanIndex(Function function) |
| | | { |
| | | get |
| | | var value = function.GetAttrState(FunctionAttributeKey.FanSpeed); |
| | | byte index = 0; |
| | | switch (value) |
| | | { |
| | | try |
| | | { |
| | | byte index = 0; |
| | | switch (trait_fan.curValue.ToString()) |
| | | { |
| | | 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; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"get curFanIndex error : {ex.Message}"); |
| | | return 0; |
| | | } |
| | | case "high": |
| | | index = 1; |
| | | break; |
| | | case "medium": |
| | | index = 2; |
| | | break; |
| | | case "low": |
| | | index = 3; |
| | | break; |
| | | case "auto": |
| | | index = 0; |
| | | break; |
| | | default: |
| | | index = 0; |
| | | break; |
| | | } |
| | | set |
| | | { |
| | | switch (value) |
| | | { |
| | | case 0: |
| | | trait_fan.curValue = "auto"; |
| | | break; |
| | | case 1: |
| | | trait_fan.curValue = "high"; |
| | | break; |
| | | case 2: |
| | | trait_fan.curValue = "medium"; |
| | | break; |
| | | case 3: |
| | | trait_fan.curValue = "low"; |
| | | break; |
| | | default: |
| | | trait_fan.curValue = "high"; |
| | | break; |
| | | } |
| | | } |
| | | return index; |
| | | } |
| | | |
| | | FunctionAttributes _trait_mode; |
| | | /// <summary> |
| | | /// 模å¼å±æ§ |
| | | /// æ ¹æ®busåè®®é£éæ 记设置aåè®®æ è®° |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public FunctionAttributes trait_mode |
| | | public void SetFan(int index,Function function) |
| | | { |
| | | get |
| | | string value = "high"; |
| | | switch (index) |
| | | { |
| | | if (_trait_mode == null) |
| | | { |
| | | _trait_mode = attributes.Find((obj) => obj.key == "mode"); |
| | | //æ¾ä¸å°å±æ§éè¦å£°æä¸ä¸ªï¼é²æ¢æ¥ééªé |
| | | 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; |
| | | case 1: |
| | | value = "high"; |
| | | break; |
| | | case 2: |
| | | value = "medium"; |
| | | break; |
| | | case 3: |
| | | value = "low"; |
| | | break; |
| | | case 0: |
| | | value = "auto"; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | FunctionAttributes _trait_fan; |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public FunctionAttributes trait_fan |
| | | { |
| | | get |
| | | { |
| | | if (_trait_fan == null) |
| | | { |
| | | _trait_fan = attributes.Find((obj) => obj.key == "fan"); |
| | | //æ¾ä¸å°å±æ§éè¦å£°æä¸ä¸ªï¼é²æ¢æ¥ééªé |
| | | 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"); |
| | | //æ¾ä¸å°å±æ§éè¦å£°æä¸ä¸ªï¼é²æ¢æ¥ééªé |
| | | 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"); |
| | | //æ¾ä¸å°å±æ§éè¦å£°æä¸ä¸ªï¼é²æ¢æ¥ééªé |
| | | 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); |
| | | //æ¾ä¸å°å±æ§éè¦å£°æä¸ä¸ªï¼é²æ¢æ¥ééªé |
| | | 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; |
| | | } |
| | | function.SetAttrState(FunctionAttributeKey.FanSpeed, value); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å½å模å¼çiconè·¯å¾ |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public string curModeImage |
| | | /// <param name="lightingIcon">è·åç徿 ç±»åï¼é»è®¤æ¯ç¹äº®</param> |
| | | /// <returns></returns> |
| | | public string GetModeIconPath(string modeValue , bool lightingIcon = true) |
| | | { |
| | | get |
| | | var imagePath = "FunctionIcon/AC/CoolIcon.png"; |
| | | if (lightingIcon) |
| | | { |
| | | try |
| | | switch (modeValue) |
| | | { |
| | | var imagePath = "FunctionIcon/AC/CoolIcon.png"; |
| | | switch (trait_mode.curValue.ToString()) |
| | | { |
| | | case "auto": |
| | | imagePath = "FunctionIcon/AC/AutoIcon.png"; |
| | | break; |
| | | case "cool": |
| | | imagePath = "FunctionIcon/AC/CoolIcon.png"; |
| | | break; |
| | | case "heat": |
| | | imagePath = "FunctionIcon/AC/HeatingIcon.png"; |
| | | break; |
| | | case "dry": |
| | | imagePath = "FunctionIcon/AC/DehumidificationIcon.png"; |
| | | break; |
| | | case "fan": |
| | | imagePath = "FunctionIcon/AC/AirSupplyIcon.png"; |
| | | break; |
| | | default: |
| | | imagePath = "FunctionIcon/AC/CoolIcon.png"; |
| | | break; |
| | | } |
| | | return imagePath; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"ac ge curModeImage error : {ex.Message}"); |
| | | return "FunctionIcon/AC/CoolIcon.png"; |
| | | case "auto": |
| | | imagePath = "FunctionIcon/AC/AutoIcon.png"; |
| | | break; |
| | | case "cool": |
| | | imagePath = "FunctionIcon/AC/CoolIcon.png"; |
| | | break; |
| | | case "heat": |
| | | imagePath = "FunctionIcon/AC/HeatingIcon.png"; |
| | | break; |
| | | case "dry": |
| | | imagePath = "FunctionIcon/AC/DehumidificationIcon.png"; |
| | | break; |
| | | case "fan": |
| | | imagePath = "FunctionIcon/AC/AirSupplyIcon.png"; |
| | | break; |
| | | default: |
| | | imagePath = "FunctionIcon/AC/CoolIcon.png"; |
| | | break; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | imagePath = "FunctionIcon/AC/AutoIconGray.png"; |
| | | switch (modeValue) |
| | | { |
| | | case "auto": |
| | | imagePath = "FunctionIcon/AC/AutoIconGray.png"; |
| | | break; |
| | | case "cool": |
| | | imagePath = "FunctionIcon/AC/CoolIconGray.png"; |
| | | break; |
| | | case "heat": |
| | | imagePath = "FunctionIcon/AC/HeatingIconGray.png"; |
| | | break; |
| | | case "dry": |
| | | imagePath = "FunctionIcon/AC/DehumidificationIconGray.png"; |
| | | break; |
| | | case "fan": |
| | | imagePath = "FunctionIcon/AC/AirSupplyIconGray.png"; |
| | | break; |
| | | } |
| | | } |
| | | return imagePath; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å½åé£éçiconè·¯å¾ |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public string curFanImage |
| | | /// <param name="lightingIcon">è·åç徿 ç±»åï¼é»è®¤æ¯ç¹äº®</param> |
| | | /// <returns></returns> |
| | | public string GetFanIconPath(string modeValue, bool lightingIcon = true) |
| | | { |
| | | get |
| | | var imagePath = "FunctionIcon/AC/WindHighIcon.png"; |
| | | if (lightingIcon) |
| | | { |
| | | try |
| | | switch (modeValue) |
| | | { |
| | | var imagePath = "FunctionIcon/AC/WindHighIcon.png"; |
| | | switch (trait_fan.curValue.ToString()) |
| | | { |
| | | case "high": |
| | | imagePath = "FunctionIcon/AC/WindHighIcon.png"; |
| | | break; |
| | | case "medium": |
| | | imagePath = "FunctionIcon/AC/WindMediumIcon.png"; |
| | | break; |
| | | case "low": |
| | | imagePath = "FunctionIcon/AC/WindLowIcon.png"; |
| | | break; |
| | | case "auto": |
| | | imagePath = "FunctionIcon/AC/AutoIcon.png"; |
| | | break; |
| | | default: |
| | | imagePath = "FunctionIcon/AC/WindHighIcon.png"; |
| | | break; |
| | | } |
| | | return imagePath; |
| | | }catch (Exception ex) |
| | | { |
| | | MainPage.Log($"ac get curFanImage error : {ex.Message}"); |
| | | return "FunctionIcon/AC/WindHighIcon.png"; |
| | | case "high": |
| | | imagePath = "FunctionIcon/AC/WindHighIcon.png"; |
| | | break; |
| | | case "medium": |
| | | imagePath = "FunctionIcon/AC/WindMediumIcon.png"; |
| | | break; |
| | | case "low": |
| | | imagePath = "FunctionIcon/AC/WindLowIcon.png"; |
| | | break; |
| | | case "auto": |
| | | imagePath = "FunctionIcon/AC/AutoIcon.png"; |
| | | break; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | switch (modeValue) |
| | | { |
| | | case "high": |
| | | imagePath = "FunctionIcon/AC/WindHighIconGray.png"; |
| | | break; |
| | | case "medium": |
| | | imagePath = "FunctionIcon/AC/WindMediumIconGray.png"; |
| | | break; |
| | | case "low": |
| | | imagePath = "FunctionIcon/AC/WindLowIconGray.png"; |
| | | break; |
| | | case "auto": |
| | | imagePath = "FunctionIcon/AC/AutoIconGray.png"; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | return imagePath; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// è·å模å¼å±æ§ææ¬ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public string GetModeAttrText(string value) |
| | | { |
| | | string text = ""; |
| | | switch (value) |
| | | { |
| | | #region æ¨¡å¼ |
| | | case "auto": |
| | | text = Language.StringByID(StringId.Auto); |
| | | break; |
| | | case "cool": |
| | | text = Language.StringByID(StringId.Cool); |
| | | break; |
| | | case "heat": |
| | | text = Language.StringByID(StringId.Heat); |
| | | break; |
| | | case "dry": |
| | | text = Language.StringByID(StringId.Dry); |
| | | break; |
| | | case "fan": |
| | | text = Language.StringByID(StringId.AirSupply); |
| | | break; |
| | | #endregion |
| | | } |
| | | return text; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åé£é屿§ææ¬ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public string GetFanAttrText(string value) |
| | | { |
| | | string text = ""; |
| | | switch (value) |
| | | { |
| | | #region é£é |
| | | case "high": |
| | | text = Language.StringByID(StringId.HighWindSpeed); |
| | | break; |
| | | case "medium": |
| | | text = Language.StringByID(StringId.MiddleWindSpeed); |
| | | break; |
| | | case "low": |
| | | text = Language.StringByID(StringId.LowWindSpeed); |
| | | break; |
| | | case "auto": |
| | | text = Language.StringByID(StringId.Auto); |
| | | break; |
| | | #endregion |
| | | } |
| | | return text; |
| | | } |
| | | |
| | | } |
| | |
| | | using System;
|
| | | namespace HDL_ON.Entity
|
| | | {
|
| | | public class AirCleaner : Function
|
| | | public class AirCleaner |
| | | {
|
| | | public AirCleaner()
|
| | | {
|
| | |
| | | |
| | | 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)); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | namespace HDL_ON.Entity |
| | | { |
| | | public class Fan : Function |
| | | public class Fan |
| | | { |
| | | public Fan() |
| | | { |
| | | } |
| | | |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public FunctionAttributes trait_openLevel; |
| | | /// <summary> |
| | | /// æ¡£ä½ |
| | | /// </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 æ°æ®å·æ°å¤±è´¥."); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | namespace HDL_ON.Entity |
| | | { |
| | | public class FloorHeating : Function |
| | | public class FloorHeating |
| | | { |
| | | /* |
| | | *å°çï¼trait: [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"); |
| | | //æ¾ä¸å°å±æ§éè¦å£°æä¸ä¸ªï¼é²æ¢æ¥ééªé |
| | | 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> |
| | |
| | | /// </summary> |
| | | public byte timeFlag = 0; |
| | | |
| | | FunctionAttributes _trait_IndoorTemp; |
| | | /// <summary> |
| | | /// 室å
温度 |
| | | /// è·å模å¼çiconè·¯å¾ |
| | | /// </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); |
| | | //æ¾ä¸å°å±æ§éè¦å£°æä¸ä¸ªï¼é²æ¢æ¥ééªé |
| | | 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"); |
| | | //æ¾ä¸å°å±æ§éè¦å£°æä¸ä¸ªï¼é²æ¢æ¥ééªé |
| | | 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> |
| | | /// å½å模å¼çiconè·¯å¾ |
| | | /// </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"; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | return attrs; |
| | | } |
| | | /// <summary> |
| | | /// è·åå¶å®å±æ§ |
| | | /// è·åæå®å±æ§ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public FunctionAttributes GetAttribute(string key) |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·å屿§ç¶æ |
| | | /// è·å屿§å½åç¶æ |
| | | /// </summary> |
| | | /// <param name="key"></param> |
| | | /// <returns></returns> |
| | | public string GetAttrState(string key) |
| | | { |
| | | var attrState = status.Find((s) => s.key == key.ToString()); |
| | | if(attrState == null) |
| | | var attrState = attributes.Find((s) => s.key == key.ToString()); |
| | | if (attrState == null || string.IsNullOrEmpty(attrState.state)) |
| | | { |
| | | return ""; |
| | | return "0"; |
| | | } |
| | | return attrState.value; |
| | | return attrState.state; |
| | | } |
| | | /// <summary> |
| | | /// è®¾ç½®å±æ§ç¶æ |
| | |
| | | /// <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()); |
| | | if (attrState == null) |
| | | //var attrState = status.Find((s) => s.key == key.ToString()); |
| | | var attr = attributes.Find((s) => s.key == key); |
| | | if (attr == null) |
| | | { |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | attrState.value = 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 |
| | | |
| | | |
| | | #region base info |
| | | /// <summary> |
| | | /// HDLç»ä¸åè®®æ ¼å¼ï¼14bytes |
| | | /// 举ä¾ï¼ æ¥æº åå代ç é讯æ¹å¼ äº§åæ¶é´æ³ 产åç±»å« ç©æ¨¡åç±» ééå· å¤§å°ç±»å« |
| | | /// 1byte 1byte 1byte 4byte 1byte 2byte 2byte 2byte |
| | | /// æ¥æºï¼00 é»è®¤åçæç³»ç»æ°æ® ã01 ç½å
³æè
å
¶ä»A设å¤ã02 è°è¯è½¯ä»¶ã03 APPåºç¨ç¨åºã04 ç¬¬ä¸æ¹ç½å
³æè
å¹³å° |
| | | /// åå代ç ï¼01 HDL |
| | | /// é讯æ¹å¼ï¼01 HDL Busã02 Zigbeeã03 KNXã04 Z-Wave |
| | | /// äº§åæ¶é´æ³ï¼4bytes 以2020å¹´1æ1æ¥ç®åºçæ¶é´æ³0.1s为åä½ |
| | | /// 产åç±»å«ï¼01 è°å
å¨ã02 ç»§çµå¨ã03 å¹²æ¥ç¹æ¨¡åã04 ä¼ æå¨ã05 颿¿ |
| | | /// ç©æ¨¡åç±»åï¼ |
| | | /// 01 å¼å
³ç±»ï¼01 å¼å
³ã02 æåº§ã03 |
| | | /// 02 ç
§æï¼ 01 å¼å
³ã02 è°å
ã03 è²æ¸©ã04 LED |
| | | /// 03 é®é³ï¼ 01 çªå¸çµæºã02 ç¾å¶çªã03 å¼åå¸ã04 å·å¸ |
| | | /// 04 ææ¸©å¨ï¼01 空è°ã02 å°æã03 æ¯ç»ç©ºè° |
| | | /// 05 æ°é£ |
| | | /// 06 å½±é³ |
| | | /// 07 é³ä¹ |
| | | /// 08 è½æº |
| | | /// 09 å®é² |
| | | /// å¤§ç±»å« 1bytes ï¼é¢çï¼ |
| | | /// å°ç±»å« 1byte ï¼é¢çï¼ |
| | | /// </summary> â0001021599F98A04050300010000â |
| | | public string sid = "0301011234567801012301230123"; |
| | | /// <summary> |
| | | /// 夿³¨ |
| | |
| | | /// attri |
| | | /// </summary> |
| | | public List<FunctionAttributes> attributes = new List<FunctionAttributes>(); |
| | | /// <summary> |
| | | /// åè½ç¶æå表 |
| | | /// </summary> |
| | | public List<AttributesStatus> status = new List<AttributesStatus>(); |
| | | /// <summary> |
| | | /// è·åç¶æå¼ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public string GetStatusValus(string key) |
| | | { |
| | | var d = status.Find((obj) => obj.key == key); |
| | | if(d==null) |
| | | { |
| | | return null; |
| | | } |
| | | return d.value; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¿é´IDå表 |
| | |
| | | public void CollectFunction() |
| | | { |
| | | var result = ""; |
| | | //var waitPage = new Loading(); |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | |
| | | { |
| | | collect = !collect; |
| | | IMessageCommon.Current.ShowErrorInfoAlter(result); |
| | | }); |
| | | }else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | UI.HomePage.RefreshFunctionView(); |
| | | }); |
| | | } |
| | | }) |
| | |
| | | sendDataObj.time_stamp = Control.Ins.Get_TimeStamp(); |
| | | |
| | | |
| | | var acd = new AlinkControlData(); |
| | | var acd = new AlinkStatusData(); |
| | | acd.sid = sid; |
| | | foreach (var dic in commandDictionary) |
| | | { |
| | |
| | | /// </summary> |
| | | public class AlinkFunctionStatusObj |
| | | { |
| | | public List<AlinkControlData> objects = new List<AlinkControlData>(); |
| | | public List<AlinkStatusData> objects = new List<AlinkStatusData>(); |
| | | |
| | | public string time_stamp = ""; |
| | | public string id = ""; |
| | |
| | | public string time_stamp = ""; |
| | | } |
| | | /// <summary> |
| | | /// Aåè®®æ§å¶æ°æ® |
| | | /// Aåè®®ç¶ææ°æ® |
| | | /// </summary> |
| | | public class AlinkControlData |
| | | public class AlinkStatusData |
| | | { |
| | | /* |
| | | mqttæ¥æ¶çç¶ææ°æ®æ²¡ædeviceId |
| | | æ¥å£åé¦çæ°æ®æ |
| | | */ |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string sid = ""; |
| | | /// <summary> |
| | | /// 设å¤ID |
| | | /// äºç«¯è´è´£çæ |
| | | /// </summary> |
| | | public string deviceId = "0"; |
| | | public List<AttributesStatus> status = new List<AttributesStatus>(); |
| | | } |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public string data_type = ""; |
| | | /// <summary> |
| | | /// å½åç¶æ |
| | | /// </summary> |
| | | public string state = ""; |
| | | /// <summary> |
| | | /// å½åå¼ |
| | | /// </summary> |
| | | public object curValue = new object(); |
| | |
| | | /// </summary> |
| | | public const string Mode = "mode"; |
| | | /// <summary> |
| | | /// 工使¨¡å¼ |
| | | /// å°ç/å°å·/åçå°ç/åçå°å· |
| | | /// </summary> |
| | | public const string WorkMode = "mode_work"; |
| | | /// <summary> |
| | | /// é£é |
| | | /// </summary> |
| | | public const string FanSpeed = "fan"; |
| | |
| | | /// 设置温度 |
| | | /// </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> |
| | |
| | | /// æ¶æ¯å©ä½æ¶é´ |
| | | /// </summary> |
| | | public const string DisinfectTimeLeft = "disinfect_time_surplus"; |
| | | |
| | | /// <summary> |
| | | /// è´ç¦»å |
| | | /// </summary> |
| | | public const string Anion = "anion"; |
| | | /// <summary> |
| | | /// è´ç¦»åæ¶é´ |
| | | /// </summary> |
| | | public const string AnionTime = "anion_time"; |
| | | /// <summary> |
| | | /// è´ç¦»åå©ä½æ¶é´ |
| | | /// </summary> |
| | | public const string AnionTimeLeft = "anion_time_surplus"; |
| | | /// <summary> |
| | | /// æå¼ç»è®°(飿) |
| | | /// </summary> |
| | | public const string OpenLevel = "openLevel"; |
| | | |
| | | |
| | | #region tuya |
| | |
| | | /// åé¸ |
| | | /// </summary> |
| | | public const string ClothesHanger = "electrical.racks"; |
| | | /// <summary> |
| | | /// 红å¤å® |
| | | /// </summary> |
| | | public const string IrModule = "ir.module"; |
| | | /// <summary> |
| | | /// 红å¤ç©ºè° |
| | | /// </summary> |
| | | public const string IrAC = "ir.ac"; |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | namespace HDL_ON.Entity |
| | | { |
| | | public class Light : Function |
| | | public class Light |
| | | { |
| | | /* |
| | | ç¯å
ç±»ï¼trait: [switch,brightness,color,cct,delay,fadeTime]
|
| | | 屿§ æè¿°
|
| | | switch on/off;
|
| | | brightness 0-100;
|
| | | color int (red (0-255) green (0-255) blue (0-255))
|
| | | cct int (warm light(0-255) cold light (0-255) )
|
| | | delay 0-3600s
|
| | | fadetime 0-3600s |
| | | */ |
| | | public 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"); |
| | | //æ¾ä¸å°å±æ§éè¦å£°æä¸ä¸ªï¼é²æ¢æ¥ééªé |
| | | 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"); |
| | | //æ¾ä¸å°å±æ§éè¦å£°æä¸ä¸ªï¼é²æ¢æ¥ééªé |
| | | 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); |
| | | //æ¾ä¸å°å±æ§éè¦å£°æä¸ä¸ªï¼é²æ¢æ¥ééªé |
| | | 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); |
| | | //æ¾ä¸å°å±æ§éè¦å£°æä¸ä¸ªï¼é²æ¢æ¥ééªé |
| | | 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); |
| | | //æ¾ä¸å°å±æ§éè¦å£°æä¸ä¸ªï¼é²æ¢æ¥ééªé |
| | | 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; |
| | | |
| | |
| | | /// è·å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 |
| | | } |
| | | } |
| | |
| | | ///// <summary> |
| | | ///// åºæ¯èæ¯ |
| | | ///// </summary> |
| | | //public string ImagePath = "Intelligence/Gallery/scenebg1.png";//"FunctionIcon/Scene/s1.png"; |
| | | |
| | | ///// <summary> |
| | | ///// åºæ¯èæ¯ |
| | | ///// </summary> |
| | | public string ImagePath |
| | | { |
| | | get |
| | |
| | | return revPack.Code; |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// ä¸ä¼ æ°æ®å°äºç«¯ |
| | | /// å»¶æ¶æ¾ç¤ºçææ¬ |
| | | /// </summary> |
| | | void UploadScene() |
| | | public string GetDelayText() |
| | | { |
| | | var pm = new HttpServerRequest(); |
| | | ResponsePackNew revPack; |
| | | if (string.IsNullOrEmpty(createTime) && string.IsNullOrEmpty(modifyTime)) |
| | | string text = ""; |
| | | switch (delay) |
| | | { |
| | | revPack = pm.AddScene(this); |
| | | if (revPack.Code == StateCode.SUCCESS) |
| | | { |
| | | var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); |
| | | Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); |
| | | } |
| | | case "0": |
| | | text = Language.StringByID(StringId.NoDelay); |
| | | break; |
| | | case "30": |
| | | text = "30s"; |
| | | break; |
| | | case "60": |
| | | text = "1min"; |
| | | break; |
| | | case "120": |
| | | text = "2min"; |
| | | break; |
| | | case "300": |
| | | text = "5min"; |
| | | break; |
| | | } |
| | | else if (!string.IsNullOrEmpty(createTime) && !string.IsNullOrEmpty(modifyTime)) |
| | | { |
| | | revPack = pm.EditScene(this); |
| | | if (revPack.Code == StateCode.SUCCESS) |
| | | { |
| | | var scenes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(revPack.Data.ToString()); |
| | | var tempScene = scenes.Find((obj) => obj.sid == sid); |
| | | if (tempScene != null) |
| | | { |
| | | var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(tempScene)); |
| | | Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); |
| | | } |
| | | } |
| | | } |
| | | return text; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// äºç«¯æ°æ®åå»ºçæ¶é´ |
| | | /// </summary> |
| | |
| | | { |
| | | public string key = ""; |
| | | public string value = ""; |
| | | |
| | | /// <summary> |
| | | /// 屿§åç§°æ¾ç¤ºææ¬ |
| | | /// ä¸è±ææ¾ç¤º |
| | | /// </summary> |
| | | public string GetNameText() |
| | | { |
| | | string text = ""; |
| | | switch (key) |
| | | { |
| | | case FunctionAttributeKey.OnOff: |
| | | text = Language.StringByID(StringId.OnOff); |
| | | break; |
| | | case FunctionAttributeKey.Brightness: |
| | | text = Language.StringByID(StringId.Brightness); |
| | | break; |
| | | case FunctionAttributeKey.RGB: |
| | | text = Language.StringByID(StringId.ColorValue); |
| | | break; |
| | | case FunctionAttributeKey.Mode: |
| | | text = Language.StringByID(StringId.Mode); |
| | | break; |
| | | case FunctionAttributeKey.FanSpeed: |
| | | text = Language.StringByID(StringId.FanSpeed); |
| | | break; |
| | | case FunctionAttributeKey.SetTemp: |
| | | text = Language.StringByID(StringId.Temp); |
| | | break; |
| | | case FunctionAttributeKey.IndoorTemp: |
| | | text = Language.StringByID(StringId.IndoorTemp); |
| | | break; |
| | | case FunctionAttributeKey.Delay: |
| | | text = Language.StringByID(StringId.Delay); |
| | | break; |
| | | case FunctionAttributeKey.CCT: |
| | | text = "CCT"; |
| | | break; |
| | | case FunctionAttributeKey.Percent: |
| | | text = Language.StringByID(StringId.PercentAdjustment); |
| | | break; |
| | | case FunctionAttributeKey.FadeTime: |
| | | text = Language.StringByID(StringId.FadeSpeed); |
| | | break; |
| | | } |
| | | return text; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 屿§å¼åä½ |
| | | /// </summary> |
| | | public string GetUintString() |
| | | { |
| | | var us = ""; |
| | | switch (key) |
| | | { |
| | | case FunctionAttributeKey.SetTemp: |
| | | case FunctionAttributeKey.IndoorTemp: |
| | | us = "°C"; |
| | | break; |
| | | case FunctionAttributeKey.Percent: |
| | | case FunctionAttributeKey.Brightness: |
| | | us = "%"; |
| | | break; |
| | | } |
| | | return us; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// è·åæå®å±æ§çæ¾ç¤ºææ¬ |
| | | /// ä¸è±ææ¾ç¤º |
| | | /// </summary> |
| | | public string GetValueText() |
| | | { |
| | | string text = ""; |
| | | switch (key) |
| | | { |
| | | case FunctionAttributeKey.OnOff: |
| | | text = value == "on" ? Language.StringByID(StringId.On) : Language.StringByID(StringId.OFF); |
| | | break; |
| | | case FunctionAttributeKey.SetTemp: |
| | | case FunctionAttributeKey.IndoorTemp: |
| | | case FunctionAttributeKey.Brightness: |
| | | case FunctionAttributeKey.Percent: |
| | | if (value == "") |
| | | { |
| | | value = "0"; |
| | | } |
| | | text = value; |
| | | break; |
| | | case FunctionAttributeKey.Mode: |
| | | switch (value) |
| | | { |
| | | //----ç©ºè° |
| | | case "auto": |
| | | text = Language.StringByID(StringId.Auto); |
| | | break; |
| | | case "cool": |
| | | text = Language.StringByID(StringId.Cool); |
| | | break; |
| | | case "heat": |
| | | text = Language.StringByID(StringId.Heat); |
| | | break; |
| | | case "dry": |
| | | text = Language.StringByID(StringId.Dry); |
| | | break; |
| | | case "fan": |
| | | text = Language.StringByID(StringId.AirSupply); |
| | | break; |
| | | //-----å°ç |
| | | case "day": |
| | | text = Language.StringByID(StringId.Day); |
| | | break; |
| | | case "night": |
| | | text = Language.StringByID(StringId.Night); |
| | | break; |
| | | case "away": |
| | | text = Language.StringByID(StringId.Away); |
| | | break; |
| | | case "normal": |
| | | text = Language.StringByID(StringId.Normal); |
| | | break; |
| | | case "timer": |
| | | text = Language.StringByID(StringId.Timer); |
| | | break; |
| | | } |
| | | break; |
| | | case FunctionAttributeKey.FanSpeed: |
| | | switch (value) |
| | | { |
| | | case "high": |
| | | text = Language.StringByID(StringId.HighWindSpeed); |
| | | break; |
| | | case "medium": |
| | | text = Language.StringByID(StringId.MiddleWindSpeed); |
| | | break; |
| | | case "low": |
| | | text = Language.StringByID(StringId.LowWindSpeed); |
| | | break; |
| | | case "auto": |
| | | text = Language.StringByID(StringId.Auto); |
| | | break; |
| | | default: |
| | | text = "low"; |
| | | break; |
| | | } |
| | | break; |
| | | case "high": |
| | | text = Language.StringByID(StringId.HighWindSpeed); |
| | | break; |
| | | case "medium": |
| | | text = Language.StringByID(StringId.MiddleWindSpeed); |
| | | break; |
| | | case "low": |
| | | text = Language.StringByID(StringId.LowWindSpeed); |
| | | break; |
| | | case "auto": |
| | | text = Language.StringByID(StringId.Auto); |
| | | break; |
| | | } |
| | | return text; |
| | | } |
| | | |
| | | |
| | | } |
| | | /// <summary> |
| | | /// åºæ¯æ¨éé
ç½® |
| | |
| | | |
| | | 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); |
| | | //æ¾ä¸å°å±æ§éè¦å£°æä¸ä¸ªï¼é²æ¢æ¥ééªé |
| | | 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); |
| | | //æ¾ä¸å°å±æ§éè¦å£°æä¸ä¸ªï¼é²æ¢æ¥ééªé |
| | | 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; |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | using System; |
| | | namespace HDL_ON.Entity |
| | | { |
| | | public class SwitchSocket : Function |
| | | public class SwitchSocket |
| | | { |
| | | public SwitchSocket() |
| | | { |
| | |
| | | |
| | | 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); |
| | |
| | | { |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | |
| | | using System;
|
| | | namespace HDL_ON.Entity
|
| | | {
|
| | | public class WeepRobot : Function
|
| | | public class WeepRobot |
| | | {
|
| | | public WeepRobot()
|
| | | {
|
| | |
| | | { |
| | | get |
| | | { |
| | | if(_FunctionList == null) |
| | | if (_FunctionList == null) |
| | | { |
| | | _FunctionList = new FunctionList(); |
| | | #region æ¢å¤æ°æ® |
| | | var filePathList = Common.FileUtlis.Files.ReadFiles(); |
| | | var filePathList = FileUtlis.Files.ReadFiles(); |
| | | foreach (var filePath in filePathList) |
| | | { |
| | | _FunctionList.IniFunctionList(filePath); |
| | |
| | | return _FunctionList; |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// åè½å表 |
| | | /// </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> 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> |
| | | //public List<Scene> Scenes |
| | | //{ |
| | | // get |
| | | // { |
| | | // List.scenes = List.scenes.OrderByDescending(o => o.createTime).ToList(); |
| | | // return List.scenes; |
| | | // } |
| | | //} |
| | | /// <summary> |
| | | /// åè½å表 |
| | | /// </summary> |
| | | List<Function> deviceFunctionList = new List<Function>(); |
| | | |
| | | |
| | | /// <summary> |
| | | /// å è½½åè½å表 |
| | | /// todo éè¦ä¼åï¼åæä¸è½ä¿è¯è½ä½¿ç¨sidè§£æåºæ¯ä»ä¹ç±»åçè®¾å¤ |
| | | /// </summary> |
| | | /// <param name="filePath"></param> |
| | | public void IniFunctionList(string filePath) |
| | |
| | | // 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) |
| | |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | |
| | | Functions.Add(tempFunction); |
| | | |
| | | } |
| | | if (filePath.StartsWith("SceneData_")) |
| | | { |
| | |
| | | /// </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) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | |
| | | break; |
| | | |
| | | case SPK.BrandType.Tuya: |
| | | foreach (var function in deviceFunctionList) |
| | | foreach (var function in Functions) |
| | | { |
| | | if (SPK.Get3tySpk(SPK.BrandType.Tuya).Contains(function.spk)) |
| | | { |
| | |
| | | return resultFunctions; |
| | | } |
| | | |
| | | return deviceFunctionList; |
| | | return Functions; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </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; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¥æ¶bus软件ä¸ä¼ çåè½ |
| | | /// tcpæ¹å¼ |
| | | /// </summary> |
| | | /// <param name="sidObj"></param> |
| | | public void AddDeviceFunction(Function sidObj0) |
| | | { |
| | | switch (sidObj0.spk) |
| | | { |
| | | case SPK.AcStandard: |
| | | var sidObj = Newtonsoft.Json.JsonConvert.DeserializeObject<AC>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0)); |
| | | List.aCs.Add(sidObj); |
| | | sidObj.SaveFunctionFile(); |
| | | break; |
| | | case SPK.FloorHeatStandard: |
| | | var sidObj1 = Newtonsoft.Json.JsonConvert.DeserializeObject<FloorHeating>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0)); |
| | | List.floorHeatings.Add(sidObj1); |
| | | sidObj1.SaveFunctionFile(); |
| | | break; |
| | | case SPK.LightDimming: |
| | | case SPK.LightRGB: |
| | | case SPK.LightSwitch: |
| | | var sidObj2 = Newtonsoft.Json.JsonConvert.DeserializeObject<Light>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0)); |
| | | List.lights.Add(sidObj2); |
| | | sidObj2.SaveFunctionFile(); |
| | | break; |
| | | case SPK.CurtainSwitch: |
| | | case SPK.CurtainRoller: |
| | | case SPK.CurtainTrietex: |
| | | var sidObj3 = Newtonsoft.Json.JsonConvert.DeserializeObject<Curtain>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0)); |
| | | List.curtains.Add(sidObj3 ); |
| | | sidObj3.SaveFunctionFile(); |
| | | break; |
| | | case SPK.ElectricTV: |
| | | var sidObj4 = Newtonsoft.Json.JsonConvert.DeserializeObject<TV>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0)); |
| | | List.tVs.Add(sidObj4); |
| | | sidObj4.SaveFunctionFile(); |
| | | break; |
| | | case SPK.ElectricSocket: |
| | | var sidObj5 = Newtonsoft.Json.JsonConvert.DeserializeObject<SwitchSocket>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0)); |
| | | List.switchSockets.Add(sidObj5); |
| | | sidObj5.SaveFunctionFile(); |
| | | break; |
| | | case SPK.ElectricFan: |
| | | var sidObj6 = Newtonsoft.Json.JsonConvert.DeserializeObject<Fan>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0)); |
| | | List.fans.Add(sidObj6); |
| | | sidObj6.SaveFunctionFile(); |
| | | break; |
| | | case SPK.SensorCO2: |
| | | case SPK.SensorTVOC: |
| | | case SPK.SensorPm25: |
| | | case SPK.SensorTemperature: |
| | | case SPK.SensorHumidity: |
| | | var sidObj7 = Newtonsoft.Json.JsonConvert.DeserializeObject<Sensor>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0)); |
| | | List.sensorsEnvironmentalScience.Add(sidObj7); |
| | | sidObj7.SaveFunctionFile(); |
| | | break; |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// æ¥æ¶bus软件ä¸ä¼ çåè½ |
| | | /// http udp |
| | | /// </summary> |
| | | /// <param name="obj"></param> |
| | | public void AddFunction(object obj) |
| | | { |
| | | var f = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(obj.ToString()); |
| | | if (f == null) |
| | | return; |
| | | switch (f.Spk_Prefix) |
| | | { |
| | | case FunctionCategory.AC: |
| | | switch (f.spk) |
| | | { |
| | | case SPK.AcStandard: |
| | | List.aCs.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<AC>(obj.ToString())); |
| | | break; |
| | | } |
| | | break; |
| | | case FunctionCategory.FloorHeat: |
| | | switch (f.spk) |
| | | { |
| | | case SPK.FloorHeatStandard: |
| | | List.floorHeatings.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<FloorHeating>(obj.ToString())); |
| | | break; |
| | | } |
| | | break; |
| | | case FunctionCategory.Light: |
| | | List.lights.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<Light>(obj.ToString())); |
| | | break; |
| | | case FunctionCategory.Curtain: |
| | | List.curtains.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<Curtain>(obj.ToString())); |
| | | break; |
| | | case FunctionCategory.Electric: |
| | | switch(f.spk) |
| | | { |
| | | case SPK.ElectricTV: |
| | | List.electricals.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<TV>(obj.ToString())); |
| | | break; |
| | | case SPK.ElectricSocket: |
| | | List.electricals.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<SwitchSocket>(obj.ToString())); |
| | | break; |
| | | case SPK.ElectricFan: |
| | | List.electricals.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<Fan>(obj.ToString())); |
| | | break; |
| | | } |
| | | break; |
| | | case FunctionCategory.Sensor: |
| | | switch (f.spk) |
| | | { |
| | | case SPK.SensorTVOC: |
| | | case SPK.SensorCO2: |
| | | case SPK.SensorPm25: |
| | | case SPK.SensorHumidity: |
| | | case SPK.SensorTemperature: |
| | | List.sensorsEnvironmentalScience.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<Sensor>(obj.ToString())); |
| | | break; |
| | | case SPK.SensorWater: |
| | | case SPK.SensorSmoke: |
| | | case SPK.SensorGas: |
| | | case SPK.SensorDryContact: |
| | | case SPK.SensorShanLan: |
| | | case SPK.SensorDuiShe: |
| | | case SPK.SensorPir: |
| | | case SPK.SensorDoorWindow: |
| | | case SPK.SensoruUtrasonic: |
| | | List.sensorsArm.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<Sensor>(obj.ToString())); |
| | | break; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </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; |
| | |
| | | #endregion |
| | | |
| | | |
| | | #region åè½ææ¬ç¸å
³ |
| | | /// <summary> |
| | | /// 屿§åç§°æ¾ç¤ºææ¬ |
| | | /// ä¸è±ææ¾ç¤º |
| | | /// </summary> |
| | | public string GetNameText(string key) |
| | | { |
| | | string text = ""; |
| | | switch (key) |
| | | { |
| | | case FunctionAttributeKey.OnOff: |
| | | text = Language.StringByID(StringId.OnOff); |
| | | break; |
| | | case FunctionAttributeKey.Brightness: |
| | | text = Language.StringByID(StringId.Brightness); |
| | | break; |
| | | case FunctionAttributeKey.RGB: |
| | | text = Language.StringByID(StringId.ColorValue); |
| | | break; |
| | | case FunctionAttributeKey.Mode: |
| | | text = Language.StringByID(StringId.Mode); |
| | | break; |
| | | case FunctionAttributeKey.FanSpeed: |
| | | text = Language.StringByID(StringId.FanSpeed); |
| | | break; |
| | | case FunctionAttributeKey.SetTemp: |
| | | text = Language.StringByID(StringId.Temp); |
| | | break; |
| | | case FunctionAttributeKey.IndoorTemp: |
| | | text = Language.StringByID(StringId.IndoorTemp); |
| | | break; |
| | | case FunctionAttributeKey.Delay: |
| | | text = Language.StringByID(StringId.Delay); |
| | | break; |
| | | case FunctionAttributeKey.CCT: |
| | | text = "CCT"; |
| | | break; |
| | | case FunctionAttributeKey.Percent: |
| | | text = Language.StringByID(StringId.PercentAdjustment); |
| | | break; |
| | | case FunctionAttributeKey.FadeTime: |
| | | text = Language.StringByID(StringId.FadeSpeed); |
| | | break; |
| | | } |
| | | return text; |
| | | } |
| | | #region |
| | | |
| | | |
| | | /// <summary> |
| | | /// 屿§å¼åä½ |
| | | /// </summary> |
| | | public string GetUintString(string key) |
| | | { |
| | | var us = ""; |
| | | switch (key) |
| | | { |
| | | case FunctionAttributeKey.SetTemp: |
| | | case FunctionAttributeKey.IndoorTemp: |
| | | us = "°C"; |
| | | break; |
| | | case FunctionAttributeKey.Percent: |
| | | case FunctionAttributeKey.Brightness: |
| | | us = "%"; |
| | | break; |
| | | } |
| | | return us; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åæå®å±æ§çæ¾ç¤ºææ¬ |
| | | /// ä¸è±ææ¾ç¤º |
| | | /// </summary> |
| | | public string GetValueText(string key, string value) |
| | | { |
| | | string text = ""; |
| | | switch (key) |
| | | { |
| | | case FunctionAttributeKey.OnOff: |
| | | text = value == "on" ? Language.StringByID(StringId.On) : Language.StringByID(StringId.OFF); |
| | | break; |
| | | case FunctionAttributeKey.SetTemp: |
| | | case FunctionAttributeKey.IndoorTemp: |
| | | case FunctionAttributeKey.Brightness: |
| | | case FunctionAttributeKey.Percent: |
| | | if (value == "") |
| | | { |
| | | value = "0"; |
| | | } |
| | | text = value; |
| | | break; |
| | | case FunctionAttributeKey.Mode: |
| | | switch (value) |
| | | { |
| | | //----ç©ºè° |
| | | case "auto": |
| | | text = Language.StringByID(StringId.Auto); |
| | | break; |
| | | case "cool": |
| | | text = Language.StringByID(StringId.Cool); |
| | | break; |
| | | case "heat": |
| | | text = Language.StringByID(StringId.Heat); |
| | | break; |
| | | case "dry": |
| | | text = Language.StringByID(StringId.Dry); |
| | | break; |
| | | case "fan": |
| | | text = Language.StringByID(StringId.AirSupply); |
| | | break; |
| | | //-----å°ç |
| | | case "day": |
| | | text = Language.StringByID(StringId.Day); |
| | | break; |
| | | case "night": |
| | | text = Language.StringByID(StringId.Night); |
| | | break; |
| | | case "away": |
| | | text = Language.StringByID(StringId.Away); |
| | | break; |
| | | case "normal": |
| | | text = Language.StringByID(StringId.Normal); |
| | | break; |
| | | case "timer": |
| | | text = Language.StringByID(StringId.Timer); |
| | | break; |
| | | } |
| | | break; |
| | | case FunctionAttributeKey.FanSpeed: |
| | | switch (value) |
| | | { |
| | | case "high": |
| | | text = Language.StringByID(StringId.HighWindSpeed); |
| | | break; |
| | | case "medium": |
| | | text = Language.StringByID(StringId.MiddleWindSpeed); |
| | | break; |
| | | case "low": |
| | | text = Language.StringByID(StringId.LowWindSpeed); |
| | | break; |
| | | case "auto": |
| | | text = Language.StringByID(StringId.Auto); |
| | | break; |
| | | default: |
| | | text = "low"; |
| | | break; |
| | | } |
| | | break; |
| | | case "high": |
| | | text = Language.StringByID(StringId.HighWindSpeed); |
| | | break; |
| | | case "medium": |
| | | text = Language.StringByID(StringId.MiddleWindSpeed); |
| | | break; |
| | | case "low": |
| | | text = Language.StringByID(StringId.LowWindSpeed); |
| | | break; |
| | | case "auto": |
| | | text = Language.StringByID(StringId.Auto); |
| | | break; |
| | | } |
| | | return text; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// å»¶æ¶æ¾ç¤ºçææ¬ |
| | | /// </summary> |
| | | public string GetDelayText(string delay) |
| | | { |
| | | string text = ""; |
| | | switch (delay) |
| | | { |
| | | case "0": |
| | | text = Language.StringByID(StringId.NoDelay); |
| | | break; |
| | | case "30": |
| | | text = "30s"; |
| | | break; |
| | | case "60": |
| | | text = "1min"; |
| | | break; |
| | | case "120": |
| | | text = "2min"; |
| | | break; |
| | | case "300": |
| | | text = "5min"; |
| | | break; |
| | | } |
| | | return text; |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | |
| | | { |
| | | 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(); |
| | |
| | | //æ¥¼å±æ¿é´å表 |
| | | if (floorUpdateList != null && floorUpdateList.Count > 0) |
| | | { |
| | | FloorList.Clear(); |
| | | foreach (var updateTemp in floorUpdateList) |
| | | { |
| | | FloorList.Add(updateTemp); |
| | |
| | | /// </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; |
| | | } |
| | |
| | | <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" />
|
| | |
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\Method.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\FailView.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\ReplicationView.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Electrical\ClothesHangerSetTimePage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmSensor\ArmSensorHistroyPaging.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\AC\AcControlPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\Matching.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\PirNameView.cs" />
|
| | | </ItemGroup>
|
| | |
| | | /// <summary> |
| | | /// çæ¬å· |
| | | /// </summary> |
| | | public static string VersionString = "1.1.0225"; |
| | | public static string VersionString = "1.1.0305"; |
| | | ///// <summary> |
| | | ///// 客æ·ç«¯ç±»å |
| | | ///// </summary> |
| | |
| | | /// <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) => |
| | | { |
| | |
| | | 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.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; |
| | | 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; |
| | |
| | | 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; |
| | |
| | | var clothesHangerpage = new ClothesHangerPage(); |
| | | clothesHangerpage.AddForm(function, btnCollectionIcon, btnName, btnFromFloor); |
| | | break; |
| | | case SPK.IrAC: |
| | | case SPK.AcStandard: |
| | | var acPage = new AcControlPage(); |
| | | acPage.AddForm(function, btnCollectionIcon, btnName, btnFromFloor); |
| | | break; |
| | | } |
| | | }; |
| | | return eventHandler; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | //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(); |
| | | } |
| | | |
| | | } |
old mode 100755
new mode 100644
| | |
| | |
|
| | | var dialogBody = new NormalFrameLayout();
|
| | | FrameDialog.AddChidren(dialogBody);
|
| | | FrameDialog.Show();
|
| | | dialogBody.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | if (ClickBackClose == true && this.btnCancel != null)
|
| | |
| | | //ç½è²èæ¯
|
| | | var frameWhiteBack = new NormalFrameLayout();
|
| | | frameWhiteBack.Width = Application.GetRealWidth(343);
|
| | | frameWhiteBack.Height = RowHeight * (RowCount + 1);
|
| | | frameWhiteBack.Height = RowHeight * (RowCount + 1);
|
| | | frameWhiteBack.Radius = (uint)Application.GetRealWidth(12);
|
| | | frameWhiteBack.Gravity = Gravity.CenterHorizontal;
|
| | | frameWhiteBack.Y = dialogBody.Height - RowHeight * (RowCount + 1) - Application.GetRealHeight(20);
|
| | |
| | | btnConfirm.TextSize = CSS_FontSize.TextFontSize;
|
| | | frameWhiteBack.AddChidren(btnConfirm);
|
| | |
|
| | | FrameDialog.Show();
|
| | |
|
| | | return frameWhiteBack;
|
| | | }
|
| | |
|
| | |
| | | /// ç»æäºä»¶(0:ç¹å»äºåæ¶ 1:ç¹å»äºç¡®å®,第äº,ä¸åæ°ä¸ºæ¶åå)
|
| | | /// </summary>
|
| | | public Action<int, int, int> FinishEvent = null;
|
| | | /// <summary> |
| | | /// å°æ¶åå¼èå´ |
| | | /// </summary>
|
| | | List<int> hRange = new List<int>();
|
| | | /// <summary> |
| | | /// åéåå¼èå´ |
| | | /// </summary>
|
| | | List<int> mRange = new List<int>(); |
| | | /// <summary> |
| | | /// æ¶é´æ§ä»¶ |
| | | /// </summary> |
| | | UIPickerView pickerView; |
| | | //éæ©çæ¶ä¸å |
| | | int selectHour = 0; |
| | | int selectMinute = 0; |
| | | //XXæ¶ |
| | | List<string> listHour ; |
| | | //XXå |
| | | List<string> listMinute;
|
| | |
|
| | |
|
| | | #endregion
|
| | |
|
| | |
| | | public BottomTimeSelectControl(string i_title = "", bool clickBackClose = true)
|
| | | {
|
| | | base.ClickBackClose = clickBackClose;
|
| | | base.StrTitle = i_title; |
| | | |
| | | |
| | | for (int i = 0; i <= 23; i++)
|
| | | {
|
| | | hRange.Add(i);
|
| | | }
|
| | | for (int i = 0; i <= 59; i++)
|
| | | {
|
| | | mRange.Add(i);
|
| | | }
|
| | | } |
| | | |
| | | |
| | | /// <summary>
|
| | | /// åºé¨æ¶é´éæ©æ§ä»¶
|
| | | /// </summary>
|
| | | /// <param name="i_title">æ é¢</param>
|
| | | /// <param name="clickBackClose">ç¹å»èæ¯æ¶,æ¯å¦å
³éå¼¹çª</param>
|
| | | public BottomTimeSelectControl(List<int> hoursRange,List<int> minuteRange ,int rowCount, string i_title = "", bool clickBackClose = true)
|
| | | {
|
| | | base.ClickBackClose = clickBackClose;
|
| | | base.StrTitle = i_title;
|
| | |
|
| | | hRange = hoursRange; |
| | | mRange = minuteRange; |
| | | |
| | | base.RowCount = rowCount; |
| | |
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | /// </summary>
|
| | | /// <param name="i_hour">é»è®¤éæ©æ¶</param>
|
| | | /// <param name="i_minute">é»è®¤éæ©å</param>
|
| | | public void InitControl(int i_hour, int i_minute)
|
| | | /// <param name="contentView">éæ©åºåé«åº¦</param>
|
| | | public void InitControl(int i_hour, int i_minute,int contentView = 297)
|
| | | {
|
| | | //å·²ç»åå§å
|
| | | if (base.btnCancel != null) { return; }
|
| | |
|
| | | //åå§ååºå±æ§ä»¶
|
| | | var frameWhiteBack = base.InitBaseControl();
|
| | | frameWhiteBack.Height = Application.GetRealHeight(297);
|
| | | frameWhiteBack.Y = frameWhiteBack.Parent.Height - Application.GetRealHeight(297 + 20);
|
| | |
|
| | | //éæ©çæ¶ä¸å
|
| | | int selectHour = 0;
|
| | | int selectMinute = 0;
|
| | | frameWhiteBack.Height = Application.GetRealHeight(contentView);
|
| | | //frameWhiteBack.Y = frameWhiteBack.Parent.Height - Application.GetRealHeight(297 + 20);
|
| | |
|
| | | //åæ¶
|
| | | base.btnCancel.ButtonClickEvent += (sender, e) =>
|
| | |
| | | frameWhiteBack.AddChidren(btnLine);
|
| | |
|
| | | //æ¶é´æ§ä»¶
|
| | | var pickerView = new UIPickerView();
|
| | | pickerView = new UIPickerView();
|
| | | //æ¶
|
| | | var strhour = Language.StringByID(StringId.h);
|
| | | //å
|
| | | var strMinute = Language.StringByID(StringId.m);
|
| | | //XXæ¶
|
| | | var listHour = new List<string> { "00" + strhour };
|
| | | listHour = new List<string>();// { "00" + strhour };
|
| | | //XXå
|
| | | var listMinute = new List<string> { "00" + strMinute };
|
| | | for (int i = 1; i <= 23; i++)
|
| | | listMinute = new List<string>();// { "00" + strMinute }; |
| | | //for (int i = 1; i <= 23; i++) |
| | | foreach(var hItem in hRange) |
| | | {
|
| | | listHour.Add(i.ToString().PadLeft(2, '0') + strhour);
|
| | | }
|
| | | for (int i = 1; i <= 59; i++)
|
| | | listHour.Add(hItem.ToString().PadLeft(2, '0') + strhour);
|
| | | } |
| | | //for (int i = 1; i <= 59; i++) |
| | | foreach (var mItem in mRange) |
| | | {
|
| | | listMinute.Add(i.ToString().PadLeft(2, '0') + strMinute);
|
| | | listMinute.Add(mItem.ToString().PadLeft(2, '0') + strMinute);
|
| | | }
|
| | | pickerView.Height = frameWhiteBack.Height - btnLine.Bottom;
|
| | | pickerView.Width = frameWhiteBack.Width - Application.GetRealWidth(8) * 2;
|
| | |
| | | };
|
| | | }
|
| | |
|
| | | /// <summary> |
| | | /// ç¹æ®çéåéæ©äºä»¶ï¼å鏿¶é´è®¾ç½®ä½¿ç¨ |
| | | /// </summary>
|
| | | public void ChangePickerEvent() |
| | | { |
| | | pickerView.OnSelectChangeEvent = (value1, value2, value3) =>
|
| | | { |
| | | if (value1 == 0 && value2 == 0) |
| | | { |
| | | value2 = 1; |
| | | pickerView.setCurrentItems(value1, value2, 0); |
| | | } |
| | | else if (value1 == 4 && value2 == 1) |
| | | { |
| | | value2 = 0; |
| | | pickerView.setCurrentItems(value1, value2, 0); |
| | | } |
| | | else |
| | | { |
| | | //æ´æ¹ç´¢å¼ |
| | | selectHour = Convert.ToInt32(listHour[value1].Substring(0, 2)); |
| | | selectMinute = Convert.ToInt32(listMinute[value2].Substring(0, 2)); |
| | | }
|
| | | }; |
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region â ä¸è¬æ¹æ³___________________________
|
old mode 100755
new mode 100644
| | |
| | | {
|
| | | foreach (var attr in updateData)
|
| | | { |
| | | var localAttr2 = localDevice.attributes.Find((obj) => obj.key == attr.key); |
| | | if (localAttr2 == null) |
| | | { |
| | | //æ¬èº«å®å°±æ²¡æè¿ä¸ªå±æ§,åä¸å¤ç |
| | | continue; |
| | | } |
| | | //æ´æ¹å±æ§å¼ |
| | | localAttr2.curValue = attr.value; |
| | | //var localAttr2 = localDevice.attributes.Find((obj) => obj.key == attr.key); |
| | | //if (localAttr2 == null) |
| | | //{ |
| | | // //æ¬èº«å®å°±æ²¡æè¿ä¸ªå±æ§,åä¸å¤ç |
| | | // continue; |
| | | //} |
| | | ////æ´æ¹å±æ§å¼ |
| | | //localAttr2.curValue = attr.value; |
| | | |
| | | var localAttr = localDevice.status.Find((obj) => obj.key == attr.key); |
| | | if (localAttr == null) |
| | | { |
| | | //statusæ¯å½å设å¤ä¸æ¥è¿ç屿§æä¼åå¨,ä¹å°±æ¯å®çä¸ªæ°æå¯è½åattributesä¸ä¸è´ |
| | | localAttr = new AttributesStatus() { key = attr.key, value = attr.value }; |
| | | localDevice.status.Add(localAttr); |
| | | } |
| | | //æ´æ¹å±æ§å¼ |
| | | localAttr.value = attr.value;
|
| | | //var localAttr = localDevice.status.Find((obj) => obj.key == attr.key); |
| | | //if (localAttr == null) |
| | | //{ |
| | | // //statusæ¯å½å设å¤ä¸æ¥è¿ç屿§æä¼åå¨,ä¹å°±æ¯å®çä¸ªæ°æå¯è½åattributesä¸ä¸è´ |
| | | // localAttr = new AttributesStatus() { key = attr.key, value = attr.value }; |
| | | // localDevice.status.Add(localAttr); |
| | | //} |
| | | ////æ´æ¹å±æ§å¼ |
| | | //localAttr.value = attr.value;
|
| | |
|
| | | localDevice.SetAttrState(attr.key, attr.value); |
| | |
|
| | | }
|
| | | //å
¨é¨ç颿¨é
|
| | | HdlFormLogic.Current.DeviceStatuPush(localDevice);
|
| | |
| | | //return; |
| | | if (b) |
| | | { |
| | | etAccount.Text = "13415629083";// "13415629083"//cf;//tujie"18316120654";// "15622703419";// "18824864143";//"464027401@qq.com"; //"2791308028@qq.com";//13697499568 |
| | | etAccount.Text = "18316672920";//"18316120654";//lcg "18316672920";//hzx;// "13415629083"//cf;//tujie"18316120654"; |
| | | // "15622703419"lwn;// "18824864143";//"464027401@qq.com"; //"2791308028@qq.com";//13697499568 |
| | | } |
| | | else |
| | | { |
| | | etAccount.Text = "18666455392";//13375012446//13602944661//tzy 18778381374 |
| | | etAccount.Text = "15971583093";//åé¸"18666455392";//13375012446//13602944661//tzy 18778381374 |
| | | //15971583093 gs |
| | | } |
| | | b = !b; |
| | | etPassword.Text = "123456"; |
| | |
| | | /// </summary> |
| | | void LoadDeviceFunctionControlZone() |
| | | { |
| | | |
| | | #region ContextView |
| | | deviceFunctionView.RemoveAll(); |
| | | functionViews.Clear(); |
| | |
| | | }; |
| | | view.AddChidren(btnCurtainOpen); |
| | | |
| | | LoadEvent_ControlCurtain(function as Curtain, btnCurtainClose, btnCurtainOpen); |
| | | LoadEvent_ControlCurtain(function, btnCurtainClose, btnCurtainOpen); |
| | | } |
| | | |
| | | else if (function.spk == SPK.ElectricTV) |
| | |
| | | UnSelectedImagePath = "Public/PowerClose.png", |
| | | }; |
| | | view.AddChidren(btnPower); |
| | | LoadEvent_ControlTV(function as TV, btnPower); |
| | | LoadEvent_ControlTV(function, btnPower); |
| | | } |
| | | |
| | | else if (function.spk == SPK.MusicStandard) |
| | |
| | | #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: |
| | |
| | | function.CollectFunction(); |
| | | }; |
| | | |
| | | |
| | | var skipControlPageEvent = new PublicAssmebly().LoadEvent_SkipFunctionControlPage(function, btnCollection, btnName, btnZone); |
| | | view.MouseUpEventHandler = skipControlPageEvent; |
| | | btnName.MouseUpEventHandler = skipControlPageEvent; |
| | |
| | | bodyView.btnPm25Values.Text = MainPage.cityInfo.pm25 == null ? "--" : MainPage.cityInfo.pm25; |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// æ´æ°åè½å表主页 |
| | | /// </summary> |
| | | public static void RefreshFunctionView() |
| | | { |
| | | if (bodyView != null) |
| | | { |
| | | bodyView.LoadDeviceFunctionControlZone(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°è¿æ¥ç¶æå¾æ |
| | |
| | | /// </summary> |
| | | public static void UpdataFunctionStates(Function function) |
| | | { |
| | | Application.RunOnMainThread((Action)(() => |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | try |
| | | { |
| | |
| | | { |
| | | if (view.Tag.ToString() == function.sid) |
| | | { |
| | | var state = function.trait_on_off.curValue.ToString() == "on"; |
| | | var state = false; |
| | | if (function.spk == SPK.CurtainRoller || function.spk == SPK.CurtainShades || function.spk == SPK.CurtainTrietex || |
| | | function.spk == SPK.CurtainSwitch)//çªå¸è®¾å¤æ ¹æ®ç¾åæ¯å¤æå¼å
³ç¶æ |
| | | { |
| | | state = function.GetAttrState(FunctionAttributeKey.Percent) != "0"; |
| | | } |
| | | else |
| | | { |
| | | state = function.trait_on_off.curValue.ToString() == "on"; |
| | | } |
| | | for (int i = 0; i < view.ChildrenCount; i++) |
| | | { |
| | | if (view.GetChildren(i).GetType() == typeof(Button)) |
| | |
| | | { |
| | | MainPage.Log($"HomePage updata funciton states error {ex.Message}"); |
| | | } |
| | | })); |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | 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 |
| | | { |
| | |
| | | /// </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.MouseDownEventHandler = (sender, e) => |
| | | { |
| | | btnClose.IsSelected = true; |
| | | }; |
| | | btnClose.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnClose.IsSelected = false; |
| | | 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); |
| | | }; |
| | | |
| | | btnOpen.MouseDownEventHandler = (sender, e) => |
| | | { |
| | | btnOpen.IsSelected = true; |
| | | }; |
| | | btnOpen.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnOpen.IsSelected = false; |
| | | 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); |
| | | }; |
| | | } |
| | |
| | | }; |
| | | btnUp.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnUp.IsSelected = false; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnUp.IsSelected = false; |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | function.SetAttrState(FunctionAttributeKey.Position, "up"); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.Position, "up"); |
| | |
| | | }; |
| | | btnDown.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnDown.IsSelected = false; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnDown.IsSelected = false; |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | function.SetAttrState(FunctionAttributeKey.Position, "down"); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.Position, "down"); |
| | |
| | | case FunctionCategory.Light: |
| | | case FunctionCategory.AC: |
| | | case FunctionCategory.FloorHeat: |
| | | case FunctionCategory.Electric: |
| | | #region æé®ç¶ææ´æ° |
| | | if (cTag == updataFunction.sid + "_Switch") |
| | | { |
| | |
| | | { |
| | | 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; |
| | | } |
| | | } |
| | |
| | | #endregion |
| | | case FunctionCategory.Curtain: |
| | | #region çªå¸æ´æ° |
| | | var uCurtain = updataFunction as Curtain; |
| | | switch (uCurtain.trait_on_off.curValue.ToString()) |
| | | //var uCurtain = updataFunction as Curtain; |
| | | var percentString = updataFunction.GetAttrState(FunctionAttributeKey.Percent); |
| | | if (percentString != null) |
| | | { |
| | | case "off": |
| | | int percent = 0; |
| | | int.TryParse(percentString, out percent); |
| | | if (percent == 0) |
| | | { |
| | | if (cTag == updataFunction.sid + "_off") |
| | | { |
| | | try |
| | |
| | | { |
| | | (fcView.GetChildren(j) as Button).IsSelected = false; |
| | | } |
| | | break; |
| | | case "on": |
| | | } |
| | | else |
| | | { |
| | | if (cTag == updataFunction.sid + "_on") |
| | | { |
| | | try |
| | |
| | | { |
| | | (fcView.GetChildren(j) as Button).IsSelected = false; |
| | | } |
| | | break; |
| | | case "stop": |
| | | if (cTag == updataFunction.sid + "_stop") |
| | | { |
| | | try |
| | | { |
| | | (fcView.GetChildren(j) as Button).IsSelected = true; |
| | | } |
| | | catch { } |
| | | } |
| | | else |
| | | { |
| | | (fcView.GetChildren(j) as Button).IsSelected = false; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | #endregion |
| | | break; |
| | |
| | | { |
| | | 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: |
| | |
| | | functionCount = 1; |
| | | break; |
| | | case ShowFunction.Sensor: |
| | | functionCount = FunctionList.List.sensorsArm.Count; |
| | | functionCount = FunctionList.List.GetArmSensorList().Count; |
| | | break; |
| | | case ShowFunction.VideoIntercom: |
| | | break; |
| | |
| | | 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), |
| | |
| | | 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), |
| | |
| | | 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() |
| | | { |
| | |
| | | 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), |
| | |
| | | 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), |
| | |
| | | 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(); |
| | |
| | | btnName.TextID = StringId.SecurityMonitoring; |
| | | btnFunctionViewBg.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | |
| | | #if __IOS__ |
| | | EZSDK.IOS.EZSDK.Go2EZvizMonitor(); |
| | | #else //å®åæå头 |
| | | |
| | | HDLCommon.Current.Go2EZvizMonitor(bodyView); |
| | | #endif |
| | | }; |
| | | break; |
| | |
| | | /// <param name="function"></param> |
| | | public static void UpdataInfo(Function function) |
| | | { |
| | | Application.RunOnMainThread((Action)(() => { |
| | | Application.RunOnMainThread(() => { |
| | | if (bodyView == null) |
| | | return; |
| | | try |
| | |
| | | case SPK.ElectricTuyaFan: |
| | | case SPK.ElectricTuyaWaterValve: |
| | | case SPK.ElectricTuyaWeepRobot: |
| | | case SPK.ClothesHanger: |
| | | vv = ShowFunction.Electric; |
| | | break; |
| | | } |
| | |
| | | catch |
| | | { |
| | | } |
| | | })); |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | 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"; |
| | | } |
| | | } |
| | | } |
| | |
| | | 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>(); |
| | |
| | | } |
| | | 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>(); |
| | |
| | | } |
| | | 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>(); |
| | |
| | | } |
| | | 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>(); |
| | |
| | | { |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | { |
| | | 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); |
| | |
| | | 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); |
| | |
| | | |
| | | break; |
| | | } |
| | | var powerLowTipAttr = function.status.Find((obj) => obj.key == FunctionAttributeKey.BatteryState); |
| | | var powerLowTipAttr = function.attributes.Find((obj) => obj.key == FunctionAttributeKey.BatteryState); |
| | | if (powerLowTipAttr != null) |
| | | { |
| | | if (powerLowTipAttr.value.ToLower() == "low") |
| | | if (powerLowTipAttr.state.ToLower() == "low") |
| | | { |
| | | Button btnTipPowerLow = new Button() |
| | | { |
| | |
| | | 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), |
| | | }; |
| | |
| | | Height = Application.GetMinRealAverage(32), |
| | | UnSelectedImagePath = "FunctionIcon/Curtain/CurtainCloseIcon.png", |
| | | SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseOnIcon.png", |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "off", |
| | | IsSelected = function.GetAttrState(FunctionAttributeKey.Percent) == "0", |
| | | Tag = function.sid + "_off" |
| | | }; |
| | | bodyDiv.AddChidren(btnCurtainClose); |
| | |
| | | UnSelectedImagePath = "FunctionIcon/Curtain/CurtainStopIcon.png", |
| | | SelectedImagePath = "FunctionIcon/Curtain/CurtainStopOnIcon.png", |
| | | Tag = function.sid + "_stop", |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "stop" |
| | | }; |
| | | bodyDiv.AddChidren(btnCurtainStop); |
| | | |
| | |
| | | UnSelectedImagePath = "FunctionIcon/Curtain/CurtainOpenIcon.png", |
| | | SelectedImagePath = "FunctionIcon/Curtain/CurtainOpenOnIcon.png", |
| | | Tag = function.sid + "_on", |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "on" |
| | | 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> |
| | |
| | | SelectedImagePath = "FunctionIcon/Electrical/ClothesHanger/ClothesHangerDownIcon1On.png", |
| | | }; |
| | | bodyDiv.AddChidren(btnClothesHangerDown); |
| | | LoadEvent_ControlClothesHanger(function, btnClothesHangerDown, btnClothesHangerUp); |
| | | LoadEvent_ControlClothesHanger(function, btnClothesHangerUp, btnClothesHangerDown); |
| | | #endregion |
| | | |
| | | |
| | |
| | | { |
| | | 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)); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | 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); |
| | | } |
| | |
| | | { |
| | | 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; |
| | |
| | | dimmerControlBar.OnStopTrackingTouchEvent = (sender, e) => { |
| | | onDimmerBar = false; |
| | | (bodyDiv.Parent as VerticalScrolViewLayout).ScrollEnabled = true; |
| | | light.brightness = dimmerControlBar.Progress; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("brightness", light.brightness.ToString()); |
| | | Control.Ins.SendWriteCommand(light, d); |
| | | function.SetAttrState(FunctionAttributeKey.Brightness, dimmerControlBar.Progress.ToString()); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.Brightness, dimmerControlBar.Progress.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }; |
| | | dimmerControlBar.OnProgressChangedEvent = (sender, e) => { |
| | | dimmerControlBar.ProgressBarColor = CSS.CSS_Color.AuxiliaryColor1; |
| | |
| | | /// <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) => |
| | | { |
| | |
| | | btnStop.IsSelected = false; |
| | | btnOpen.IsSelected = false; |
| | | curtain.trait_on_off.curValue = "off"; |
| | | curtain.percent = 0; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("on_off", curtain.trait_on_off.curValue.ToString()); |
| | | curtain.SetAttrState(FunctionAttributeKey.Percent, 0); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(curtain, d); |
| | | }; |
| | | |
| | |
| | | btnClose.IsSelected = false; |
| | | btnOpen.IsSelected = false; |
| | | curtain.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()); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(curtain, d); |
| | | }; |
| | | |
| | |
| | | btnClose.IsSelected = false; |
| | | btnStop.IsSelected = false; |
| | | curtain.trait_on_off.curValue = "on"; |
| | | curtain.percent = 100; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("on_off", curtain.trait_on_off.curValue.ToString()); |
| | | curtain.SetAttrState(FunctionAttributeKey.Percent, 100); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, curtain.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(curtain, d); |
| | | }; |
| | | } |
| | |
| | | }; |
| | | btnUp.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnUp.IsSelected = false; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnUp.IsSelected = false; |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | function.SetAttrState(FunctionAttributeKey.Position, "up"); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.Position, "up"); |
| | |
| | | }; |
| | | btnDown.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnDown.IsSelected = false; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnDown.IsSelected = false; |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | function.SetAttrState(FunctionAttributeKey.Position, "down"); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.Position, "down"); |
| | |
| | | |
| | | 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(); |
| | | |
| | |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = FunctionList.List.GetDelayText(scene.delay.ToString()) |
| | | Text = scene.GetDelayText() |
| | | }; |
| | | sceneDelayRow.AddChidren(btnSceneDelayInfo); |
| | | |
| | |
| | | { |
| | | Action<string> action = (obj) => { |
| | | scene.delay = obj; |
| | | btnSceneDelayInfo.Text = FunctionList.List.GetDelayText(obj); |
| | | btnSceneDelayInfo.Text = scene.GetDelayText(); |
| | | }; |
| | | Dictionary<string, string> items = new Dictionary<string, string>(); |
| | | items.Add("30", "30s"); |
| | |
| | | |
| | | if (Convert.ToInt32(scenefunction.delay) > 0) |
| | | { |
| | | btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + FunctionList.List.GetDelayText(scenefunction.delay); |
| | | btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + new Scene() { delay = scenefunction.delay }.GetDelayText(); |
| | | } |
| | | else |
| | | { |
| | |
| | | var fanState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed); |
| | | if (modeState != null) |
| | | { |
| | | sceneFunctionInfo += FunctionList.List.GetValueText(modeState.key, modeState.value); |
| | | sceneFunctionInfo += modeState.GetValueText(); |
| | | } |
| | | if (tempState != null) |
| | | { |
| | | sceneFunctionInfo += FunctionList.List.GetValueText(tempState.key, tempState.value); |
| | | sceneFunctionInfo += FunctionList.List.GetUintString(tempState.key); |
| | | sceneFunctionInfo += tempState.GetValueText(); |
| | | sceneFunctionInfo += tempState.GetUintString(); |
| | | } |
| | | if (fanState != null) |
| | | { |
| | | sceneFunctionInfo += FunctionList.List.GetValueText(fanState.key, fanState.value); |
| | | sceneFunctionInfo += tempState.GetValueText(); |
| | | } |
| | | var briState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness); |
| | | if (briState != null) |
| | |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = FunctionList.List.GetDelayText( scene.delay) |
| | | Text = scene.GetDelayText() |
| | | }; |
| | | sceneDelayRow.AddChidren(btnSceneDelayInfo); |
| | | |
| | |
| | | { |
| | | Action<string> action = (obj) => { |
| | | scene.delay = obj; |
| | | btnSceneDelayInfo.Text = FunctionList.List.GetDelayText(obj); |
| | | btnSceneDelayInfo.Text = scene.GetDelayText(); |
| | | scene.EditScene(); |
| | | }; |
| | | Dictionary<string, string> items = new Dictionary<string, string>(); |
| | |
| | | |
| | | if (Convert.ToInt32( scenefunction.delay) > 0) |
| | | { |
| | | btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + FunctionList.List.GetDelayText(scenefunction.delay); |
| | | btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + new Scene() { delay = scenefunction.delay }.GetDelayText(); |
| | | } |
| | | else |
| | | { |
| | |
| | | var fanState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed); |
| | | if (modeState != null) |
| | | { |
| | | sceneFunctionInfo += FunctionList.List.GetValueText(modeState.key, modeState.value) + " "; |
| | | sceneFunctionInfo += modeState.GetValueText() + " "; |
| | | } |
| | | if (tempState != null) |
| | | { |
| | | sceneFunctionInfo += FunctionList.List.GetValueText(tempState.key, tempState.value) + " "; |
| | | sceneFunctionInfo += FunctionList.List.GetUintString(tempState.key); |
| | | sceneFunctionInfo += tempState.GetValueText() + " "; |
| | | sceneFunctionInfo += tempState.GetUintString(); |
| | | } |
| | | if (fanState != null) |
| | | { |
| | | sceneFunctionInfo += FunctionList.List.GetValueText(fanState.key, fanState.value) + " "; |
| | | sceneFunctionInfo += fanState.GetValueText() + " "; |
| | | } |
| | | var briState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness); |
| | | if (briState != null) |
| | |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = FunctionList.List.GetValueText(sceneStatus.key,sceneStatus.value) + FunctionList.List.GetUintString(sceneStatus.key) |
| | | Text = sceneStatus.GetValueText() + sceneStatus.GetUintString() |
| | | }; |
| | | row.AddChidren(btnFunctionText); |
| | | if (sceneStatus.key == FunctionAttributeKey.OnOff) |
| | |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | Text = FunctionList.List.GetNameText(sceneStatus.key) |
| | | Text = sceneStatus.GetNameText() |
| | | }; |
| | | row.AddChidren(btnFunctionName); |
| | | btnFunctionName.MouseUpEventHandler = (sender, e) => |
| | |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = FunctionList.List.GetDelayText( sceneFunction.delay) |
| | | Text = new Scene() { delay = sceneFunction.delay }.GetDelayText() |
| | | }; |
| | | delayRow.AddChidren(btnDelayInfo); |
| | | |
| | |
| | | btnSceneDelayTitle.MouseUpEventHandler = (sender, e) => { |
| | | Action<string> action = (obj) => { |
| | | sceneFunction.delay = obj; |
| | | btnDelayInfo.Text = FunctionList.List.GetDelayText(obj); |
| | | btnDelayInfo.Text = new Scene() { delay = sceneFunction.delay }.GetDelayText(); |
| | | }; |
| | | Dictionary<string, string> items = new Dictionary<string, string>(); |
| | | items.Add("30", "30s"); |
| | |
| | | dialog.Close(); |
| | | trait.value = "on"; |
| | | sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = "on"; |
| | | btn.Text = FunctionList.List.GetValueText(trait.key, trait.value) + FunctionList.List.GetUintString(trait.key); |
| | | btn.Text = trait.GetValueText() + trait.GetUintString(); |
| | | |
| | | var temp = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness); |
| | | if (temp == null) |
| | |
| | | { |
| | | temp.value = "100"; |
| | | } |
| | | btnBrightnessText.Text = FunctionList.List.GetValueText(temp.key, temp.value) + "%"; |
| | | btnBrightnessText.Text = temp.GetValueText() + "%"; |
| | | } |
| | | }; |
| | | btnOff.MouseUpEventHandler = (sender,e) =>{ |
| | | dialog.Close(); |
| | | trait.value = "off"; |
| | | sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = "off"; |
| | | btn.Text= FunctionList.List.GetValueText(trait.key,trait.value) + FunctionList.List.GetUintString(trait.key); |
| | | btn.Text= trait.GetValueText() + trait.GetUintString(); |
| | | |
| | | var temp = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness); |
| | | if(temp == null) |
| | |
| | | { |
| | | temp.value = "0"; |
| | | } |
| | | btnBrightnessText.Text = FunctionList.List.GetValueText(temp.key, temp.value) + "%"; |
| | | btnBrightnessText.Text = temp.GetValueText() + "%"; |
| | | } |
| | | }; |
| | | |
| | |
| | | }; |
| | | for (int i = 16; i <= 32; i += 1) |
| | | { |
| | | pickerItems.Add(i.ToString() + FunctionList.List.GetUintString(trait.key)); |
| | | pickerItems.Add(i.ToString() + trait.GetUintString()); |
| | | } |
| | | uIPickerView.setNPicker(pickerItems, null, null); |
| | | optionBaseView.AddChidren(uIPickerView); |
| | | uIPickerView.setCurrentItems(pickerItems.IndexOf(trait.value.ToString()), 4, 5); |
| | | |
| | | string selectItem = pickerItems[0]; |
| | | if (pickerItems.Contains(trait.value + FunctionList.List.GetUintString(trait.key))) |
| | | if (pickerItems.Contains(trait.value + trait.GetUintString())) |
| | | { |
| | | selectItem = trait.value.ToString() + FunctionList.List.GetUintString(trait.key); |
| | | selectItem = trait.value.ToString() + trait.GetUintString(); |
| | | } |
| | | |
| | | dialog.Show(); |
| | |
| | | dialog.Close(); |
| | | btn.Text = selectItem; |
| | | //sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.value.ToString() ; |
| | | trait.value = selectItem.Replace(FunctionList.List.GetUintString(trait.key),""); |
| | | trait.value = selectItem.Replace(trait.GetUintString(),""); |
| | | }; |
| | | |
| | | } |
| | |
| | | Gravity = Gravity.CenterHorizontal, |
| | | TextAlignment = TextAlignment.Center, |
| | | Width = Application.GetRealWidth(100), |
| | | Text = FunctionList.List.GetNameText(trait.key), |
| | | Text = trait.GetNameText(), |
| | | IsBold = true, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | |
| | | { |
| | | dialog.Close(); |
| | | trait.value = controlBar.Progress.ToString(); |
| | | btn.Text = trait.value + FunctionList.List.GetUintString(trait.key); |
| | | btn.Text = trait.value + trait.GetUintString(); |
| | | |
| | | var temp = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff); |
| | | if (temp != null) |
| | |
| | | { |
| | | temp.value = "off"; |
| | | } |
| | | btnOnText.Text = FunctionList.List.GetValueText(temp.key, temp.value); |
| | | btnOnText.Text = temp.GetValueText(); |
| | | } |
| | | }; |
| | | } |
| | |
| | | Gravity = Gravity.CenterHorizontal, |
| | | TextAlignment = TextAlignment.Center, |
| | | Width = Application.GetRealWidth(100), |
| | | Text = FunctionList.List.GetNameText(trait.key), |
| | | Text = trait.GetNameText(), |
| | | IsBold = true, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | |
| | | { |
| | | dialog.Close(); |
| | | trait.value = controlBar.Progress.ToString(); |
| | | btn.Text = trait.value + FunctionList.List.GetUintString(trait.key); |
| | | btn.Text = trait.value + trait.GetUintString(); |
| | | }; |
| | | } |
| | | |
| | |
| | | Gravity = Gravity.CenterHorizontal, |
| | | TextAlignment = TextAlignment.Center, |
| | | Width = Application.GetRealWidth(100), |
| | | Text = FunctionList.List.GetNameText(trait.key), |
| | | Text = trait.GetNameText(), |
| | | IsBold = true, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Tag = m, |
| | | Text = FunctionList.List.GetValueText(trait.key, m) |
| | | Text = trait.GetValueText() |
| | | }; |
| | | row.AddChidren(btnPropertyTitle); |
| | | |
| | |
| | | #endregion |
| | | |
| | | #region åºååé |
| | | AC aC; |
| | | AC acTemp = new AC(); |
| | | Function function; |
| | | Button btnCollection_Out; |
| | | Button btnFunctionName_Out; |
| | | Button btnFromFloor_Out; |
| | |
| | | /// </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) |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, |
| | | Text = aC.name, |
| | | Text = function.name, |
| | | }; |
| | | controlView.AddChidren(btnFunctionName); |
| | | |
| | |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = aC.GetRoomListName() |
| | | Text = function.GetRoomListName() |
| | | }; |
| | | controlView.AddChidren(btnFromFoorAndRoom); |
| | | |
| | |
| | | Height = Application.GetMinRealAverage(40), |
| | | SelectedImagePath = "Collection/CollectionIcon.png", |
| | | UnSelectedImagePath = "Collection/CollectionGrayIcon.png", |
| | | IsSelected = aC.collect |
| | | IsSelected = function.collect |
| | | }; |
| | | //controlView.AddChidren(btnCollection); |
| | | //2020-12-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.trait_temp.min, |
| | | MaxValue = aC.trait_temp.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.trait_temp.curValue), |
| | | Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.SetTemp)), |
| | | #if __IOS__ |
| | | Y = Application.GetRealHeight(120 + 25), |
| | | Width = Application.GetRealWidth(260 - 40), |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = 50, |
| | | IsBold = true, |
| | | Text = aC.trait_temp.curValue.ToString(), |
| | | Text = function.GetAttrState(FunctionAttributeKey.SetTemp), |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | controlView.AddChidren(btnTemp); |
| | |
| | | Y = Application.GetRealHeight(334), |
| | | Width = Application.GetRealWidth(30), |
| | | Height = Application.GetRealWidth(30), |
| | | UnSelectedImagePath = aC.curModeImage, |
| | | UnSelectedImagePath = acTemp.GetModeIconPath(function.GetAttrState(FunctionAttributeKey.Mode)), |
| | | }; |
| | | controlView.AddChidren(btnMode); |
| | | |
| | |
| | | Y = Application.GetRealHeight(337), |
| | | Width = Application.GetRealWidth(30), |
| | | Height = Application.GetRealWidth(30), |
| | | UnSelectedImagePath = aC.curFanImage, |
| | | UnSelectedImagePath = acTemp.GetFanIconPath(function.GetAttrState(FunctionAttributeKey.FanSpeed)), |
| | | }; |
| | | controlView.AddChidren(btnWindSpeed); |
| | | |
| | |
| | | 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(); |
| | | } |
| | |
| | | }; |
| | | modeChangeView.AddChidren(btnLine); |
| | | |
| | | foreach(var m in aC.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 * (aC.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 = aC.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 * (aC.trait_mode.value.IndexOf(m) + 1) + 8), |
| | | Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 8), |
| | | Height = Application.GetRealHeight(44), |
| | | Width = Application.GetRealWidth(90), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | IsSelected = aC.trait_mode.curValue.ToString() == m, |
| | | IsSelected = function.GetAttrState(FunctionAttributeKey.Mode) == m, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | }; |
| | | modeChangeView.AddChidren(btnModeText); |
| | |
| | | break; |
| | | } |
| | | |
| | | if(aC.trait_mode.value.IndexOf(m) < aC.trait_mode.value.Count-1) |
| | | if (modeList.IndexOf(m) < modeList.Count - 1) |
| | | { |
| | | modeChangeView.AddChidren(new Button() |
| | | { |
| | | X = btnTitle.X, |
| | | Y = btnModeText.Bottom , |
| | | Y = btnModeText.Bottom, |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | |
| | | }; |
| | | modeChangeView.AddChidren(btnLine); |
| | | |
| | | foreach (var m in aC.trait_fan.value) |
| | | var modeList = function.GetAttribute(FunctionAttributeKey.FanSpeed).value; |
| | | foreach (var m in modeList) |
| | | { |
| | | Button btnFanIcon = new Button() |
| | | { |
| | | X = btnTitle.X, |
| | | Y = Application.GetRealHeight(44 * (aC.trait_fan.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 = aC.trait_fan.curValue.ToString() == m, |
| | | IsSelected = function.GetAttrState(FunctionAttributeKey.FanSpeed) == m, |
| | | }; |
| | | modeChangeView.AddChidren(btnFanIcon); |
| | | |
| | | Button btnFanText = new Button() |
| | | { |
| | | X = Application.GetRealWidth(12) + btnFanIcon.Right, |
| | | Y = Application.GetRealHeight(44 * (aC.trait_fan.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 = aC.trait_fan.curValue.ToString() == m, |
| | | IsSelected = function.GetAttrState(FunctionAttributeKey.FanSpeed) == m, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | }; |
| | | modeChangeView.AddChidren(btnFanText); |
| | |
| | | break; |
| | | } |
| | | |
| | | if (aC.trait_fan.value.IndexOf(m) < aC.trait_fan.value.Count - 1) |
| | | if (modeList.IndexOf(m) < modeList.Count - 1) |
| | | { |
| | | modeChangeView.AddChidren(new Button() |
| | | { |
| | |
| | | public partial class ACPage |
| | | { |
| | | static DateTime updataTime = DateTime.MinValue; |
| | | public static void UpdataStates(AC uAc) |
| | | public static void UpdataStates(Function updateTemp) |
| | | { |
| | | try |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | Application.RunOnMainThread((() => |
| | | { |
| | | if (bodyView == null) |
| | | { |
| | |
| | | { |
| | | return; |
| | | } |
| | | AC temp = new AC(); |
| | | updataTime = DateTime.Now; |
| | | //bodyView.arcBar.IsOffline = bodyView.aC.trait_on_off.curValue.ToString() != "on"; |
| | | //bodyView.btnSwitch.IsSelected = uAc.trait_on_off.curValue.ToString() == "on"; |
| | | //if (uAc.refreshTime.AddMilliseconds(500) < DateTime.Now) |
| | | //{ |
| | | // bodyView.arcBar.Progress = Convert.ToInt32(Convert.ToDouble(uAc.trait_temp.curValue)); |
| | | //} |
| | | //bodyView.arcBar.ThumbImagePath = uAc.trait_on_off.curValue.ToString() == "on" ? "FunctionIcon/AC/DiyThumbIconOn.png" : "FunctionIcon/AC/DiyThumbIcon.png"; |
| | | //bodyView.arcBar.IsClickable = uAc.trait_on_off.curValue.ToString() == "on"; |
| | | bodyView.btnTemp.Text = uAc.trait_temp.curValue.ToString(); |
| | | bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(uAc.trait_IndoorTemp.curValue)) + "°C"; |
| | | bodyView.btnMode.UnSelectedImagePath = uAc.curModeImage; |
| | | bodyView.btnWindSpeed.UnSelectedImagePath = uAc.curFanImage; |
| | | bodyView.arcBar.Progress = Convert.ToInt32(Convert.ToDouble(uAc.trait_temp.curValue)); |
| | | 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.trait_mode.curValue.ToString() == "fan") |
| | | if (updateTemp.GetAttrState((string)FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | bodyView.arcBar.IsClickable = false; |
| | | } |
| | |
| | | bodyView.arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIcon.png"; |
| | | } |
| | | |
| | | }); |
| | | })); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | //åéå·æ°ä¿¡æ¯äºä»¶ |
| | | 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(); |
| | | }; |
| | | } |
| | | |
| | |
| | | { |
| | | 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(); |
| | | }; |
| | | } |
| | | |
| | |
| | | { |
| | | btnMinus.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (aC.trait_on_off.curValue.ToString() == "off" || aC.trait_mode.curValue.ToString() == "fan") |
| | | if (function.trait_on_off.curValue.ToString() == "off" || function.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | return; |
| | | } |
| | | var temp = Convert.ToInt32(aC.trait_temp.curValue); |
| | | if (temp <= aC.trait_temp.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.trait_temp.curValue = 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.trait_mode.curValue.ToString() == "fan") |
| | | if (function.trait_on_off.curValue.ToString() == "off" || function.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | return; |
| | | } |
| | | var temp = Convert.ToInt32(aC.trait_temp.curValue); |
| | | if (temp >= aC.trait_temp.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.trait_temp.curValue = 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, aC.trait_temp.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(aC, d); |
| | | //aC.GetSendJObject |
| | | d.Add(FunctionAttributeKey.SetTemp, temp.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | //function.GetSendJObject |
| | | |
| | | }; |
| | | arcBar.OnStopTrackingTouchEvent = (sender, e) => |
| | | { |
| | | aC.trait_temp.curValue = arcBar.Progress.ToString(); |
| | | btnTemp.Text = aC.trait_temp.curValue.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, aC.trait_temp.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(aC, d); |
| | | d.Add(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }; |
| | | arcBar.OnProgressChangedEvent = (sender, e) => |
| | | { |
| | | aC.trait_temp.curValue = e.ToString(); |
| | | btnTemp.Text = aC.trait_temp.curValue.ToString(); |
| | | function.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString()); |
| | | btnTemp.Text = e.ToString(); |
| | | }; |
| | | } |
| | | /// <summary> |
| | |
| | | { |
| | | btnMode.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (aC.trait_on_off.curValue.ToString() == "off") |
| | | if (function.trait_on_off.curValue.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | |
| | | }; |
| | | btnWindSpeed.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (aC.trait_on_off.curValue.ToString() == "off") |
| | | if (function.trait_on_off.curValue.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | |
| | | 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; |
| | |
| | | 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); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å è½½æ¨¡å¼æ¹åäºä»¶ |
| | | /// </summary> |
| | | void LoadEvent_ChangeMode(Dialog dialog, FrameLayout dialogView, Button btn1, Button btn2, string curMode) |
| | | void LoadEvent_ChangeMode(Dialog dialog, FrameLayout dialogView, Button btnModeIcon, Button btnModeText, string curMode) |
| | | { |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | |
| | | }; |
| | | EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => |
| | | { |
| | | btn1.IsSelected = btn2.IsSelected = true; |
| | | aC.trait_mode.curValue = curMode; |
| | | btnMode.UnSelectedImagePath = aC.curModeImage; |
| | | //Control.Send(CommandType_A.write, aC); |
| | | btnModeIcon.IsSelected = btnModeText.IsSelected = true; |
| | | 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 = btn1.UnSelectedImagePath; |
| | | btnMode.UnSelectedImagePath = btnModeIcon.UnSelectedImagePath; |
| | | d.Add(FunctionAttributeKey.Mode, curMode); |
| | | Control.Ins.SendWriteCommand(aC, d); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | dialog.Close(); |
| | | if (aC.trait_mode.curValue.ToString() == "fan") |
| | | if (function.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | bodyView.arcBar.IsClickable = false; |
| | | } |
| | |
| | | bodyView.arcBar.IsClickable = true; |
| | | } |
| | | }; |
| | | btn1.MouseUpEventHandler = eventHandler1; |
| | | btn2.MouseUpEventHandler = eventHandler1; |
| | | btnModeIcon.MouseUpEventHandler = eventHandler1; |
| | | btnModeText.MouseUpEventHandler = eventHandler1; |
| | | dialogView.MouseUpEventHandler = eventHandler; |
| | | } |
| | | /// <summary> |
| | | /// å è½½é£éæ¹åäºä»¶ |
| | | /// </summary> |
| | | void LoadEvent_ChangeFan(Dialog dialog, FrameLayout dialogView, Button btn1, Button btn2, string curFan) |
| | | void LoadEvent_ChangeFan(Dialog dialog, FrameLayout dialogView, Button btnFanIcon, Button btnFanText, string curFan) |
| | | { |
| | | EventHandler<MouseEventArgs> closeDialogEvent = (sender, e) => |
| | | { |
| | |
| | | }; |
| | | EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => |
| | | { |
| | | btn1.IsSelected = btn2.IsSelected = true; |
| | | aC.trait_fan.curValue = curFan; |
| | | btnWindSpeed.UnSelectedImagePath = aC.curFanImage; |
| | | btnFanIcon.IsSelected = btnFanText.IsSelected = true; |
| | | 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); |
| | | btnWindSpeed.UnSelectedImagePath = btn1.UnSelectedImagePath; |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | btnWindSpeed.UnSelectedImagePath = btnFanIcon.UnSelectedImagePath; |
| | | dialog.Close(); |
| | | }; |
| | | btn1.MouseUpEventHandler = eventHandler1; |
| | | btn2.MouseUpEventHandler = eventHandler1; |
| | | btnFanIcon.MouseUpEventHandler = eventHandler1; |
| | | btnFanText.MouseUpEventHandler = eventHandler1; |
| | | dialogView.MouseUpEventHandler = closeDialogEvent; |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using HDL_ON.DriverLayer; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.Stan; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | public class AcControlPage : DeviceFunctionCardCommonForm |
| | | { |
| | | #region â åé声æ___________________________ |
| | | /// <summary> |
| | | /// ç©ºè°æ¸©åº¦æ§å¶æ§ä»¶ |
| | | /// </summary> |
| | | DiyArcSeekBar arcBar; |
| | | /// <summary> |
| | | /// åå·æé® |
| | | /// </summary> |
| | | Button btnMinus; |
| | | /// <summary> |
| | | /// å å·æé® |
| | | /// </summary> |
| | | Button btnPlus; |
| | | /// <summary> |
| | | /// 温度æé® |
| | | /// </summary> |
| | | Button btnTemp; |
| | | Button btnTempUint; |
| | | /// <summary> |
| | | /// 室å
温度æé® |
| | | /// </summary> |
| | | Button btnIndoorTemp; |
| | | /// <summary> |
| | | /// æ¨¡å¼æé® |
| | | /// </summary> |
| | | Button btnMode; |
| | | /// <summary> |
| | | /// é£éæé® |
| | | /// </summary> |
| | | Button btnWindSpeed; |
| | | /// <summary> |
| | | /// å¼å
³æé® |
| | | /// </summary> |
| | | Button btnSwitch; |
| | | |
| | | AC acFunction = new AC(); |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region â åå§å_____________________________ |
| | | |
| | | /// <summary> |
| | | /// åå§åç½è²åºåçå
容 |
| | | /// </summary> |
| | | public override void InitFrameWhiteContent() |
| | | { |
| | | |
| | | base.ShowColltionButton = false; |
| | | base.SetTitleText(Language.StringByID(StringId.Electric)); |
| | | |
| | | //åå§å第ä¸ä¸ªç´¢å¼é¡µçå
容 |
| | | this.InitFrameWhiteContent1(); |
| | | |
| | | //å·æ°å½å设å¤çç¶æç¼å |
| | | this.RefreshNowDeviceStatuMemory(this.device); |
| | | //å·æ°çé¢ç¶æ |
| | | this.RefreshFormStatu(); |
| | | //读åç¶æ |
| | | new System.Threading.Thread(() => |
| | | { |
| | | Control.Ins.SendReadCommand(device); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åå§å第ä¸ä¸ªç´¢å¼é¡µçå
容 |
| | | /// </summary> |
| | | private void InitFrameWhiteContent1() |
| | | { |
| | | |
| | | arcBar = new DiyArcSeekBar() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | OpenAngle = 160, |
| | | ThumbImageHeight = Application.GetRealWidth(50), |
| | | ProgressBarColor = CSS_Color.MainColor, |
| | | OfflineProgressBarColor = CSS_Color.PromptingColor2, |
| | | ArcColor = CSS_Color.BackgroundColor, |
| | | #if __IOS__ |
| | | Y = Application.GetRealHeight(120 + 25), |
| | | Width = Application.GetRealWidth(260 - 40), |
| | | Height = Application.GetRealWidth(260 - 40), |
| | | SeekBarPadding = Application.GetRealWidth(8), |
| | | #else |
| | | Y = Application.GetRealHeight(120 + 40), |
| | | Width = Application.GetRealWidth(260 - 40), |
| | | Height = Application.GetRealWidth(260 - 40), |
| | | SeekBarPadding = Application.GetRealWidth(7), |
| | | #endif |
| | | |
| | | }; |
| | | 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() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(206), |
| | | Width = Application.GetRealWidth(71), |
| | | Height = Application.GetRealWidth(60), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = 50, |
| | | IsBold = true, |
| | | Text = device.GetAttrState(FunctionAttributeKey.SetTemp), |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | FrameWhiteCentet1.AddChidren(btnTemp); |
| | | |
| | | btnTempUint = new Button() |
| | | { |
| | | X = btnTemp.Right, |
| | | Y = btnTemp.Y, |
| | | Width = Application.GetRealWidth(30), |
| | | Height = Application.GetRealHeight(30), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_Secondary, |
| | | IsBold = true, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = "°C", |
| | | }; |
| | | FrameWhiteCentet1.AddChidren(btnTempUint); |
| | | |
| | | btnIndoorTemp = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = btnTemp.Bottom, |
| | | Width = Application.GetRealWidth(120), |
| | | Height = Application.GetRealHeight(20), |
| | | Text = Language.StringByID(StringId.IndoorTemp) + "20°C", |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | }; |
| | | FrameWhiteCentet1.AddChidren(btnIndoorTemp); |
| | | |
| | | btnMinus = new Button() |
| | | { |
| | | X = Application.GetRealWidth(21), |
| | | Y = Application.GetRealHeight(263), |
| | | Width = Application.GetRealWidth(32), |
| | | Height = Application.GetRealWidth(32), |
| | | UnSelectedImagePath = "Public/MinusSignIcon.png", |
| | | }; |
| | | FrameWhiteCentet1.AddChidren(btnMinus); |
| | | |
| | | btnPlus = new Button() |
| | | { |
| | | X = Application.GetRealWidth(275), |
| | | Y = Application.GetRealHeight(263), |
| | | Width = Application.GetRealWidth(32), |
| | | Height = Application.GetRealWidth(32), |
| | | UnSelectedImagePath = "Public/PlusSignIcon.png", |
| | | }; |
| | | FrameWhiteCentet1.AddChidren(btnPlus); |
| | | |
| | | btnMode = new Button() |
| | | { |
| | | X = Application.GetRealWidth(60), |
| | | Y = Application.GetRealHeight(334), |
| | | Width = Application.GetRealWidth(30), |
| | | Height = Application.GetRealWidth(30), |
| | | UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode)), |
| | | }; |
| | | FrameWhiteCentet1.AddChidren(btnMode); |
| | | |
| | | btnWindSpeed = new Button() |
| | | { |
| | | X = Application.GetRealWidth(235), |
| | | Y = Application.GetRealHeight(337), |
| | | Width = Application.GetRealWidth(30), |
| | | Height = Application.GetRealWidth(30), |
| | | UnSelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed)), |
| | | }; |
| | | FrameWhiteCentet1.AddChidren(btnWindSpeed); |
| | | |
| | | btnSwitch = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(466), |
| | | Width = Application.GetRealWidth(32), |
| | | Height = Application.GetRealWidth(32), |
| | | UnSelectedImagePath = "Public/PowerClose.png", |
| | | SelectedImagePath = "Public/PowerOpen.png", |
| | | IsSelected = device.GetAttrState(FunctionAttributeKey.OnOff) == "on" |
| | | }; |
| | | FrameWhiteCentet1.AddChidren(btnSwitch); |
| | | |
| | | LoadEvent_TempChange(); |
| | | LoadEvent_AcStatesChange(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å è½½ä¿®æ¹æ¨¡å¼åºå |
| | | /// </summary> |
| | | void LoadDiv_ChangeModeView() |
| | | { |
| | | Dialog dialog = new Dialog(); |
| | | |
| | | FrameLayout dialogView = new FrameLayout() |
| | | { |
| | | BackgroundColor = CSS_Color.DialogTransparentColor1, |
| | | }; |
| | | dialog.AddChidren(dialogView); |
| | | |
| | | FrameLayout modeChangeView; |
| | | modeChangeView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(30), |
| | | Y = Application.GetRealHeight(128), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(287), |
| | | BackgroundImagePath = "FunctionIcon/AC/DivBg1.png", |
| | | }; |
| | | dialogView.AddChidren(modeChangeView); |
| | | |
| | | Button btnTitle; |
| | | btnTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(8 + 16), |
| | | Y = Application.GetRealHeight(8), |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(44), |
| | | TextID = StringId.ChooseMode, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_Secondary, |
| | | }; |
| | | modeChangeView.AddChidren(btnTitle); |
| | | |
| | | Button btnLine = new Button() |
| | | { |
| | | X = btnTitle.X, |
| | | Y = btnTitle.Bottom, |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | | }; |
| | | modeChangeView.AddChidren(btnLine); |
| | | |
| | | var modeList = device.GetAttribute(FunctionAttributeKey.Mode).value; |
| | | foreach (var m in modeList) |
| | | { |
| | | Button btnModeIcon = new Button() |
| | | { |
| | | X = btnTitle.X, |
| | | Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8), |
| | | Width = Application.GetRealWidth(24), |
| | | Height = Application.GetRealWidth(24), |
| | | IsSelected = device.GetAttrState(FunctionAttributeKey.Mode) == m, |
| | | }; |
| | | modeChangeView.AddChidren(btnModeIcon); |
| | | |
| | | Button btnModeText = new Button() |
| | | { |
| | | X = Application.GetRealWidth(12) + btnModeIcon.Right, |
| | | Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 8), |
| | | Height = Application.GetRealHeight(44), |
| | | Width = Application.GetRealWidth(90), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | IsSelected = device.GetAttrState(FunctionAttributeKey.Mode) == m, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | }; |
| | | modeChangeView.AddChidren(btnModeText); |
| | | |
| | | btnModeIcon.UnSelectedImagePath = acFunction.GetModeIconPath(m, false); |
| | | btnModeIcon.SelectedImagePath = acFunction.GetModeIconPath(m); |
| | | btnModeText.Text = acFunction.GetModeAttrText( m); |
| | | |
| | | if (modeList.IndexOf(m) < modeList.Count - 1) |
| | | { |
| | | modeChangeView.AddChidren(new Button() |
| | | { |
| | | X = btnTitle.X, |
| | | Y = btnModeText.Bottom, |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | | }); |
| | | } |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => |
| | | { |
| | | btnModeIcon.IsSelected = btnModeText.IsSelected = true; |
| | | 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(device, d); |
| | | dialog.Close(); |
| | | if (device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | arcBar.IsClickable = false; |
| | | } |
| | | else |
| | | { |
| | | arcBar.IsClickable = true; |
| | | } |
| | | }; |
| | | btnModeIcon.MouseUpEventHandler = eventHandler1; |
| | | btnModeText.MouseUpEventHandler = eventHandler1; |
| | | dialogView.MouseUpEventHandler = eventHandler; |
| | | |
| | | } |
| | | |
| | | dialogView.MouseUpEventHandler = (sender, e) => { |
| | | dialog.Close(); |
| | | }; |
| | | dialog.Show(); |
| | | } |
| | | /// <summary> |
| | | /// å è½½ä¿®æ¹æ¨¡å¼åºå |
| | | /// </summary> |
| | | void LoadDiv_ChangeFanView() |
| | | { |
| | | Dialog dialog = new Dialog(); |
| | | |
| | | FrameLayout dialogView = new FrameLayout() |
| | | { |
| | | BackgroundColor = CSS_Color.DialogTransparentColor1, |
| | | }; |
| | | dialog.AddChidren(dialogView); |
| | | |
| | | FrameLayout modeChangeView; |
| | | modeChangeView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(185), |
| | | Y = Application.GetRealHeight(172), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(243), |
| | | BackgroundImagePath = "FunctionIcon/AC/DivBg2.png", |
| | | }; |
| | | dialogView.AddChidren(modeChangeView); |
| | | |
| | | Button btnTitle; |
| | | btnTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(8 + 16), |
| | | Y = Application.GetRealHeight(8), |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(44), |
| | | TextID = StringId.ChooseFan, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_Secondary, |
| | | }; |
| | | modeChangeView.AddChidren(btnTitle); |
| | | |
| | | Button btnLine = new Button() |
| | | { |
| | | X = btnTitle.X, |
| | | Y = btnTitle.Bottom, |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | | }; |
| | | modeChangeView.AddChidren(btnLine); |
| | | |
| | | var modeList = device.GetAttribute(FunctionAttributeKey.FanSpeed).value; |
| | | foreach (var m in modeList) |
| | | { |
| | | Button btnFanIcon = new Button() |
| | | { |
| | | X = btnTitle.X, |
| | | Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8), |
| | | Width = Application.GetRealWidth(24), |
| | | Height = Application.GetRealWidth(24), |
| | | IsSelected = device.GetAttrState(FunctionAttributeKey.FanSpeed) == m, |
| | | }; |
| | | modeChangeView.AddChidren(btnFanIcon); |
| | | |
| | | Button btnFanText = new Button() |
| | | { |
| | | X = Application.GetRealWidth(12) + btnFanIcon.Right, |
| | | 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 = device.GetAttrState(FunctionAttributeKey.FanSpeed) == m, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | }; |
| | | modeChangeView.AddChidren(btnFanText); |
| | | btnFanIcon.UnSelectedImagePath = acFunction.GetModeIconPath(m,false); |
| | | btnFanIcon.SelectedImagePath = acFunction.GetModeIconPath(m); |
| | | btnFanText.Text = acFunction.GetModeAttrText(m); |
| | | |
| | | if (modeList.IndexOf(m) < modeList.Count - 1) |
| | | { |
| | | modeChangeView.AddChidren(new Button() |
| | | { |
| | | X = btnTitle.X, |
| | | Y = btnFanText.Bottom, |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | | }); |
| | | } |
| | | |
| | | EventHandler<MouseEventArgs> closeDialogEvent = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => |
| | | { |
| | | btnFanIcon.IsSelected = btnFanText.IsSelected = true; |
| | | 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(device, d); |
| | | btnWindSpeed.UnSelectedImagePath = btnFanIcon.UnSelectedImagePath; |
| | | dialog.Close(); |
| | | }; |
| | | btnFanIcon.MouseUpEventHandler = eventHandler1; |
| | | btnFanText.MouseUpEventHandler = eventHandler1; |
| | | dialogView.MouseUpEventHandler = closeDialogEvent; |
| | | } |
| | | |
| | | dialog.Show(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region â 设å¤ç¶æåé¦_______________________ |
| | | |
| | | /// <summary> |
| | | /// 设å¤ç¶æåé¦ |
| | | /// </summary> |
| | | /// <param name="i_LocalDevice"></param> |
| | | public override void DeviceStatuPush(Function i_LocalDevice) |
| | | { |
| | | //䏿¯åä¸ä¸ªä¸è¥¿ |
| | | if (this.device.sid != i_LocalDevice.sid) { return; } |
| | | |
| | | //å·æ°å½å设å¤çç¶æç¼å |
| | | this.RefreshNowDeviceStatuMemory(i_LocalDevice); |
| | | //å·æ°çé¢ç¶æ |
| | | this.RefreshFormStatu(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region â åéåç§å½ä»¤_______________________ |
| | | |
| | | /// <summary> |
| | | /// 温度æ¹åæ¨¡å¼ |
| | | /// </summary> |
| | | void LoadEvent_TempChange() |
| | | { |
| | | btnMinus.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (device.trait_on_off.curValue.ToString() == "off" || device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | return; |
| | | } |
| | | var temp = Convert.ToInt32(device.GetAttrState(FunctionAttributeKey.SetTemp)); |
| | | if (temp <= device.GetAttribute(FunctionAttributeKey.Mode).min) |
| | | { |
| | | return; |
| | | } |
| | | temp--; |
| | | arcBar.Progress = temp; |
| | | btnTemp.Text = 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(device, d); |
| | | }; |
| | | btnPlus.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (device.trait_on_off.curValue.ToString() == "off" || device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | return; |
| | | } |
| | | var temp = Convert.ToInt32(device.GetAttrState(FunctionAttributeKey.SetTemp)); |
| | | if (temp >= device.GetAttribute(FunctionAttributeKey.SetTemp).max) |
| | | { |
| | | return; |
| | | } |
| | | temp++; |
| | | arcBar.Progress = temp; |
| | | btnTemp.Text = 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(device, d); |
| | | }; |
| | | arcBar.OnStopTrackingTouchEvent = (sender, e) => |
| | | { |
| | | 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(device, d); |
| | | }; |
| | | arcBar.OnProgressChangedEvent = (sender, e) => |
| | | { |
| | | device.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString()); |
| | | btnTemp.Text = e.ToString(); |
| | | }; |
| | | } |
| | | /// <summary> |
| | | /// æ§å¶æ¨¡å¼äºä»¶ |
| | | /// </summary> |
| | | void LoadEvent_AcStatesChange() |
| | | { |
| | | btnMode.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (device.trait_on_off.curValue.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | | LoadDiv_ChangeModeView(); |
| | | }; |
| | | btnWindSpeed.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (device.trait_on_off.curValue.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | | LoadDiv_ChangeFanView(); |
| | | }; |
| | | |
| | | btnSwitch.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | 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; |
| | | arcBar.IsOffline = false; |
| | | } |
| | | else |
| | | { |
| | | arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIcon.png"; |
| | | btnSwitch.IsBold = false; |
| | | arcBar.IsOffline = true; |
| | | } |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, device.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region â å·æ°çé¢ç¶æ_______________________ |
| | | |
| | | /// <summary> |
| | | /// å·æ°çé¢ç¶æ |
| | | /// </summary> |
| | | private void RefreshFormStatu() |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnTemp.Text = device.GetAttrState(FunctionAttributeKey.SetTemp); |
| | | 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 (device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | arcBar.IsClickable = false; |
| | | } |
| | | else |
| | | { |
| | | arcBar.IsClickable = true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | arcBar.IsOffline = true; |
| | | btnSwitch.IsSelected = false; |
| | | arcBar.IsClickable = false; |
| | | arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIcon.png"; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region â ä¸è¬æ¹æ³___________________________ |
| | | |
| | | /// <summary> |
| | | /// å·æ°å½å设å¤çç¶æç¼å |
| | | /// </summary> |
| | | private void RefreshNowDeviceStatuMemory(Function i_LocalDevice) |
| | | { |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | public class ArmSensorHistroyPaging |
| | | { |
| | | Function device; |
| | | public ArmSensorHistroyPaging(Function function) |
| | | { |
| | | device = function; |
| | | } |
| | | |
| | | public void InitFrame(FrameLayout FrameWhiteCentet2) |
| | | { |
| | | Button btnTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(220), |
| | | Height = Application.GetRealHeight(65), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | IsBold = true, |
| | | TextID = StringId.Log, |
| | | }; |
| | | FrameWhiteCentet2.AddChidren(btnTitle); |
| | | |
| | | VerticalScrolViewLayout histroyView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = btnTitle.Bottom, |
| | | Height = Application.GetRealHeight(450), |
| | | }; |
| | | FrameWhiteCentet2.AddChidren(histroyView); |
| | | |
| | | var waitPage = new Loading(); |
| | | FrameWhiteCentet2.AddChidren(waitPage); |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | int pageCount = 1; |
| | | var pm = new DAL.Server.HttpServerRequest(); |
| | | var pack = pm.GetArmSensorHistory(device.deviceId, "20", "1"); |
| | | var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<Cloud_ArmSensorHistory>(pack.Data.ToString()); |
| | | List<string> years = new List<string>(); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | var startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // å½å°æ¶åº |
| | | foreach (var data in revData.list) |
| | | { |
| | | var yearString = startTime.AddMilliseconds(Convert.ToDouble(data.createTime)).ToString("yyyy") + Language.StringByID(StringId.Years); |
| | | var monthString = startTime.AddMilliseconds(Convert.ToDouble(data.createTime)).ToString("m"); |
| | | var timeString = startTime.AddMilliseconds(Convert.ToDouble(data.createTime)).ToString("HH:mm:ss"); |
| | | var dateString = monthString + " " + timeString; |
| | | if (!years.Contains(yearString)) |
| | | { |
| | | years.Add(yearString); |
| | | Button btnYear = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Height = Application.GetRealHeight(46), |
| | | Width = Application.GetRealWidth(220), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | IsBold = true, |
| | | Text = yearString, |
| | | }; |
| | | histroyView.AddChidren(btnYear); |
| | | } |
| | | var cell = new ArmSensorHistoryMsgCell() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | }; |
| | | histroyView.AddChidren(cell); |
| | | cell.InitControl(data.content, dateString); |
| | | } |
| | | }); |
| | | } |
| | | catch |
| | | { |
| | | |
| | | } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | waitPage.Hide(); |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | } |
| | | |
| | | public class ArmSensorHistoryMsgCell : FrameLayout |
| | | { |
| | | Button btnMsg; |
| | | Button btnTime; |
| | | |
| | | public void InitControl(string msg, string time) |
| | | { |
| | | btnMsg = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Height = Application.GetRealHeight(40), |
| | | Width = Application.GetRealWidth(300), |
| | | //Width = Application.GetRealWidth(220), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | Text = msg, |
| | | }; |
| | | this.AddChidren(btnMsg); |
| | | |
| | | btnTime = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(35), |
| | | Width = Application.GetRealWidth(295), |
| | | //Width = Application.GetRealWidth(80), |
| | | Height = Application.GetRealHeight(15), |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | Text = time, |
| | | IsMoreLines = true |
| | | }; |
| | | this.AddChidren(btnTime); |
| | | |
| | | AddChidren(new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(49), |
| | | Width = Application.GetRealWidth(295), |
| | | Height = 1, |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// äºç«¯apiæ¥å£è¿åçå®é²ä¼ æå¨å岿°æ®å¯¹è±¡ |
| | | /// </summary> |
| | | public class Cloud_ArmSensorHistory |
| | | { |
| | | public string totalCount = ""; |
| | | public string totalPage = ""; |
| | | public string pageNo = ""; |
| | | public string pageSize = ""; |
| | | public List<ArmSensorHistory> list = new List<ArmSensorHistory>(); |
| | | } |
| | | |
| | | public class ArmSensorHistory |
| | | { |
| | | public string title = ""; |
| | | public string content = ""; |
| | | public string level = ""; |
| | | public string createTime = ""; |
| | | } |
| | | } |
| | |
| | | using HDL_ON.Stan; |
| | | using HDL_ON.UI.CSS; |
| | | using HDL_ON.Entity; |
| | | using System.Collections.Generic; |
| | | using System; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | |
| | | /// </summary> |
| | | private void InitFrameWhiteContent2() |
| | | { |
| | | var paging = new ArmSensorHistroyPaging(device); |
| | | paging.InitFrame(FrameWhiteCentet2); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | private void RefreshFormStatu() |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | var temp = device.status.Find((sta) => sta.key == FunctionAttributeKey.Status); |
| | | var temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.Status); |
| | | if (temp != null) |
| | | { |
| | | if (temp.value == "open") |
| | | if (temp.state == "open") |
| | | { |
| | | btnIcon.IsSelected = true; |
| | | btnSuctionView.TextID = StringId.Open; |
| | |
| | | |
| | | #endregion |
| | | } |
| | | |
| | | } |
| | |
| | | this.InitFrameWhiteContent1(); |
| | | //åå§å第äºä¸ªç´¢å¼é¡µçå
容 |
| | | this.InitFrameWhiteContent2(); |
| | | |
| | | //å·æ°å½å设å¤çç¶æç¼å |
| | | this.RefreshNowDeviceStatuMemory(this.device); |
| | | //å·æ°çé¢ç¶æ |
| | | this.RefreshFormStatu(); |
| | | //读åç¶æ |
| | |
| | | /// </summary> |
| | | private void InitFrameWhiteContent2() |
| | | { |
| | | Button btnLog = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Y = Application.GetRealHeight(16), |
| | | Width = Application.GetRealWidth(250), |
| | | Height = Application.GetRealHeight(33), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | IsBold = true, |
| | | TextID = StringId.Log, |
| | | }; |
| | | FrameWhiteCentet2.AddChidren(btnLog); |
| | | var paging = new ArmSensorHistroyPaging(device); |
| | | paging.InitFrame(FrameWhiteCentet2); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | //䏿¯åä¸ä¸ªä¸è¥¿ |
| | | if (this.device.sid != i_LocalDevice.sid) { return; } |
| | | |
| | | //å·æ°å½å设å¤çç¶æç¼å |
| | | this.RefreshNowDeviceStatuMemory(i_LocalDevice); |
| | | //å·æ°çé¢ç¶æ |
| | | this.RefreshFormStatu(); |
| | | } |
| | |
| | | private void RefreshFormStatu() |
| | | { |
| | | Application.RunOnMainThread(()=>{ |
| | | var temp = device.status.Find((sta) => sta.key == FunctionAttributeKey.Status); |
| | | var temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.Status); |
| | | if (temp != null) |
| | | { |
| | | if (temp.value == "true") |
| | | if (temp.state == "true") |
| | | { |
| | | btnIcon.IsSelected = true; |
| | | btnSuctionView.TextID = StringId.Someone; |
| | |
| | | #endregion |
| | | |
| | | #region â ä¸è¬æ¹æ³___________________________ |
| | | |
| | | /// <summary> |
| | | /// å·æ°å½å设å¤çç¶æç¼å |
| | | /// </summary> |
| | | private void RefreshNowDeviceStatuMemory(Function i_LocalDevice) |
| | | { |
| | | foreach (var data in i_LocalDevice.status) |
| | | { |
| | | //å¼å
³ |
| | | //if (data.key == "on_off") { this.weepRobotData.Cleaning = data.value.ToLower() == "on"; } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | |
| | | /// </summary> |
| | | private void InitFrameWhiteContent2() |
| | | { |
| | | var paging = new ArmSensorHistroyPaging(device); |
| | | paging.InitFrame(FrameWhiteCentet2); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | private void RefreshFormStatu() |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | var temp = device.status.Find((sta) => sta.key == FunctionAttributeKey.Status); |
| | | var temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.Status); |
| | | if (temp != null) |
| | | { |
| | | if (temp.value == "alarm") |
| | | if (temp.state == "alarm") |
| | | { |
| | | btnIcon.IsSelected = true; |
| | | btnSuctionView.TextID = StringId.InAlarm; |
| | |
| | | /// </summary> |
| | | private void InitFrameWhiteContent2() |
| | | { |
| | | var paging = new ArmSensorHistroyPaging(device); |
| | | paging.InitFrame(FrameWhiteCentet2); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | private void RefreshFormStatu() |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | var temp = device.status.Find((sta) => sta.key == FunctionAttributeKey.Status); |
| | | var temp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.Status); |
| | | if (temp != null) |
| | | { |
| | | if (temp.value == "alarm") |
| | | if (temp.state == "alarm") |
| | | { |
| | | btnIcon.IsSelected = true; |
| | | btnSuctionView.TextID = StringId.WaterLeakage; |
| | |
| | | #endregion |
| | | |
| | | #region åºååé |
| | | Curtain curtain; |
| | | Curtain curtainTemp = new Curtain(); |
| | | Function function; |
| | | Button btnCollection_Out; |
| | | Button btnFunctionName_Out; |
| | | Button btnFromFloor_Out; |
| | |
| | | /// </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) |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, |
| | | Text = curtain.name, |
| | | Text = function.name, |
| | | }; |
| | | controlView.AddChidren(btnFunctionName); |
| | | |
| | |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = curtain.GetRoomListName() |
| | | Text = function.GetRoomListName() |
| | | }; |
| | | controlView.AddChidren(btnFromFoorAndRoom); |
| | | |
| | |
| | | Height = Application.GetMinRealAverage(40), |
| | | SelectedImagePath = "Collection/CollectionIcon.png", |
| | | UnSelectedImagePath = "Collection/CollectionGrayIcon.png", |
| | | IsSelected = curtain.collect |
| | | IsSelected = function.collect |
| | | }; |
| | | //controlView.AddChidren(btnCollection); |
| | | //2020-12-16 å¦ææ¯æåéèæ¶èåè½ |
| | |
| | | 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); |
| | | |
| | |
| | | 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); |
| | | |
| | |
| | | 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(); |
| | | } |
| | |
| | | /// <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; |
| | | //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.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; |
| | | bodyView.btnCurtainStop.IsSelected = false; |
| | | //bodyView.btnCurtainOpen.IsSelected = false; |
| | | //bodyView.btnCurtainClose.IsSelected = true; |
| | | //bodyView.btnCurtainStop.IsSelected = false; |
| | | bodyView.btnCurtainBgIcon.IsSelected = false; |
| | | } |
| | | } |
| | | })); |
| | | }); |
| | | } |
| | | |
| | | void LoadEventList() |
| | |
| | | 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> |
| | | /// æ¶èåè½æé®äºä»¶ |
| | |
| | | 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(); |
| | | }; |
| | | } |
| | | |
| | |
| | | void LoadEvent_ControlEvent() |
| | | { |
| | | btnCurtainClose.MouseUpEventHandler = (sender, e) => { |
| | | btnCurtainClose.IsSelected = true; |
| | | btnCurtainStop.IsSelected = false; |
| | | btnCurtainOpen.IsSelected = false; |
| | | new System.Threading.Thread(() => { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => { |
| | | btnCurtainClose.IsSelected = false; |
| | | }); |
| | | }) { IsBackground = true }.Start(); |
| | | btnCurtainBgIcon.IsSelected = false; |
| | | curtain.trait_on_off.curValue = "off"; |
| | | //Control.Send(CommandType_A.write,curtain); |
| | | 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) => |
| | | //{ |
| | | // btnCurtainStop.IsSelected = true; |
| | | // //btnCurtainClose.IsSelected = false; |
| | | // //btnCurtainOpen.IsSelected = false; |
| | | //}; |
| | | //btnCurtainOpen.MouseDownEventHandler = (sender, e) => { |
| | | // btnCurtainOpen.IsSelected = true; |
| | | //}; |
| | | //btnCurtainClose.MouseDownEventHandler = (sender, e) => { |
| | | // btnCurtainClose.IsSelected = true; |
| | | //}; |
| | | btnCurtainStop.MouseDownEventHandler = (sender, e) => |
| | | { |
| | | btnCurtainStop.IsSelected = true; |
| | | }; |
| | | btnCurtainOpen.MouseDownEventHandler = (sender, e) => |
| | | { |
| | | btnCurtainOpen.IsSelected = true; |
| | | }; |
| | | btnCurtainClose.MouseDownEventHandler = (sender, e) => |
| | | { |
| | | btnCurtainClose.IsSelected = true; |
| | | }; |
| | | btnCurtainStop.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnCurtainOpen.IsSelected = false; |
| | | btnCurtainClose.IsSelected = false; |
| | | btnCurtainStop.IsSelected = true; |
| | | curtain.trait_on_off.curValue = "stop"; |
| | | new System.Threading.Thread(() => { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => { |
| | | btnCurtainStop.IsSelected = false; |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | 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) => |
| | | { |
| | | btnCurtainOpen.IsSelected = true; |
| | | btnCurtainClose.IsSelected = false; |
| | | btnCurtainStop.IsSelected = false; |
| | | new System.Threading.Thread(() => { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => { |
| | | btnCurtainOpen.IsSelected = false; |
| | | }); |
| | | }) |
| | | { 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); |
| | | }; |
| | | |
| | | } |
| | |
| | | #endregion |
| | | |
| | | #region åºååé |
| | | Curtain curtain; |
| | | Curtain curtainTemp = new Curtain(); |
| | | Function function; |
| | | Button btnCollection_Out; |
| | | Button btnFunctionName_Out; |
| | | Button btnFromFloor_Out; |
| | |
| | | /// </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) |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, |
| | | Text = curtain.name, |
| | | Text = function.name, |
| | | }; |
| | | controlView.AddChidren(btnFunctionName); |
| | | |
| | |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = curtain.GetRoomListName() |
| | | Text = function.GetRoomListName() |
| | | }; |
| | | controlView.AddChidren(btnFromFoorAndRoom); |
| | | |
| | |
| | | Height = Application.GetMinRealAverage(40), |
| | | SelectedImagePath = "Collection/CollectionIcon.png", |
| | | UnSelectedImagePath = "Collection/CollectionGrayIcon.png", |
| | | IsSelected = curtain.collect |
| | | IsSelected = function.collect |
| | | }; |
| | | //controlView.AddChidren(btnCollection); |
| | | //2020-12-16 å¦ææ¯æåéèæ¶èåè½ |
| | |
| | | Y = Application.GetRealHeight(130), |
| | | Width = Application.GetRealWidth(250), |
| | | Height = Application.GetRealWidth(177), |
| | | Progress = curtain.percent, |
| | | Progress = curtainTemp.GetPercent(function), |
| | | ProgressTextColor =0x00000000, |
| | | IsInvertedProgress = true, |
| | | //IsInvertedProgress = true, |
| | | }; |
| | | controlView.AddChidren(curtainSeekBar); |
| | | |
| | |
| | | Height = Application.GetMinRealAverage(32), |
| | | UnSelectedImagePath = "FunctionIcon/Curtain/CurtainCloseIcon.png", |
| | | SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseOnIcon.png", |
| | | IsSelected = function.GetAttrState(FunctionAttributeKey.Percent) == "0" |
| | | }; |
| | | controlView.AddChidren(btnCurtainClose); |
| | | |
| | |
| | | Height = Application.GetMinRealAverage(32), |
| | | UnSelectedImagePath = "FunctionIcon/Curtain/CurtainOpenIcon.png", |
| | | SelectedImagePath = "FunctionIcon/Curtain/CurtainOpenOnIcon.png", |
| | | 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(); |
| | | } |
| | |
| | | /// <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) |
| | | { |
| | | if (uCurtain.trait_on_off.curValue.ToString() == "stop") |
| | | var percentString = updateTemp.GetAttrState(FunctionAttributeKey.Percent); |
| | | if (percentString != null) |
| | | { |
| | | bodyView.btnCurtainOpen.IsSelected = false; |
| | | bodyView.btnCurtainClose.IsSelected = false; |
| | | bodyView.btnCurtainStop.IsSelected = true; |
| | | } |
| | | else if (uCurtain.trait_on_off.curValue.ToString() == "on") |
| | | { |
| | | bodyView.btnCurtainOpen.IsSelected = true; |
| | | bodyView.btnCurtainClose.IsSelected = false; |
| | | bodyView.btnCurtainStop.IsSelected = false; |
| | | } |
| | | else if (uCurtain.trait_on_off.curValue.ToString() == "off") |
| | | { |
| | | bodyView.btnCurtainOpen.IsSelected = false; |
| | | bodyView.btnCurtainClose.IsSelected = true; |
| | | bodyView.btnCurtainStop.IsSelected = false; |
| | | int percent = 0; |
| | | int.TryParse(percentString, out percent); |
| | | bodyView.btnCurtainOpen.IsSelected = percent > 0; |
| | | bodyView.btnCurtainClose.IsSelected = percent == 0; |
| | | } |
| | | try |
| | | { |
| | | if (!bodyView.onCurtainAnimation) |
| | | { |
| | | bodyView.CurtainAnimation(Convert.ToInt32(uCurtain.trait_percent.curValue.ToString())); |
| | | bodyView.CurtainAnimation(Convert.ToInt32(updateTemp.GetAttrState(FunctionAttributeKey.Percent))); |
| | | } |
| | | } |
| | | catch { } |
| | |
| | | //åéå·æ°ä¿¡æ¯äºä»¶ |
| | | 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> |
| | |
| | | { |
| | | 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(); |
| | | }; |
| | | } |
| | | |
| | |
| | | { |
| | | btnCurtainClose.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnCurtainClose.IsSelected = true; |
| | | btnCurtainOpen.IsSelected = false; |
| | | btnCurtainStop.IsSelected = false; |
| | | curtain.trait_on_off.curValue = "off"; |
| | | curtain.percent = 100; |
| | | //new System.Threading.Thread(() => { |
| | | // System.Threading.Thread.Sleep(2000); |
| | | // Application.RunOnMainThread(() => { |
| | | // btnCurtainClose.IsSelected = false; |
| | | // }); |
| | | //}) |
| | | //{ IsBackground = true }.Start(); |
| | | 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) => |
| | | { |
| | | |
| | | btnCurtainStop.IsSelected = true; |
| | | btnCurtainClose.IsSelected = false; |
| | | btnCurtainOpen.IsSelected = false; |
| | | curtain.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); |
| | | onCurtainAnimation = false; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnCurtainStop.IsSelected = false; |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | function.trait_on_off.curValue = "stop"; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); |
| | | DriverLayer.Control.Ins.SendWriteCommand(function, d); |
| | | }; |
| | | |
| | | btnCurtainOpen.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | |
| | | btnCurtainClose.IsSelected = false; |
| | | btnCurtainStop.IsSelected = false; |
| | | btnCurtainOpen.IsSelected = true; |
| | | curtain.trait_on_off.curValue = "on"; |
| | | curtain.percent = 0; |
| | | //new System.Threading.Thread(() => { |
| | | // System.Threading.Thread.Sleep(2000); |
| | | // Application.RunOnMainThread(() => { |
| | | // btnCurtainOpen.IsSelected = false; |
| | | // }); |
| | | //}) |
| | | //{ IsBackground = true }.Start(); |
| | | 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); |
| | | }; |
| | | |
| | | |
| | | btnCurtainStop.MouseDownEventHandler = (sender, e) => |
| | | { |
| | | btnCurtainStop.IsSelected = true; |
| | | }; |
| | | btnCurtainOpen.MouseDownEventHandler = (sender, e) => |
| | | { |
| | | btnCurtainOpen.IsSelected = true; |
| | | btnCurtainClose.IsSelected = false; |
| | | }; |
| | | btnCurtainClose.MouseDownEventHandler = (sender, e) => |
| | | { |
| | | btnCurtainClose.IsSelected = true; |
| | | btnCurtainOpen.IsSelected = false; |
| | | }; |
| | | |
| | | //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) => |
| | |
| | | // 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(); |
| | |
| | | //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(); |
| | | }; |
| | |
| | | // 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(); |
| | |
| | | // 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(); |
| | | //}; |
| | |
| | | #endregion |
| | | |
| | | #region åºååé |
| | | Curtain curtain; |
| | | Curtain curtainTemp = new Curtain(); |
| | | Function function; |
| | | Button btnCollection_Out; |
| | | Button btnFunctionName_Out; |
| | | Button btnFromFloor_Out; |
| | |
| | | /// æ£å¨æ§å¶ |
| | | /// </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) |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, |
| | | Text = curtain.name, |
| | | Text = function.name, |
| | | }; |
| | | controlView.AddChidren(btnFunctionName); |
| | | |
| | |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = curtain.GetRoomListName() |
| | | Text = function.GetRoomListName() |
| | | }; |
| | | controlView.AddChidren(btnFromFoorAndRoom); |
| | | |
| | |
| | | Height = Application.GetMinRealAverage(40), |
| | | SelectedImagePath = "Collection/CollectionIcon.png", |
| | | UnSelectedImagePath = "Collection/CollectionGrayIcon.png", |
| | | IsSelected = curtain.collect |
| | | IsSelected = function.collect |
| | | }; |
| | | //controlView.AddChidren(btnCollection); |
| | | //2020-12-16 å¦ææ¯æåéèæ¶èåè½ |
| | |
| | | Y = Application.GetRealHeight(130), |
| | | Width = Application.GetRealWidth(170), |
| | | Height = Application.GetRealWidth(210), |
| | | Progress = curtain.percent, |
| | | Progress = curtainTemp.GetPercent(function), |
| | | //IsInvertedProgress = true, |
| | | ProgressTextColor = 0x00000000, |
| | | }; |
| | |
| | | ProgressTextSize = 0x00000000, |
| | | MaxValue = 100, |
| | | SeekBarPadding = Application.GetRealWidth(20), |
| | | Progress = curtain.percent, |
| | | Progress = curtainTemp.GetPercent(function), |
| | | Visible = false, |
| | | Enable = false, |
| | | }; |
| | |
| | | Height = Application.GetMinRealAverage(32), |
| | | UnSelectedImagePath = "FunctionIcon/Curtain/CurtainCloseIcon.png", |
| | | SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseOnIcon.png", |
| | | IsSelected = function.GetAttrState(FunctionAttributeKey.Percent) == "0", |
| | | }; |
| | | controlView.AddChidren(btnCurtainClose); |
| | | |
| | |
| | | Height = Application.GetMinRealAverage(32), |
| | | UnSelectedImagePath = "FunctionIcon/Curtain/CurtainOpenIcon.png", |
| | | SelectedImagePath = "FunctionIcon/Curtain/CurtainOpenOnIcon.png", |
| | | 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(); |
| | | } |
| | |
| | | /// <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) |
| | | { |
| | | if (uCurtain.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") |
| | | { |
| | | bodyView.btnCurtainOpen.IsSelected = true; |
| | | bodyView.btnCurtainClose.IsSelected = false; |
| | | bodyView.btnCurtainStop.IsSelected = false; |
| | | } |
| | | else if (uCurtain.trait_on_off.curValue.ToString() == "off") |
| | | { |
| | | bodyView.btnCurtainOpen.IsSelected = false; |
| | | bodyView.btnCurtainClose.IsSelected = true; |
| | | bodyView.btnCurtainStop.IsSelected = false; |
| | | } |
| | | var percentString = updateTemp.GetAttrState(FunctionAttributeKey.Percent); |
| | | int percent = 0; |
| | | int.TryParse(percentString, out percent); |
| | | bodyView.btnCurtainOpen.IsSelected = percent > 0; |
| | | bodyView.btnCurtainClose.IsSelected = percent == 0; |
| | | try |
| | | { |
| | | if (!bodyView.onCurtainAnimation) |
| | | { |
| | | bodyView.CurtainAnimation(Convert.ToInt32(uCurtain.trait_percent.curValue.ToString())); |
| | | bodyView.CurtainAnimation(Convert.ToInt32(updateTemp.GetAttrState(FunctionAttributeKey.Percent))); |
| | | } |
| | | } |
| | | catch { } |
| | | } |
| | | })); |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | //åéå·æ°ä¿¡æ¯äºä»¶ |
| | | 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> |
| | |
| | | { |
| | | 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(); |
| | | }; |
| | | } |
| | | |
| | |
| | | { |
| | | btnCurtainClose.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnCurtainOpen.IsSelected = false; |
| | | btnCurtainClose.IsSelected = true; |
| | | btnCurtainStop.IsSelected = false; |
| | | curtain.trait_on_off.curValue = "off"; |
| | | curtain.percent = 100; |
| | | //new System.Threading.Thread(() => { |
| | | // System.Threading.Thread.Sleep(2000); |
| | | // Application.RunOnMainThread(() => { |
| | | // btnCurtainClose.IsSelected = false; |
| | | // }); |
| | | //}) |
| | | //{ IsBackground = true }.Start(); |
| | | 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) => |
| | | { |
| | | btnCurtainStop.IsSelected = true; |
| | | btnCurtainClose.IsSelected = false; |
| | | btnCurtainOpen.IsSelected = false; |
| | | curtain.trait_on_off.curValue = "stop"; |
| | | new System.Threading.Thread(() => { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => { |
| | | btnCurtainStop.IsSelected = false; |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | 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; |
| | | }; |
| | | |
| | | btnCurtainOpen.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnCurtainClose.IsSelected = false; |
| | | btnCurtainStop.IsSelected = false; |
| | | btnCurtainOpen.IsSelected = true; |
| | | curtain.trait_on_off.curValue = "on"; |
| | | curtain.percent = 0; |
| | | //new System.Threading.Thread(() => { |
| | | // System.Threading.Thread.Sleep(2000); |
| | | // Application.RunOnMainThread(() => { |
| | | // btnCurtainOpen.IsSelected = false; |
| | | // }); |
| | | //}) |
| | | //{ IsBackground = true }.Start(); |
| | | 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); |
| | | }; |
| | | |
| | | |
| | | btnCurtainStop.MouseDownEventHandler = (sender, e) => |
| | | { |
| | | btnCurtainStop.IsSelected = true; |
| | | }; |
| | | btnCurtainOpen.MouseDownEventHandler = (sender, e) => |
| | | { |
| | | btnCurtainOpen.IsSelected = true; |
| | | btnCurtainClose.IsSelected = false; |
| | | }; |
| | | btnCurtainClose.MouseDownEventHandler = (sender, e) => |
| | | { |
| | | btnCurtainClose.IsSelected = true; |
| | | btnCurtainOpen.IsSelected = false; |
| | | }; |
| | | |
| | | |
| | | //curtainSeekBar.OnProgressChangedEvent = (sender, e) => |
| | | //{ |
| | | // 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(); |
| | |
| | | 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(); |
| | | }; |
| | |
| | | // 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(); |
| | |
| | | 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(); |
| | | }; |
| | |
| | | //åå§å第ä¸ä¸ªç´¢å¼é¡µçå
容 |
| | | this.InitFrameWhiteContent1(); |
| | | |
| | | //å·æ°å½å设å¤çç¶æç¼å |
| | | this.RefreshNowDeviceStatuMemory(this.device); |
| | | //å·æ°çé¢ç¶æ |
| | | this.RefreshFormStatu(); |
| | | //读åç¶æ |
| | |
| | | }; |
| | | FrameWhiteCentet1.AddChidren(btnDown); |
| | | |
| | | #region æ§å¶ |
| | | btnUp.MouseDownEventHandler = (sender, e) => { |
| | | btnUp.IsSelected = true; |
| | | }; |
| | | btnUp.MouseUpEventHandler = (sender, e) => { |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnUp.IsSelected = false; |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.Position, "up"); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | //---- |
| | | btnStop.MouseDownEventHandler = (sender, e) => { |
| | | btnStop.IsSelected = true; |
| | | }; |
| | | btnStop.MouseUpEventHandler = (sender, e) => { |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnStop.IsSelected = false; |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.Position, "stop"); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | //----- |
| | | btnDown.MouseDownEventHandler = (sender, e) => { |
| | | btnDown.IsSelected = true; |
| | | }; |
| | | btnDown.MouseUpEventHandler = (sender, e) => { |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnDown.IsSelected = false; |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.Position, "down"); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #region èå |
| | |
| | | { |
| | | FrameWhiteCentet1.AddChidren(hotDryView); |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => { |
| | | device.SetAttrState(FunctionAttributeKey.HotDry, "true"); |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | string onoff = hotDryView.Lighting ? "false" : "true"; |
| | | device.SetAttrState(FunctionAttributeKey.HotDry, onoff); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.HotDry, "true"); |
| | | d.Add(FunctionAttributeKey.HotDry, onoff); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | hotDryView.SetThouchEvent(eventHandler); |
| | |
| | | windDryView.Height = Application.GetRealHeight(74); |
| | | if (attrs.Contains(menu[1])) |
| | | { |
| | | if(index == 1) |
| | | if (index == 1) |
| | | { |
| | | windDryView.Gravity = Gravity.CenterHorizontal; |
| | | } |
| | | FrameWhiteCentet1.AddChidren(windDryView); |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => { |
| | | device.SetAttrState(FunctionAttributeKey.WindDry, "true"); |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | string onoff = windDryView.Lighting ? "false" : "true"; |
| | | device.SetAttrState(FunctionAttributeKey.WindDry, onoff); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.WindDry, "true"); |
| | | d.Add(FunctionAttributeKey.WindDry, onoff); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | windDryView.SetThouchEvent(eventHandler); |
| | |
| | | index++; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | disinfectView = new ClothesHangerControl( |
| | | "FunctionIcon/Electrical/ClothesHanger/ClothesHangerDisinfectIcon.png", |
| | |
| | | disinfectView.Height = Application.GetRealHeight(74); |
| | | if (attrs.Contains(menu[2])) |
| | | { |
| | | if(index == 1) |
| | | if (index == 1) |
| | | { |
| | | disinfectView.Gravity = Gravity.CenterHorizontal; |
| | | } |
| | |
| | | } |
| | | FrameWhiteCentet1.AddChidren(disinfectView); |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => { |
| | | device.SetAttrState(FunctionAttributeKey.Disinfect, "true"); |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | string onoff = disinfectView.Lighting ? "false" : "true"; |
| | | device.SetAttrState(FunctionAttributeKey.Disinfect, onoff); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.Disinfect, "true"); |
| | | d.Add(FunctionAttributeKey.Disinfect, onoff); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | }; |
| | | disinfectView.SetThouchEvent(eventHandler); |
| | |
| | | lightingView.Height = Application.GetRealHeight(74); |
| | | if (attrs.Contains(menu[3])) |
| | | { |
| | | if(index >2) |
| | | if (index > 2) |
| | | { |
| | | lightingView.Y = Application.GetRealHeight(409); |
| | | }else |
| | | } |
| | | else |
| | | { |
| | | lightingView.Y = Application.GetRealHeight(304); |
| | | if (index == 1) |
| | |
| | | } |
| | | FrameWhiteCentet1.AddChidren(lightingView); |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => { |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | string onoff = lightingView.Lighting ? "off" : "on"; |
| | | device.SetAttrState(FunctionAttributeKey.OnOff, onoff); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | |
| | | |
| | | index++; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region æ¶é´è®¾ç½® |
| | | var timeSetView = new ClothesHangerControl( |
| | | "FunctionIcon/Electrical/ClothesHanger/ClothesHangerTimeIcon.png", |
| | | "FunctionIcon/Electrical/ClothesHanger/ClothesHangerTimeIconOn.png", |
| | | Language.StringByID(StringId.Time), |
| | | ""); |
| | | timeSetView.Width = Application.GetRealWidth(96); |
| | | timeSetView.Height = Application.GetRealHeight(74); |
| | | timeSetView.Y = Application.GetRealHeight(409); |
| | | timeSetView.X = Application.GetRealWidth(266 - 33); |
| | | |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler_timeSetView = (sender, e) => |
| | | { |
| | | var setTimePage = new ClothesHangerSetTimePage(device); |
| | | MainPage.BasePageView.AddChidren(setTimePage); |
| | | setTimePage.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | timeSetView.SetThouchEvent(eventHandler_timeSetView); |
| | | |
| | | FrameWhiteCentet1.AddChidren(timeSetView); |
| | | |
| | | #endregion |
| | | } |
| | |
| | | //䏿¯åä¸ä¸ªä¸è¥¿ |
| | | if (this.device.sid != i_LocalDevice.sid) { return; } |
| | | |
| | | //å·æ°å½å设å¤çç¶æç¼å |
| | | this.RefreshNowDeviceStatuMemory(i_LocalDevice); |
| | | //å·æ°çé¢ç¶æ |
| | | this.RefreshFormStatu(); |
| | | } |
| | |
| | | /// </summary> |
| | | private void RefreshFormStatu() |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnIcon.IsSelected = true; |
| | | #region ç¹äº®ææ¬ |
| | | var hotDryTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.HotDry); |
| | | var hotDryTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.HotDry); |
| | | if (hotDryTemp != null) |
| | | { |
| | | hotDryView.SetViewStatus(hotDryTemp.value == "true"); |
| | | hotDryView.SetViewStatus(hotDryTemp.state == "true"); |
| | | } |
| | | var windDryTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.WindDry); |
| | | var windDryTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.WindDry); |
| | | if (windDryTemp != null) |
| | | { |
| | | windDryView.SetViewStatus(windDryTemp.value == "true"); |
| | | windDryView.SetViewStatus(windDryTemp.state == "true"); |
| | | } |
| | | var disinfectTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.Disinfect); |
| | | var disinfectTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.Disinfect); |
| | | if (disinfectTemp != null) |
| | | { |
| | | disinfectView.SetViewStatus(disinfectTemp.value == "true"); |
| | | disinfectView.SetViewStatus(disinfectTemp.state == "true"); |
| | | } |
| | | var lightTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.OnOff); |
| | | var lightTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.OnOff); |
| | | if (lightTemp != null) |
| | | { |
| | | lightingView.SetViewStatus(lightTemp.value == "on"); |
| | | lightingView.SetViewStatus(lightTemp.state == "on"); |
| | | } |
| | | #endregion |
| | | |
| | | #region ä¿®æ¹æ¶é´ |
| | | var hotDryTimeLeftTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.HotDryTimeLeft); |
| | | var hotDryTimeLeftTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.HotDryTimeLeft); |
| | | if (hotDryTimeLeftTemp != null) |
| | | { |
| | | hotDryView.ChangeTime(hotDryTimeLeftTemp.value); |
| | | hotDryView.ChangeTime(hotDryTimeLeftTemp.state); |
| | | } |
| | | var windDryTimeLeftTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.WindDryTimeLeft); |
| | | var windDryTimeLeftTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.WindDryTimeLeft); |
| | | if (windDryTimeLeftTemp != null) |
| | | { |
| | | windDryView.ChangeTime(windDryTimeLeftTemp.value); |
| | | windDryView.ChangeTime(windDryTimeLeftTemp.state); |
| | | } |
| | | var disinfectTimeLeftTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.DisinfectTimeLeft); |
| | | var disinfectTimeLeftTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.DisinfectTimeLeft); |
| | | if (disinfectTimeLeftTemp != null) |
| | | { |
| | | disinfectView.ChangeTime(disinfectTimeLeftTemp.value); |
| | | disinfectView.ChangeTime(disinfectTimeLeftTemp.state); |
| | | } |
| | | #endregion |
| | | |
| | |
| | | |
| | | #region â ä¸è¬æ¹æ³___________________________ |
| | | |
| | | /// <summary> |
| | | /// å·æ°å½å设å¤çç¶æç¼å |
| | | /// </summary> |
| | | private void RefreshNowDeviceStatuMemory(Function i_LocalDevice) |
| | | { |
| | | foreach (var data in i_LocalDevice.status) |
| | | { |
| | | //å¼å
³ |
| | | //if (data.key == "on_off") { this.weepRobotData.Cleaning = data.value.ToLower() == "on"; } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | |
| | |
| | | private Button btnTitle; |
| | | private Button btnTime; |
| | | /// <summary> |
| | | /// åè®¡æ¶æ¶é´ |
| | | /// </summary> |
| | | private int leftTime = 0; |
| | | /// <summary> |
| | | /// æ§ä»¶æ¯å¦ç¹äº® |
| | | /// </summary> |
| | | public bool Lighting = false; |
| | | |
| | | public ClothesHangerControl(string iconPath1, string iconPath2,string title,string time) |
| | | public ClothesHangerControl(string iconPath1, string iconPath2, string title, string time) |
| | | { |
| | | btnIcon = new Button() |
| | | { |
| | |
| | | btnTime = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = btnTitle.Bottom, |
| | | Y = Application.GetRealHeight(74-32), |
| | | Height = Application.GetRealHeight(32), |
| | | Text = time, |
| | | TextColor = 0x00000000, |
| | |
| | | /// ä¿®æ¹æ¾ç¤ºæ¶é´ |
| | | /// </summary> |
| | | /// <param name="newTime"></param> |
| | | public void ChangeTime (string newTime) |
| | | public void ChangeTime(string newTime) |
| | | { |
| | | if(newTime == "0") |
| | | { |
| | | newTime = ""; |
| | | } |
| | | |
| | | int time = 0; |
| | | int.TryParse(newTime, out time); |
| | | time = time * 60; |
| | | |
| | | int.TryParse(newTime, out leftTime); |
| | | if (countdownThread == null) |
| | | { |
| | | countdownThread = new System.Threading.Thread(() => { |
| | | while(true) |
| | | countdownThread = new System.Threading.Thread(() => |
| | | { |
| | | while (true) |
| | | { |
| | | if(time>1) |
| | | if (leftTime > 0) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnTime.Text = new TimeSpan(0, 0, time).ToString(); |
| | | btnTime.Text = new TimeSpan(0, leftTime, 0).ToString().Remove(5,3) ; |
| | | }); |
| | | System.Threading.Thread.Sleep(1000); |
| | | time--; |
| | | }else |
| | | leftTime--; |
| | | } |
| | | else if(leftTime == 0) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnTime.Text = ""; |
| | | }); |
| | | } |
| | | System.Threading.Thread.Sleep(60000); |
| | | } |
| | | }) { IsBackground = true }; |
| | | }) |
| | | { IsBackground = true }; |
| | | countdownThread.Start(); |
| | | } |
| | | } |
| | |
| | | public void SetViewStatus(bool state) |
| | | { |
| | | btnIcon.IsSelected = btnTitle.IsSelected = btnTime.IsSelected = Lighting = state; |
| | | } |
| | | |
| | | public bool GetViewState() |
| | | { |
| | | return Lighting; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | System.Threading.Thread countdownThread; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.DriverLayer; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.Stan; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | public partial class ClothesHangerSetTimePage : FrameLayout |
| | | { |
| | | FrameLayout bodyView; |
| | | |
| | | Function device; |
| | | |
| | | public ClothesHangerSetTimePage(Function function) |
| | | { |
| | | device = function; |
| | | bodyView = this; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// å è½½çé¢ |
| | | /// </summary> |
| | | public void LoadPage() |
| | | { |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.Time)).LoadTopView(); |
| | | |
| | | VerticalScrolViewLayout functionListView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Height = Application.GetRealHeight(530), |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | | ScrollEnabled = false, |
| | | }; |
| | | bodyView.AddChidren(functionListView); |
| | | |
| | | |
| | | /// <summary> |
| | | /// å°æ¶åå¼èå´ |
| | | /// </summary> |
| | | List<int> hRange = new List<int> { 0, 1, 2, 3, 4 }; |
| | | /// <summary> |
| | | /// åéåå¼èå´ |
| | | /// </summary> |
| | | List<int> mRange = new List<int> { 0, 30 }; |
| | | |
| | | var menu = new List<string>() { |
| | | FunctionAttributeKey.HotDryTime, |
| | | FunctionAttributeKey.WindDryTime, |
| | | FunctionAttributeKey.DisinfectTime, |
| | | FunctionAttributeKey.AnionTime |
| | | }; |
| | | List<string> attrs = device.GetAttributes(); |
| | | |
| | | #region çå¹²æ¶é´ |
| | | ListCellView hotDryTimeCell; |
| | | hotDryTimeCell = new ListCellView() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | }; |
| | | hotDryTimeCell.BtnTilte.TextID = StringId.HotDryTime; |
| | | |
| | | if (attrs.Contains(menu[0])) |
| | | { |
| | | |
| | | var hotDryTime = 0; |
| | | int.TryParse(device.GetAttrState(FunctionAttributeKey.HotDryTime), out hotDryTime); |
| | | hotDryTimeCell.BtnSubtitle.Text = hotDryTime / 60 + Language.StringByID(StringId.HourUint) + hotDryTime % 60 + Language.StringByID(StringId.MinuteUint); |
| | | |
| | | functionListView.AddChidren(hotDryTimeCell); |
| | | hotDryTimeCell.GoAction = () => |
| | | { |
| | | BottomTimeSelectControl timeControl = new BottomTimeSelectControl(hRange, mRange,3, Language.StringByID(StringId.HotDryTime)); |
| | | timeControl.RowHeight = Application.GetRealHeight(50); |
| | | timeControl.InitControl(0, 1, 162); |
| | | timeControl.ChangePickerEvent(); |
| | | timeControl.FinishEvent = (type, hours, min) => |
| | | { |
| | | if (type == 1)//0:åæ¶ï¼1:ç¡®å® |
| | | { |
| | | HdlThreadLogic.Current.RunThread(() => |
| | | { |
| | | var time = hours * 60 + min; |
| | | var dic = new Dictionary<string, string>(); |
| | | dic.Add(FunctionAttributeKey.HotDryTime, time.ToString()); |
| | | Control.Ins.SendWriteCommand(this.device, dic); |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | hotDryTimeCell.BtnSubtitle.Text = time / 60 + Language.StringByID(StringId.HourUint) + time % 60 + Language.StringByID(StringId.MinuteUint); |
| | | }); |
| | | }); |
| | | } |
| | | }; |
| | | }; |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region é£å¹²æ¶é´ |
| | | ListCellView windDryCell; |
| | | windDryCell = new ListCellView() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | }; |
| | | windDryCell.BtnTilte.TextID = StringId.WindDryTime; |
| | | |
| | | windDryCell.BtnSubtitle.Text = device.GetAttrState(FunctionAttributeKey.WindDryTime); |
| | | |
| | | if (attrs.Contains(menu[1])) |
| | | { |
| | | var windDryTime = 0; |
| | | int.TryParse(device.GetAttrState(FunctionAttributeKey.WindDryTime), out windDryTime); |
| | | windDryCell.BtnSubtitle.Text = windDryTime / 60 + Language.StringByID(StringId.HourUint) + windDryTime % 60 + Language.StringByID(StringId.MinuteUint); |
| | | |
| | | functionListView.AddChidren(windDryCell); |
| | | windDryCell.GoAction = () => |
| | | { |
| | | BottomTimeSelectControl timeControl = new BottomTimeSelectControl(hRange, mRange,3,Language.StringByID(StringId.WindDryTime)); |
| | | timeControl.RowHeight = Application.GetRealHeight(50); |
| | | timeControl.InitControl(0, 1, 162); |
| | | timeControl.ChangePickerEvent(); |
| | | timeControl.FinishEvent = (type, hours, min) => |
| | | { |
| | | if (type == 1)//0:åæ¶ï¼1:ç¡®å® |
| | | { |
| | | HdlThreadLogic.Current.RunThread(() => |
| | | { |
| | | var time = hours * 60 + min; |
| | | var dic = new Dictionary<string, string>(); |
| | | dic.Add(FunctionAttributeKey.WindDryTime, time.ToString()); |
| | | Control.Ins.SendWriteCommand(this.device, dic); |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | windDryCell.BtnSubtitle.Text = time / 60 + Language.StringByID(StringId.HourUint) + time % 60 + Language.StringByID(StringId.MinuteUint); |
| | | }); |
| | | }); |
| | | } |
| | | }; |
| | | }; |
| | | } |
| | | else |
| | | { |
| | | hotDryTimeCell.LineView.RemoveFromParent(); |
| | | } |
| | | #endregion |
| | | |
| | | #region æ¶æ¯æ¶é´ |
| | | ListCellView disinfectTimeCell; |
| | | disinfectTimeCell = new ListCellView() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | }; |
| | | disinfectTimeCell.BtnTilte.TextID = StringId.DisinfectTime; |
| | | |
| | | disinfectTimeCell.BtnSubtitle.Text = device.GetAttrState(FunctionAttributeKey.DisinfectTime); |
| | | |
| | | if (attrs.Contains(menu[2])) |
| | | { |
| | | var disinfectTime = 0; |
| | | int.TryParse(device.GetAttrState(FunctionAttributeKey.DisinfectTime), out disinfectTime); |
| | | disinfectTimeCell.BtnSubtitle.Text = disinfectTime / 60 + Language.StringByID(StringId.HourUint) + disinfectTime % 60 + Language.StringByID(StringId.MinuteUint); |
| | | |
| | | functionListView.AddChidren(disinfectTimeCell); |
| | | disinfectTimeCell.GoAction = () => { |
| | | BottomTimeSelectControl timeControl = new BottomTimeSelectControl(hRange, mRange,3, Language.StringByID(StringId.DisinfectTime)); |
| | | timeControl.RowHeight = Application.GetRealHeight(50); |
| | | timeControl.InitControl(0, 1, 162); |
| | | timeControl.ChangePickerEvent(); |
| | | timeControl.FinishEvent = (type, hours, min) => { |
| | | if (type == 1)//0:åæ¶ï¼1:ç¡®å® |
| | | { |
| | | HdlThreadLogic.Current.RunThread(() => |
| | | { |
| | | var time = hours * 60 + min; |
| | | var dic = new Dictionary<string, string>(); |
| | | dic.Add(FunctionAttributeKey.DisinfectTime, time.ToString()); |
| | | Control.Ins.SendWriteCommand(this.device, dic); |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | disinfectTimeCell.BtnSubtitle.Text = time / 60 + Language.StringByID(StringId.HourUint) + time % 60 + Language.StringByID(StringId.MinuteUint); |
| | | }); |
| | | }); |
| | | } |
| | | }; |
| | | }; |
| | | } |
| | | else |
| | | { |
| | | windDryCell.LineView.RemoveFromParent(); |
| | | } |
| | | #endregion |
| | | |
| | | #region è´ç¦»åæ¶é´ |
| | | ListCellView anionTimeCell; |
| | | anionTimeCell = new ListCellView() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | }; |
| | | anionTimeCell.BtnTilte.TextID = StringId.AnionTime; |
| | | |
| | | anionTimeCell.BtnSubtitle.Text = device.GetAttrState(FunctionAttributeKey.AnionTime); |
| | | |
| | | if (attrs.Contains(menu[3])) |
| | | { |
| | | var anionTime = 0; |
| | | int.TryParse(device.GetAttrState(FunctionAttributeKey.HotDryTime), out anionTime); |
| | | anionTimeCell.BtnSubtitle.Text = anionTime / 60 + Language.StringByID(StringId.HourUint) + anionTime % 60 + Language.StringByID(StringId.MinuteUint); |
| | | |
| | | functionListView.AddChidren(anionTimeCell); |
| | | anionTimeCell.LineView.RemoveFromParent(); |
| | | |
| | | anionTimeCell.GoAction = () => { |
| | | BottomTimeSelectControl timeControl = new BottomTimeSelectControl(hRange, mRange,3,Language.StringByID(StringId.AnionTime)); |
| | | |
| | | |
| | | timeControl.RowHeight = Application.GetRealHeight(50); |
| | | timeControl.InitControl(0, 1, 162); |
| | | |
| | | timeControl.ChangePickerEvent(); |
| | | |
| | | timeControl.FinishEvent = (type, hours, min) => { |
| | | if (type == 1)//0:åæ¶ï¼1:ç¡®å® |
| | | { |
| | | HdlThreadLogic.Current.RunThread(() => |
| | | { |
| | | var time = hours * 60 + min; |
| | | var dic = new Dictionary<string, string>(); |
| | | dic.Add(FunctionAttributeKey.AnionTime, time.ToString()); |
| | | Control.Ins.SendWriteCommand(this.device, dic); |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | anionTimeCell.BtnSubtitle.Text = time / 60 + Language.StringByID(StringId.HourUint) + time % 60 + Language.StringByID(StringId.MinuteUint); |
| | | }); |
| | | }); |
| | | } |
| | | }; |
| | | }; |
| | | } |
| | | else |
| | | { |
| | | disinfectTimeCell.LineView.RemoveFromParent(); |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | } |
| | | |
| | | //--------------------------------------- |
| | | public partial class ClothesHangerSetTimePage |
| | | { |
| | | |
| | | } |
| | | |
| | | //======================================== |
| | | |
| | | |
| | | } |
| | |
| | | #endregion |
| | | |
| | | #region åºååé |
| | | Fan fan; |
| | | Fan fanTemp = new Fan(); |
| | | Function function; |
| | | Button btnCollection_Out; |
| | | Button btnFunctionName_Out; |
| | | Button btnFromFloor_Out; |
| | |
| | | public FanPage(Function func) |
| | | { |
| | | bodyView = this; |
| | | fan = func as Fan; |
| | | function = func; |
| | | } |
| | | |
| | | |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, |
| | | Text = fan.name, |
| | | Text = function.name, |
| | | }; |
| | | controlView.AddChidren(btnFunctionName); |
| | | |
| | |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = fan.GetRoomListName() |
| | | Text = function.GetRoomListName() |
| | | }; |
| | | controlView.AddChidren(btnFromFoorAndRoom); |
| | | |
| | |
| | | Height = Application.GetMinRealAverage(40), |
| | | SelectedImagePath = "Collection/CollectionIcon.png", |
| | | UnSelectedImagePath = "Collection/CollectionGrayIcon.png", |
| | | IsSelected = fan.collect |
| | | IsSelected = function.collect |
| | | }; |
| | | //controlView.AddChidren(btnCollection); |
| | | //2020-12-16 å¦ææ¯æåéèæ¶èåè½ |
| | |
| | | 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", |
| | | }; |
| | |
| | | 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(); |
| | | } |
| | |
| | | /// <summary> |
| | | /// æ´æ°ç¯å
ç¶æ |
| | | /// </summary> |
| | | public static void UpdataState(Fan uFan) |
| | | public static void UpdataState(Function updateTemp) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | |
| | | { |
| | | 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) |
| | | { |
| | |
| | | |
| | | //åéå·æ°ä¿¡æ¯äºä»¶ |
| | | 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); |
| | | }; |
| | | } |
| | | |
| | |
| | | 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(); |
| | | }; |
| | | } |
| | | |
| | |
| | | |
| | | 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(); |
| | | }; |
| | |
| | | |
| | | 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(); |
| | | }; |
| | |
| | | #endregion |
| | | |
| | | #region åºååé |
| | | SwitchSocket socketFunction; |
| | | SwitchSocket socketTemp; |
| | | Function function; |
| | | Button btnCollection_Out; |
| | | Button btnFunctionName_Out; |
| | | Button btnFromFloor_Out; |
| | |
| | | public SocketPage(Function func) |
| | | { |
| | | bodyView = this; |
| | | socketFunction = func as SwitchSocket; |
| | | function = func ; |
| | | } |
| | | |
| | | |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, |
| | | Text = socketFunction.name, |
| | | Text = function.name, |
| | | }; |
| | | controlView.AddChidren(btnFunctionName); |
| | | |
| | |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = socketFunction.GetRoomListName() |
| | | Text = function.GetRoomListName() |
| | | }; |
| | | controlView.AddChidren(btnFromFoorAndRoom); |
| | | |
| | |
| | | Height = Application.GetMinRealAverage(40), |
| | | SelectedImagePath = "Collection/CollectionIcon.png", |
| | | UnSelectedImagePath = "Collection/CollectionGrayIcon.png", |
| | | IsSelected = socketFunction.collect |
| | | IsSelected = function.collect |
| | | }; |
| | | //controlView.AddChidren(btnCollection); |
| | | //2020-12-16 å¦ææ¯æåéèæ¶èåè½ |
| | |
| | | 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", |
| | | }; |
| | |
| | | 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(); |
| | | } |
| | |
| | | /// <summary> |
| | | /// æ´æ°ç¯å
ç¶æ |
| | | /// </summary> |
| | | public static void UpdataState(SwitchSocket uFan) |
| | | public static void UpdataState(Function uFan) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | |
| | | |
| | | //åéå·æ°ä¿¡æ¯äºä»¶ |
| | | 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(); |
| | | }; |
| | | } |
| | | |
| | |
| | | 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(); |
| | | }; |
| | | } |
| | | |
| | |
| | | |
| | | 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(); |
| | | }; |
| | |
| | | |
| | | 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(); |
| | | }; |
| | |
| | | #endregion |
| | | |
| | | #region åºååé |
| | | TV tv; |
| | | TV tvTemp = new TV(); |
| | | Function function; |
| | | Button btnCollection_Out; |
| | | Button btnFunctionName_Out; |
| | | Button btnFromFloor_Out; |
| | |
| | | public TVPage(Function func) |
| | | { |
| | | bodyView = this; |
| | | tv = func as TV; |
| | | function = func; |
| | | } |
| | | |
| | | |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, |
| | | Text = tv.name, |
| | | Text = function.name, |
| | | }; |
| | | controlView.AddChidren(btnFunctionName); |
| | | |
| | |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = tv.GetRoomListName() |
| | | Text = function.GetRoomListName() |
| | | }; |
| | | controlView.AddChidren(btnFromFoorAndRoom); |
| | | |
| | |
| | | Height = Application.GetMinRealAverage(40), |
| | | SelectedImagePath = "Collection/CollectionIcon.png", |
| | | UnSelectedImagePath = "Collection/CollectionGrayIcon.png", |
| | | IsSelected = tv.collect |
| | | IsSelected = function.collect |
| | | }; |
| | | //controlView.AddChidren(btnCollection); |
| | | //2020-12-16 å¦ææ¯æåéèæ¶èåè½ |
| | |
| | | |
| | | 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); |
| | | |
| | | } |
| | | |
| | |
| | | numberView.AddChidren(btn); |
| | | btn.MouseUpEventHandler = (sender, e) => { |
| | | btn.IsSelected = false; |
| | | tv.ControlTV(i); |
| | | tvTemp.ControlTV(i,function); |
| | | }; |
| | | btn.MouseDownEventHandler = (sender, e) => { |
| | | btn.IsSelected = true; |
| | |
| | | |
| | | //åéå·æ°ä¿¡æ¯äºä»¶ |
| | | 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(); |
| | | }; |
| | | } |
| | | |
| | |
| | | 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(); |
| | | }; |
| | | } |
| | | |
| | |
| | | { |
| | | 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) => |
| | | { |
| | |
| | | }; |
| | | 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); |
| | | }; |
| | | } |
| | | |
| | |
| | | /// </summary>
|
| | | private void RefreshNowDeviceStatuMemory(Function i_LocalDevice)
|
| | | {
|
| | | foreach (var data in i_LocalDevice.status)
|
| | | for (int i = 0; i < i_LocalDevice.attributes.Count; i++)
|
| | | {
|
| | | var data = i_LocalDevice.attributes[i];
|
| | | //模å¼
|
| | | if (data.key == "mode") { this.airCleanerData.Mode = data.value; }
|
| | | if (data.key == "mode") { this.airCleanerData.Mode = data.state; }
|
| | | //é£éæ¡£ä½
|
| | | else if (data.key == "speed") { this.airCleanerData.Gear = data.value; }
|
| | | else if (data.key == "speed") { this.airCleanerData.Gear = data.state; }
|
| | | //å¼å
³
|
| | | else if (data.key == "on_off") { this.airCleanerData.Open = data.value.ToLower() == "on"; }
|
| | | else if (data.key == "on_off") { this.airCleanerData.Open = data.state.ToLower() == "on"; }
|
| | | //ç«¥é
|
| | | else if (data.key == "lock") { this.airCleanerData.Lock = data.value.ToLower() == "true"; }
|
| | | else if (data.key == "lock") { this.airCleanerData.Lock = data.state.ToLower() == "true"; }
|
| | | //滤è¯å¤ä½
|
| | | else if (data.key == "filter_reset") { this.airCleanerData.FilterReset = data.value.ToLower() == "true"; }
|
| | | else if (data.key == "filter_reset") { this.airCleanerData.FilterReset = data.state.ToLower() == "true"; }
|
| | | //è´ç¦»å
|
| | | else if (data.key == "anion") { this.airCleanerData.Anion = data.value.ToLower() == "true"; }
|
| | | else if (data.key == "anion") { this.airCleanerData.Anion = data.state.ToLower() == "true"; }
|
| | | //宿¶
|
| | | else if (data.key == "countdown")
|
| | | {
|
| | | this.airCleanerData.Timing = data.value;
|
| | | this.airCleanerData.Timing = data.state;
|
| | | if (this.airCleanerData.Timing == "cancel")
|
| | | {
|
| | | this.airCleanerData.Timing = "0";
|
| | |
| | | //空æ°è´¨é
|
| | | else if (data.key == "pm25")
|
| | | {
|
| | | var value = data.value;
|
| | | var value = data.state;
|
| | | if (value != string.Empty)
|
| | | {
|
| | | this.airCleanerData.PM25Value = Convert.ToInt32(value);
|
| | |
| | | //滤è¯ä½¿ç¨ç
|
| | | else if (data.key == "filter")
|
| | | {
|
| | | var value = data.value;
|
| | | var value = data.state;
|
| | | if (value != string.Empty)
|
| | | {
|
| | | this.airCleanerData.FilterPersent = Convert.ToInt32(value);
|
| | |
| | | /// </summary>
|
| | | private void RefreshNowDeviceStatuMemory(Function i_LocalDevice)
|
| | | {
|
| | | foreach (var data in i_LocalDevice.status)
|
| | | for (int i = 0; i < i_LocalDevice.attributes.Count; i++)
|
| | | {
|
| | | var data = i_LocalDevice.attributes[i];
|
| | | //å¼å
³
|
| | | if (data.key == "on_off") { this.fanData.Open = data.value == "on"; }
|
| | | if (data.key == "on_off") { this.fanData.Open = data.state == "on"; }
|
| | | //é£éæ¡£ä½
|
| | | else if (data.key == "fan_speed_percent")
|
| | | {
|
| | | var value = data.value;
|
| | | var value = data.state;
|
| | | if (value != string.Empty)
|
| | | {
|
| | | this.fanData.SpeedLevel = Convert.ToInt32(value);
|
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | var onoffStatu = device.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff); |
| | | var timeStatu = device.status.Find((obj) => obj.key == FunctionAttributeKey.TuyaWaterTime); |
| | | var onoffStatu = device.attributes.Find((obj) => obj.key == FunctionAttributeKey.OnOff); |
| | | var timeStatu = device.attributes.Find((obj) => obj.key == FunctionAttributeKey.TuyaWaterTime); |
| | | |
| | | if (onoffStatu != null) |
| | | { |
| | | if (onoffStatu.value.ToString() == "on") |
| | | if (onoffStatu.state == "on") |
| | | { |
| | | btnControlTip.TextID = StringId.ControllerOn; |
| | | } |
| | |
| | | } |
| | | if (timeStatu != null) |
| | | { |
| | | int.TryParse(timeStatu.value, out waterRunningTime); |
| | | int.TryParse(timeStatu.state, out waterRunningTime); |
| | | } |
| | | RefreshTimeButton(); |
| | | }); |
old mode 100755
new mode 100644
| | |
| | | dialogBody.AddChidren(menuContr);
|
| | |
|
| | | //èªå¨æ¸
æ«
|
| | | var iconPath = this.weepRobotData.Mode == "random" ? "FunctionIcon/Electrical/WeepRobot/AutoModeSelect.png" : "FunctionIcon/Electrical/WeepRobot/AutoMode.png";
|
| | | menuContr.AddRowMenu(Language.StringByID(StringId.AutoClean), iconPath, this.weepRobotData.Mode == "random", () =>
|
| | | {
|
| | | frameBack.Close();
|
| | | //å鿍¡å¼å½ä»¤
|
| | | this.SendComand("mode", "random");
|
| | | });
|
| | |
|
| | | //å®ç¹æ¸
æ«
|
| | | iconPath = this.weepRobotData.Mode == "smart" ? "FunctionIcon/Electrical/WeepRobot/FixedPointModeSelect.png" : "FunctionIcon/Electrical/WeepRobot/FixedPointMode.png";
|
| | | menuContr.AddRowMenu(Language.StringByID(StringId.FixedPointClean), iconPath, this.weepRobotData.Mode == "smart", () =>
|
| | | var iconPath = this.weepRobotData.Mode == "smart" ? "FunctionIcon/Electrical/WeepRobot/AutoModeSelect.png" : "FunctionIcon/Electrical/WeepRobot/AutoMode.png";
|
| | | menuContr.AddRowMenu(Language.StringByID(StringId.AutoClean), iconPath, this.weepRobotData.Mode == "smart", () =>
|
| | | {
|
| | | frameBack.Close();
|
| | | //å鿍¡å¼å½ä»¤
|
| | | this.SendComand("mode", "smart");
|
| | | });
|
| | |
|
| | | //åºåæ¸
æ«
|
| | | //éæºæ¸
æ«
|
| | | iconPath = this.weepRobotData.Mode == "random" ? "FunctionIcon/Electrical/WeepRobot/FixedPointModeSelect.png" : "FunctionIcon/Electrical/WeepRobot/FixedPointMode.png";
|
| | | menuContr.AddRowMenu(Language.StringByID(StringId.RandomClean), iconPath, this.weepRobotData.Mode == "random", () =>
|
| | | {
|
| | | frameBack.Close();
|
| | | //å鿍¡å¼å½ä»¤
|
| | | this.SendComand("mode", "random");
|
| | | });
|
| | |
|
| | | //èºææ¸
æ«
|
| | | iconPath = this.weepRobotData.Mode == "spiral" ? "FunctionIcon/Electrical/WeepRobot/AreaModeSelect.png" : "FunctionIcon/Electrical/WeepRobot/AreaMode.png";
|
| | | menuContr.AddRowMenu(Language.StringByID(StringId.AreaClean), iconPath, this.weepRobotData.Mode == "spiral", () =>
|
| | | menuContr.AddRowMenu(Language.StringByID(StringId.SpiralClean), iconPath, this.weepRobotData.Mode == "spiral", () =>
|
| | | {
|
| | | frameBack.Close();
|
| | | //å鿍¡å¼å½ä»¤
|
| | |
| | | }
|
| | | else if (this.weepRobotData.Mode == "smart")
|
| | | {
|
| | | //å®ç¹æ¸
æ«
|
| | | //éæºæ¸
æ«
|
| | | this.btnModeIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobot/FixedPointMode.png";
|
| | | this.btnModeIcon.SelectedImagePath = "FunctionIcon/Electrical/WeepRobot/FixedPointModeSelect.png";
|
| | | this.btnModeView.TextID = StringId.FixedPointClean;
|
| | | this.btnModeView.TextID = StringId.RandomClean;
|
| | | }
|
| | | else if (this.weepRobotData.Mode == "wall_follow")
|
| | | {
|
| | |
| | | }
|
| | | else if (this.weepRobotData.Mode == "spiral")
|
| | | {
|
| | | //åºåæ¸
æ«
|
| | | //èºææ¸
æ«
|
| | | this.btnModeIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobot/AreaMode.png";
|
| | | this.btnModeIcon.SelectedImagePath = "FunctionIcon/Electrical/WeepRobot/AreaModeSelect.png";
|
| | | this.btnModeView.TextID = StringId.AreaClean;
|
| | | this.btnModeView.TextID = StringId.SpiralClean;
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | /// </summary>
|
| | | private void RefreshNowDeviceStatuMemory(Function i_LocalDevice)
|
| | | {
|
| | | for (int i = 0; i < i_LocalDevice.status.Count; i++)
|
| | | for (int i = 0; i < i_LocalDevice.attributes.Count; i++)
|
| | | {
|
| | | var data = i_LocalDevice.status[i];
|
| | | var data = i_LocalDevice.attributes[i];
|
| | | //å¼å
³
|
| | | if (data.key == "on_off") { this.weepRobotData.Cleaning = data.value.ToLower() == "on"; }
|
| | | if (data.key == "on_off") { this.weepRobotData.Cleaning = data.state.ToLower() == "on"; }
|
| | | //å¯»æ¾æºå¨
|
| | | else if (data.key == "seek") { this.weepRobotData.SearchRobot = data.value.ToLower() == "true"; }
|
| | | else if (data.key == "seek") { this.weepRobotData.SearchRobot = data.state.ToLower() == "true"; }
|
| | | //è¾¹å·éç½®
|
| | | else if (data.key == "reset_edge_brush") { this.weepRobotData.ResetEdgeBrush = data.value.ToLower() == "true"; }
|
| | | else if (data.key == "reset_edge_brush") { this.weepRobotData.ResetEdgeBrush = data.state.ToLower() == "true"; }
|
| | | //æ»å·éç½®
|
| | | else if (data.key == "reset_roll_brush") { this.weepRobotData.ResetRollBrush = data.value.ToLower() == "true"; }
|
| | | else if (data.key == "reset_roll_brush") { this.weepRobotData.ResetRollBrush = data.state.ToLower() == "true"; }
|
| | | //滤ç½éç½®
|
| | | else if (data.key == "reset_filter") { this.weepRobotData.ResetFilter = data.value.ToLower() == "true"; }
|
| | | else if (data.key == "reset_filter") { this.weepRobotData.ResetFilter = data.state.ToLower() == "true"; }
|
| | | //å¸åéæ©
|
| | | else if (data.key == "suction") { this.weepRobotData.Suction = data.value; }
|
| | | else if (data.key == "suction") { this.weepRobotData.Suction = data.state; }
|
| | | //工使¨¡å¼
|
| | | else if (data.key == "mode") { this.weepRobotData.Mode = data.value; }
|
| | | else if (data.key == "mode") { this.weepRobotData.Mode = data.state; }
|
| | | //æ¸
æ«æ¹å
|
| | | else if (data.key == "direction_control") { this.weepRobotData.DirectionControl = data.value; }
|
| | | else if (data.key == "direction_control") { this.weepRobotData.DirectionControl = data.state; }
|
| | | //声é³å¼å
³
|
| | | else if (data.key == "voice_switch") { this.weepRobotData.VoiceSwitch = data.value.ToLower() == "true"; }
|
| | | else if (data.key == "voice_switch") { this.weepRobotData.VoiceSwitch = data.state.ToLower() == "true"; }
|
| | | //æ¸
æ«é¢ç§¯
|
| | | else if (data.key == "clean_area")
|
| | | {
|
| | | var value = data.value;
|
| | | var value = data.state;
|
| | | if (value != string.Empty)
|
| | | {
|
| | | this.weepRobotData.CleanArea = Convert.ToInt32(value);
|
| | | }
|
| | | }
|
| | | //æ¸
æ«è®°å½
|
| | | else if (data.key == "clean_record") { this.weepRobotData.CleanRecord = data.value; }
|
| | | else if (data.key == "clean_record") { this.weepRobotData.CleanRecord = data.state; }
|
| | | //è¾¹å·å¯¿å½
|
| | | else if (data.key == "edge_brush")
|
| | | {
|
| | | var value = data.value;
|
| | | var value = data.state;
|
| | | if (value != string.Empty)
|
| | | {
|
| | | this.weepRobotData.EdgeBrush = Convert.ToInt32(value);
|
| | |
| | | //æ»å·å¯¿å½
|
| | | else if (data.key == "roll_brush")
|
| | | {
|
| | | var value = data.value;
|
| | | var value = data.state;
|
| | | if (value != string.Empty)
|
| | | {
|
| | | this.weepRobotData.RollBrush = Convert.ToInt32(value);
|
| | |
| | | //滤ç½å¯¿å½
|
| | | else if (data.key == "filter")
|
| | | {
|
| | | var value = data.value;
|
| | | var value = data.state;
|
| | | if (value != string.Empty)
|
| | | {
|
| | | this.weepRobotData.Filter = Convert.ToInt32(value);
|
| | |
| | | //æ¸
æ«æ¶é´
|
| | | else if (data.key == "clean_time")
|
| | | {
|
| | | var value = data.value;
|
| | | var value = data.state;
|
| | | if (value != string.Empty)
|
| | | {
|
| | | this.weepRobotData.CleanTime = Convert.ToInt32(value);
|
| | |
| | | //å©ä½çµé
|
| | | else if (data.key == "electricity_left")
|
| | | {
|
| | | var value = data.value;
|
| | | var value = data.state;
|
| | | if (value != string.Empty)
|
| | | {
|
| | | this.weepRobotData.ElectricityLeft = Convert.ToInt32(value);
|
| | |
| | | /// </summary>
|
| | | public string Suction = string.Empty;
|
| | | /// <summary>
|
| | | /// 工使¨¡å¼(random:èªå¨æ¸
æ« smart:å®ç¹æ¸
æ« wall_follow:æ²¿å¢æ¸
æ« spiral:åºåæ¸
æ« chargego:å
çµ)
|
| | | /// 工使¨¡å¼(smart:èªå¨æ¸
æ« random:éæºæ¸
æ« wall_follow:æ²¿å¢æ¸
æ« spiral:èºææ¸
æ« chargego:å
çµ)
|
| | | /// </summary>
|
| | | public string Mode = string.Empty;
|
| | | /// <summary>
|
| | |
| | | #region åºååé |
| | | Room room; |
| | | |
| | | Sensor sensorTemp = new Sensor(); |
| | | #endregion |
| | | |
| | | |
| | |
| | | |
| | | #region æ¿é´é¡¶é¨åæ¢æ¾ç¤ºåºå |
| | | room = new Room() { roomName = Language.StringByID(StringId.All)}; |
| | | //if (DB_ResidenceData.rooms.Count > 0) |
| | | //{ |
| | | // room = DB_ResidenceData.rooms[0]; |
| | | //} |
| | | btnFoorDownIcon = new Button() |
| | | { |
| | | Width = Application.GetMinRealAverage(16), |
| | |
| | | { |
| | | sensorListView.RemoveAll(); |
| | | int index = 0; |
| | | foreach (var sensor in FunctionList.List.sensorsEnvironmentalScience) |
| | | foreach (var sensor in FunctionList.List.GetEnvirSensorsList()) |
| | | { |
| | | LoadSensorDiv(sensor, index); |
| | | index++; |
| | |
| | | /// <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; |
| | |
| | | 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), |
| | |
| | | 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); |
| | | btnSensorTitle.MouseUpEventHandler = (sender, e) => { |
| | | return; |
| | | #region F3é¶æ®µ |
| | | //var esp = new EnvironmentalSensorPage(sensor); |
| | | //MainPage.BasePageView.AddChidren(esp); |
| | | //esp.LoadPage(); |
| | | //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | #region |
| | | var esp = new EnvironmentalSensorPage(sensor); |
| | | MainPage.BasePageView.AddChidren(esp); |
| | | esp.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | #endregion |
| | | }; |
| | | |
| | |
| | | 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); |
| | |
| | | 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); |
| | |
| | | /// <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(); |
| | |
| | | { |
| | | 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, |
| | |
| | | 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() |
| | | { |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | IsBold = true, |
| | | Text = sensor.intervalValue[index] |
| | | Text = sensorTemp.GetIntervalValue(sensor.spk)[index] |
| | | }); |
| | | |
| | | subInfoView.AddChidren(new Button() |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | IsBold = true, |
| | | TextID = sensor.levelTextList[index] |
| | | TextID = levelTextList[index] |
| | | }); |
| | | |
| | | subInfoView.AddChidren(new Button() |
| | |
| | | Width = Application.GetRealWidth(38), |
| | | Height = Application.GetRealHeight(18), |
| | | Radius = (uint)Application.GetRealWidth(4), |
| | | BackgroundColor = sensor.levelColorList[index] |
| | | BackgroundColor = levelColorList[index] |
| | | }); |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | 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)) |
| | | { |
| | |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | MyEchartsViewOn myEchartsView; |
| | | |
| | | Sensor sensor; |
| | | Sensor sensorTemp = new Sensor(); |
| | | |
| | | List<Sensor> showSensors; |
| | | Function function; |
| | | List<Function> showFunctions; |
| | | /// <summary> |
| | | /// å½åæ¥è¯¢ç±»å |
| | | /// </summary> |
| | | QueryType curQueryType = QueryType.NowDay; |
| | | string curQueryType = "hour"; |
| | | |
| | | List<uint> tipColorList = new List<uint>() |
| | | { |
| | |
| | | "#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() |
| | |
| | | }; |
| | | diagramView.AddChidren(tipTextView); |
| | | |
| | | switch (sensor.spk) |
| | | switch (function.spk) |
| | | { |
| | | case SPK.SensorPm25: |
| | | tipValuesView.AddChidren(new Button() |
| | |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Text = sensor.name, |
| | | Text = function.name, |
| | | IsBold = true, |
| | | }; |
| | | selfInfoView.AddChidren(btnSeltSensorName); |
| | |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = sensor.GetRoomListName() |
| | | Text = function.GetRoomListName() |
| | | }; |
| | | selfInfoView.AddChidren(btnFromFoorAndRoom); |
| | | |
| | |
| | | { |
| | | 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; |
| | |
| | | |
| | | 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; |
| | | } |
| | |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Text = sensor.name, |
| | | Text = function.name, |
| | | IsBold = true, |
| | | }; |
| | | otherInfoView.AddChidren(btnSensorName); |
| | |
| | | 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(); |
| | |
| | | |
| | | } |
| | | #endregion |
| | | new TopViewDiv(bodyView, Language.StringByID(sensor.functionTypeNameId)).LoadTopView(); |
| | | new TopViewDiv(bodyView, Language.StringByID(sensorTemp.GetFunctionTypeNameId(function.spk))).LoadTopView(); |
| | | |
| | | LoadMothed_GetSensorHistoryData(); |
| | | LoadEvent_ChangeSensorHistoryShowType(); |
| | |
| | | //------------ |
| | | public partial class EnvironmentalSensorPage |
| | | { |
| | | public enum QueryType |
| | | { |
| | | NowDay = 0,//å½å¤© |
| | | NowMonth = 1,//æå®æ |
| | | NowYear = 2,//ä»å¹´ |
| | | LatelySevenDay = 3//æè¿ä¸å¤© |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读åä¼ æå¨å岿°æ® |
| | | /// </summary> |
| | |
| | | Application.RunOnMainThread(() => { |
| | | loadPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | }); |
| | | var curMonth = 0; |
| | | if(curQueryType == QueryType.NowMonth) |
| | | { |
| | | curMonth = DateTime.Now.Month; |
| | | } |
| | | int i = 0; |
| | | |
| | | //#if DEBUG |
| | | // var sItem = new EchartSeriesItem |
| | | // { |
| | | // name = sensor.GetRoomListName(), |
| | | // data = new List<int>(), |
| | | // lineStyle = new EchartLineStyle() |
| | | // { |
| | | // color = tipColorStringList[i], |
| | | //#if __IOS__ |
| | | // width = 5, |
| | | //#elif __ANDROID__ |
| | | // width = 2, |
| | | //#endif |
| | | // }, |
| | | // }; |
| | | // Random random = new Random(); |
| | | // double level = 0.0; |
| | | // int countddd = 24; |
| | | // for (int j = 0; j < countddd; j++) |
| | | // { |
| | | // switch (sensor.functionType) |
| | | // { |
| | | // case SPK.SensorPm25: |
| | | // level = Math.Round(random.NextDouble() * 130, 0); |
| | | // break; |
| | | // case SPK.SensorCO2: |
| | | // level = Math.Round(random.NextDouble() * 6000, 0); |
| | | // break; |
| | | // case SPK.SensorTemperature: |
| | | // level = Math.Round(random.NextDouble() * 40, 0); |
| | | // break; |
| | | // case SPK.SensorTVOC: |
| | | // level = Math.Round(random.NextDouble() * 10, 1); |
| | | // break; |
| | | // case SPK.SensorHumidity: |
| | | // level = Math.Round(random.NextDouble() * 100, 0); |
| | | // break; |
| | | // } |
| | | // sItem.data.Add((int)level); |
| | | // } |
| | | // seriesList.Add(sItem); |
| | | // echartRootJson.series = seriesList; |
| | | //#if __IOS__ |
| | | // echartRootJson.xAxis.axisLabel.fontSize = 22; |
| | | // echartRootJson.yAxis.axisLabel.fontSize = 22; |
| | | //#else |
| | | // echartRootJson.xAxis.axisLabel.fontSize = 8; |
| | | // echartRootJson.yAxis.axisLabel.fontSize = 8; |
| | | //#endif |
| | | // echartRootJsonString = Newtonsoft.Json.JsonConvert.SerializeObject(echartRootJson); |
| | | // Application.RunOnMainThread(() => |
| | | // { |
| | | // myEchartsView.ShowWithOptionJsonString(echartRootJsonString); |
| | | // }); |
| | | //#endif |
| | | |
| | | 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; |
| | | } |
| | | |
| | | byte sensorType = 0; |
| | | switch (sr.spk) |
| | | { |
| | | case SPK.SensorTemperature: |
| | | sensorType = 2; |
| | | break; |
| | | case SPK.SensorHumidity: |
| | | sensorType = 3; |
| | | break; |
| | | case SPK.SensorTVOC: |
| | | sensorType = 5; |
| | | break; |
| | | case SPK.SensorPm25: |
| | | sensorType = 6; |
| | | break; |
| | | case SPK.SensorCO2: |
| | | sensorType = 7; |
| | | break; |
| | | } |
| | | var revertObj = new HttpServerRequest().GetSensorHistory(sr.bus.SubnetID, sr.bus.DeviceID, |
| | | 5, sensorType, (int)curQueryType, sr.bus.LoopId, curMonth, |
| | | DB_ResidenceData.Instance.residenceGatewayMAC); |
| | | var sensorType = sr.spk.Split(".")[0]; |
| | | var revertObj = new HttpServerRequest().GetSensorHistory(curQueryType, sr.deviceId,sensorType); |
| | | |
| | | if (revertObj != null) |
| | | { |
| | | if (revertObj.StateCode == StateCode.SUCCESS) |
| | | if (revertObj.Code == StateCode.SUCCESS) |
| | | { |
| | | var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SensorPushHistoryRes>>(revertObj.ResponseData.ToString()); |
| | | var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<EnvironmentalSensorHistor>>(revertObj.Data.ToString()); |
| | | |
| | | var sItem = new EchartSeriesItem |
| | | { |
| | |
| | | }, |
| | | }; |
| | | |
| | | int ass = 0; |
| | | for (int j = 0; j < revertData.Count; j++) |
| | | foreach (var d in revertData) |
| | | { |
| | | if (curQueryType == QueryType.NowMonth && revertData[j].CreatedOnUtc.Day > DateTime.Now.Day) |
| | | { |
| | | continue; |
| | | } |
| | | if (revertData[j].TargetValue.ToString() != "NaN") |
| | | { |
| | | ass = Convert.ToInt32(revertData[j].TargetValue); |
| | | } |
| | | else |
| | | { |
| | | ass = 0; |
| | | } |
| | | sItem.data.Add(ass); |
| | | switch (curQueryType) |
| | | { |
| | | case QueryType.NowDay: |
| | | echartRootJson.xAxis.data.Add(revertData[j].CreatedOnUtc.Hour.ToString()); |
| | | break; |
| | | case QueryType.LatelySevenDay: |
| | | echartRootJson.xAxis.data.Add(System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(revertData[j].CreatedOnUtc.DayOfWeek)); |
| | | break; |
| | | case QueryType.NowMonth: |
| | | echartRootJson.xAxis.data.Add(revertData[j].CreatedOnUtc.Day.ToString()); |
| | | break; |
| | | } |
| | | echartRootJson.xAxis.data.Add(d.fieldName); |
| | | echartRootJson.yAxis.data.Add(d.fieldValue); |
| | | } |
| | | seriesList.Add(sItem); |
| | | } |
| | |
| | | btnShowHistroyData_Day.IsSelected = true; |
| | | btnShowHistroyData_Month.IsSelected = false; |
| | | btnShowHistroyData_Week.IsSelected = false; |
| | | curQueryType = QueryType.NowDay; |
| | | curQueryType = "hour"; |
| | | LoadMothed_GetSensorHistoryData(); |
| | | }; |
| | | |
| | |
| | | btnShowHistroyData_Day.IsSelected = false; |
| | | btnShowHistroyData_Month.IsSelected = true; |
| | | btnShowHistroyData_Week.IsSelected = false; |
| | | curQueryType = QueryType.NowMonth; |
| | | curQueryType = "week"; |
| | | LoadMothed_GetSensorHistoryData(); |
| | | }; |
| | | btnShowHistroyData_Week.MouseUpEventHandler = (sender, e) => |
| | |
| | | btnShowHistroyData_Day.IsSelected = false; |
| | | btnShowHistroyData_Month.IsSelected = false; |
| | | btnShowHistroyData_Week.IsSelected = true; |
| | | curQueryType = QueryType.LatelySevenDay; |
| | | curQueryType = "month"; |
| | | LoadMothed_GetSensorHistoryData(); |
| | | }; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | public class SensorPushHistoryRes |
| | | public class EnvironmentalSensorHistor |
| | | { |
| | | /// <summary> |
| | | /// </summary> |
| | | public string fieldName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å®é
ç®æ å¼ |
| | | /// </summary> |
| | | public float TargetValue { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¥è¯¢çæ¶é´é群 |
| | | /// </summary> |
| | | public DateTime CreatedOnUtc { get; set; } |
| | | public string fieldValue { get; set; } |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | Button btnCollection; |
| | | /// <summary> |
| | | /// ç©ºè°æ¸©åº¦æ§å¶æ§ä»¶ |
| | | /// 温度æ§å¶æ§ä»¶ |
| | | /// </summary> |
| | | DiyArcSeekBar arcBar; |
| | | /// <summary> |
| | |
| | | #endregion |
| | | |
| | | #region åºååé |
| | | FloorHeating fh; |
| | | FloorHeating fhTemp = new FloorHeating(); |
| | | Function function; |
| | | Button btnCollection_Out; |
| | | Button btnFunctionName_Out; |
| | | Button btnFromFloor_Out; |
| | |
| | | /// </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) |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, |
| | | Text = fh.name, |
| | | Text = function.name, |
| | | }; |
| | | controlView.AddChidren(btnFunctionName); |
| | | |
| | |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = fh.GetRoomListName() |
| | | Text = function.GetRoomListName() |
| | | }; |
| | | controlView.AddChidren(btnFromFoorAndRoom); |
| | | |
| | |
| | | Height = Application.GetMinRealAverage(40), |
| | | SelectedImagePath = "Collection/CollectionIcon.png", |
| | | UnSelectedImagePath = "Collection/CollectionGrayIcon.png", |
| | | IsSelected = fh.collect |
| | | IsSelected = function.collect |
| | | }; |
| | | //controlView.AddChidren(btnCollection); |
| | | //2020-12-16 å¦ææ¯æåéèæ¶èåè½ |
| | |
| | | { |
| | | 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), |
| | |
| | | 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); |
| | |
| | | TextSize = CSS_FontSize.EmphasisFontSize_Secondary, |
| | | IsBold = true, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = fh.tempUnitString |
| | | Text = fhTemp.GetTempUnitString(function) |
| | | }; |
| | | controlView.AddChidren(btnTempUint); |
| | | |
| | |
| | | Y = Application.GetRealHeight(337), |
| | | Width = Application.GetRealWidth(30), |
| | | Height = Application.GetRealWidth(30), |
| | | UnSelectedImagePath = fh.curModeImage, |
| | | UnSelectedImagePath = fhTemp.GetModeImage(function) |
| | | }; |
| | | controlView.AddChidren(btnMode); |
| | | |
| | |
| | | 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(); |
| | | } |
| | |
| | | }; |
| | | 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); |
| | | |
| | |
| | | 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() |
| | | { |
| | |
| | | public partial class FloorHeatingPage |
| | | { |
| | | |
| | | public static void UpdataStates(FloorHeating uFh) |
| | | public static void UpdataStates(Function updateTemp) |
| | | { |
| | | try |
| | | { |
| | |
| | | { |
| | | 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; |
| | |
| | | //åéå·æ°ä¿¡æ¯äºä»¶ |
| | | 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); |
| | | }; |
| | | } |
| | | |
| | |
| | | { |
| | | 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(); |
| | | }; |
| | | } |
| | | |
| | |
| | | { |
| | | 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> |
| | |
| | | { |
| | | btnMode.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (fh.trait_on_off.curValue.ToString() == "off") |
| | | if (function.trait_on_off.curValue.ToString() == "off") |
| | | { |
| | | return; |
| | | } |
| | |
| | | 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"; |
| | |
| | | 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); |
| | | |
| | | }; |
| | | } |
| | |
| | | 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; |
| | |
| | | #endregion
|
| | |
|
| | | #region åºååé
|
| | | Light light;
|
| | | Light lightTemp = new Light();
|
| | | Function function;
|
| | | Button btnCollection_Out;
|
| | | Button btnFunctionName_Out;
|
| | | Button btnFromFloor_Out;
|
| | |
| | | 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)
|
| | |
| | | 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()
|
| | | {
|
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor,
|
| | | TextAlignment = TextAlignment.CenterLeft,
|
| | | TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
|
| | | Text = light.name,
|
| | | Text = function.name,
|
| | | };
|
| | | controlView.AddChidren(btnFunctionName);
|
| | |
|
| | |
| | | TextColor = CSS_Color.PromptingColor1,
|
| | | TextAlignment = TextAlignment.CenterLeft,
|
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
| | | Text = light.GetRoomListName()
|
| | | Text = function.GetRoomListName()
|
| | | };
|
| | | controlView.AddChidren(btnFromFoorAndRoom);
|
| | |
|
| | |
| | | Height = Application.GetMinRealAverage(40),
|
| | | SelectedImagePath = "Collection/CollectionIcon.png",
|
| | | UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
|
| | | IsSelected = light.collect
|
| | | IsSelected = function.collect
|
| | | };
|
| | | //controlView.AddChidren(btnCollection);
|
| | | //2020-12-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);
|
| | | }
|
| | |
| | | {
|
| | | 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);
|
| | |
|
| | |
| | | //æ¾ç¤ºä¸æ¹çTxt
|
| | | 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");
|
| | |
| | | // ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
| | | // ProgressBarUnitSring = "s",
|
| | | // MaxValue = 10,
|
| | | // Progress = light.fadeTime,
|
| | | // Progress = function.fadeTime,
|
| | | // SeekBarPadding = Application.GetRealWidth(20),
|
| | | //};
|
| | | //controlView.AddChidren(barFadeTime);
|
| | |
| | | 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);
|
| | |
|
| | |
| | |
|
| | | 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();
|
| | | }
|
| | |
| | |
|
| | | var dialogBody = new FrameLayout(); |
| | | frameBack.AddChidren(dialogBody); |
| | | dialogBody.MouseUpEventHandler = (sender, e) => { |
| | | dialogBody.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | frameBack.Close(); |
| | | }; |
| | |
|
| | |
| | | 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
|
| | |
| | | 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";
|
| | |
| | | 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";
|
| | | };
|
| | |
|
| | |
| | | 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";
|
| | | };
|
| | |
|
| | |
| | | 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
|
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | /// <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");
|
| | |
| | | {
|
| | | MainPage.Log($"{bodyView.GetType().Name } UpdataStates error : {ex.Message}");
|
| | | }
|
| | | }));
|
| | | });
|
| | | }
|
| | |
|
| | | void LoadEventList()
|
| | |
| | | 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>
|
| | |
| | | {
|
| | | //barFadeTime.OnStopTrackingTouchEvent = (sender, e) =>
|
| | | //{
|
| | | // light.fadeTime = e;
|
| | | // light.SaveFunctionData(true);
|
| | | // function.fadeTime = e;
|
| | | // function.SaveFunctionData(true);
|
| | | //};
|
| | | }
|
| | |
|
| | |
| | | { |
| | | //设置èªå®ä¹çææ¬ |
| | | 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();
|
| | |
| | | |
| | | 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); |
| | | };
|
| | |
|
| | | }
|
| | |
| | | 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();
|
| | | };
|
| | | }
|
| | |
|
| | |
| | | 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); |
| | |
| | | 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 + "%";
|
| | |
| | | {
|
| | | btnSwitch.MouseUpEventHandler += (sender, e) =>
|
| | | {
|
| | | //light.fadeTime = barFadeTime.Progress;
|
| | | //function.fadeTime = barFadeTime.Progress;
|
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected;
|
| | | if (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(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();
|
| | | };
|
| | |
| | | #endregion |
| | | |
| | | #region åºååé |
| | | Light light; |
| | | Light lightTemp = new Light(); |
| | | Function function; |
| | | Button btnCollection_Out; |
| | | Button btnFunctionName_Out; |
| | | Button btnFromFloor_Out; |
| | |
| | | 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) |
| | |
| | | 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() |
| | | { |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, |
| | | Text = light.name, |
| | | Text = function.name, |
| | | }; |
| | | controlView.AddChidren(btnFunctionName); |
| | | |
| | |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = light.GetRoomListName() |
| | | Text = function.GetRoomListName() |
| | | }; |
| | | controlView.AddChidren(btnFromFoorAndRoom); |
| | | |
| | |
| | | Height = Application.GetMinRealAverage(40), |
| | | SelectedImagePath = "Collection/CollectionIcon.png", |
| | | UnSelectedImagePath = "Collection/CollectionGrayIcon.png", |
| | | IsSelected = light.collect |
| | | IsSelected = function.collect |
| | | }; |
| | | //controlView.AddChidren(btnCollection); |
| | | //2020-12-16 å¦ææ¯æåéèæ¶èåè½ |
| | |
| | | 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); |
| | | } |
| | |
| | | { |
| | | 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, |
| | |
| | | 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); |
| | | |
| | |
| | | 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); |
| | | |
| | |
| | | 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); |
| | | |
| | |
| | | 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); |
| | | |
| | |
| | | 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 |
| | |
| | | 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(); |
| | | } |
| | |
| | | /// <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) |
| | |
| | | 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> |
| | |
| | | { |
| | | barFadeTime.OnStopTrackingTouchEvent = (sender, e) => |
| | | { |
| | | light.fadeTime = e; |
| | | light.UpdataFuncitonInfo(); |
| | | function.SetAttrState(FunctionAttributeKey.FadeTime, e.ToString()); |
| | | function.UpdataFuncitonInfo(); |
| | | }; |
| | | } |
| | | |
| | |
| | | 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(); |
| | | }; |
| | | } |
| | | |
| | |
| | | }; |
| | | 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(); |
| | | // } |
| | |
| | | { |
| | | btnSwitch.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | light.fadeTime = barFadeTime.Progress; |
| | | function.SetAttrState(FunctionAttributeKey.FadeTime, barFadeTime.Progress); |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | if (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(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(); |
| | | }; |
| | |
| | | #endregion |
| | | |
| | | #region åºååé |
| | | Light light; |
| | | Light lightTemp; |
| | | Button btnCollection_Out; |
| | | Button btnFunctionName_Out; |
| | | Button btnFromFloor_Out; |
| | | bool onDimmerBar = false; |
| | | Function function; |
| | | /// <summary> |
| | | /// å·æ°æ¾ç¤ºä¿¡æ¯ |
| | | /// </summary> |
| | |
| | | public RGBPage(Function func) |
| | | { |
| | | bodyView = this; |
| | | light = func as Light; |
| | | function = func; |
| | | } |
| | | |
| | | public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut) |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, |
| | | Text = light.name, |
| | | Text = function.name, |
| | | }; |
| | | controlView.AddChidren(btnFunctionName); |
| | | |
| | |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = light.GetRoomListName() |
| | | Text = function.GetRoomListName() |
| | | }; |
| | | controlView.AddChidren(btnFromFoorAndRoom); |
| | | |
| | |
| | | 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); |
| | | |
| | |
| | | Height = Application.GetMinRealAverage(40), |
| | | SelectedImagePath = "Collection/CollectionIcon.png", |
| | | UnSelectedImagePath = "Collection/CollectionGrayIcon.png", |
| | | IsSelected = light.collect |
| | | IsSelected = function.collect |
| | | }; |
| | | //controlView.AddChidren(btnCollection); |
| | | //2020-12-16 å¦ææ¯æåéèæ¶èåè½ |
| | |
| | | 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"; |
| | | } |
| | |
| | | |
| | | 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), |
| | |
| | | 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); |
| | |
| | | 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); |
| | | |
| | |
| | | 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); |
| | | |
| | |
| | | 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 |
| | |
| | | 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(); |
| | | } |
| | |
| | | /// <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") |
| | | { |
| | | //è§£å³é¨åå®åææºï¼å·æ°å¾çæ¶ä¼åå°é®é¢ |
| | | if (bodyView.colorPicker.ColorImagePath != "FunctionIcon/Light/ColorWheel.png") |
| | |
| | | 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) |
| | | { |
| | | //è§£å³é¨åå®åææºï¼å·æ°å¾çæ¶ä¼åå°é®é¢ |
| | | if (bodyView.colorPicker.ColorImagePath != "FunctionIcon/Light/ColorWheelGray.png") |
| | |
| | | //è²ççåç¹éè |
| | | 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; |
| | | } |
| | |
| | | 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(); |
| | | }; |
| | | } |
| | | |
| | |
| | | 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:ç¹çåºå䏿¯åçå
|
| | |
| | | } |
| | | 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; |
| | | } |
| | |
| | | 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(); |
| | | }; |
| | | } |
| | | |
| | |
| | | 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(); |
| | | // } |
| | |
| | | { |
| | | barFadeTime.OnStopTrackingTouchEvent = (sender, e) => |
| | | { |
| | | light.fadeTime = barFadeTime.Progress; |
| | | light.UpdataFuncitonInfo(); |
| | | function.SetAttrState(FunctionAttributeKey.FadeTime, barFadeTime.Progress); |
| | | function.UpdataFuncitonInfo(); |
| | | }; |
| | | } |
| | | /// <summary> |
| | |
| | | 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(); |
| | | }; |
| | |
| | | { |
| | | 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); |
| | | }; |
| | | } |
| | | |
| | |
| | | #endregion |
| | | |
| | | #region åºååé |
| | | Light light; |
| | | Light lightTemp = new Light(); |
| | | Function function; |
| | | Button btnCollection_Out; |
| | | Button btnFunctionName_Out; |
| | | Button btnFromFloor_Out; |
| | |
| | | Action actionRefresh; |
| | | #endregion |
| | | |
| | | public RelayPage(Light func) |
| | | public RelayPage(Function func) |
| | | { |
| | | bodyView = this; |
| | | light = func; |
| | | function = func; |
| | | |
| | | } |
| | | /// <summary> |
| | |
| | | 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() |
| | | { |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, |
| | | Text = light.name, |
| | | Text = function.name, |
| | | }; |
| | | controlView.AddChidren(btnFunctionName); |
| | | |
| | |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = light.GetRoomListName() |
| | | Text = function.GetRoomListName() |
| | | }; |
| | | controlView.AddChidren(btnFromFoorAndRoom); |
| | | |
| | |
| | | Height = Application.GetMinRealAverage(40), |
| | | SelectedImagePath = "Collection/CollectionIcon.png", |
| | | UnSelectedImagePath = "Collection/CollectionGrayIcon.png", |
| | | IsSelected = light.collect |
| | | IsSelected = function.collect |
| | | }; |
| | | //controlView.AddChidren(btnCollection); |
| | | //2020-12-16 å¦ææ¯æåéèæ¶èåè½ |
| | |
| | | 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); |
| | | |
| | |
| | | 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(); |
| | | } |
| | |
| | | /// <summary> |
| | | /// æ´æ°ç¯å
ç¶æ |
| | | /// </summary> |
| | | public static void UpdataState(Light uLight) |
| | | public static void UpdataState(Function updataTemp) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | |
| | | { |
| | | 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) |
| | | { |
| | |
| | | |
| | | //åéå·æ°ä¿¡æ¯äºä»¶ |
| | | 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); |
| | | }; |
| | | } |
| | | |
| | |
| | | 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(); |
| | | }; |
| | | } |
| | | |
| | |
| | | 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(); |
| | | }; |
| | |
| | | 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(); |
| | | }; |