From 4f2dbd1f6a1ec2d9c3c39b4a37b0b7c9ddece4aa Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期四, 23 九月 2021 15:24:01 +0800
Subject: [PATCH] 主页刷新优化

---
 HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs       |   13 ++++--
 HDL-ON_Android/Properties/AndroidManifest.xml |    2 
 HDL-ON_iOS/Info.plist                         |    4 +-
 HDL_ON/UI/UI2/1-HomePage/HomePage.cs          |   23 ++++++++++-
 HDL_ON/Common/ApiUtlis.cs                     |    4 +
 HDL_ON/DAL/DriverLayer/Packet.cs              |   27 +++++++------
 .vs/HDL_APP_Project/xs/UserPrefs.xml          |   41 +++++++++++++-------
 HDL_ON/DAL/DriverLayer/Control.cs             |    1 
 HDL_ON/UI/MainPage.cs                         |    2 
 9 files changed, 76 insertions(+), 41 deletions(-)

diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml
index 48216ee..99e471b 100644
--- a/.vs/HDL_APP_Project/xs/UserPrefs.xml
+++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,25 +1,34 @@
-锘�<Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default">
-  <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008020-000404163432002E" />
+锘�<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default">
+  <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget" />
   <MonoDevelop.Ide.Workbench>
     <Files>
-      <File FileName="HDL_ON/UI/MainPage.cs" Line="28" Column="56" />
-      <File FileName="HDL_ON/DAL/Server/HttpUtil.cs" />
-      <File FileName="HDL_ON/UI/UI1-Login/LoginPage.cs" />
-      <File FileName="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs" />
+      <File FileName="HDL_ON/DAL/Server/HttpUtil.cs" Line="15" Column="40" />
+      <File FileName="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs" />
+      <File FileName="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs" />
+      <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionControlZone.cs" />
+      <File FileName="HDL_ON/Entity/Enumerative/Command.cs" />
+      <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" />
+      <File FileName="HDL_ON/UI/MainPage.cs" />
       <File FileName="HDL-ON_iOS/Info.plist" />
-      <File FileName="HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs" Line="758" Column="16" />
+      <File FileName="HDL_ON/DAL/DriverLayer/Packet.cs" Line="310" Column="62" />
+      <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs" Line="316" Column="28" />
     </Files>
     <Pads>
       <Pad Id="ProjectPad">
         <State name="__root__">
           <Node name="HDL_APP_Project" expanded="True">
-            <Node name="HDL_ON" expanded="True">
-              <Node name="DAL" expanded="True">
-                <Node name="ThirdPartySdk" expanded="True" />
-              </Node>
-            </Node>
-            <Node name="HDL-ON_iOS" selected="True" />
+            <Node name="HDL-ON_Android" selected="True" />
+            <Node name="HDL-ON_iOS" expanded="True" />
           </Node>
+        </State>
+      </Pad>
+      <Pad Id="MonoDevelop.Debugger.WatchPad">
+        <State>
+          <Value>state</Value>
+          <Value>result.Message</Value>
+          <Value>Config.Instance.Home.Name</Value>
+          <Value>houseInfo.HomeName</Value>
+          <Value>this.changeGateway</Value>
         </State>
       </Pad>
     </Pads>
@@ -30,8 +39,8 @@
     <String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String>
     <String>Shared.IOS/Shared.IOS.csproj</String>
   </DisabledProjects>
-  <MonoDevelop.Ide.Workspace ActiveConfiguration="Release|iPhone" />
-  <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.364c4b3158493098" />
+  <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
+  <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.2ffc9a07" />
   <MonoDevelop.Ide.DebuggingService.Breakpoints>
     <BreakpointStore>
       <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs" line="42" column="1" />
@@ -49,6 +58,8 @@
       <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/Server/HttpServerRequest.cs" relfile="HDL_ON/DAL/Server/HttpServerRequest.cs" line="2144" column="1" />
       <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchPage.cs" line="244" column="1" />
       <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs" line="148" column="1" />
+      <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs" line="865" column="1" />
+      <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/1-HomePage/HomePage.cs" relfile="HDL_ON/UI/UI2/1-HomePage/HomePage.cs" line="749" column="1" />
     </BreakpointStore>
   </MonoDevelop.Ide.DebuggingService.Breakpoints>
   <MultiItemStartupConfigurations />
diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml
index ae5d611..0f48627 100644
--- a/HDL-ON_Android/Properties/AndroidManifest.xml
+++ b/HDL-ON_Android/Properties/AndroidManifest.xml
@@ -1,5 +1,5 @@
 锘�<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202109151" android:versionName="1.2.202109151" package="com.hdl.onpro">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202109232" android:versionName="1.2.202109232" package="com.hdl.onpro">
 	<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="28" />
 	<!-- 涔愭鍙瀵硅闇�瑕佺殑鏉冮檺 -->
 	<!--<uses-permission android:name="android.permission.INTERNET" />-->
diff --git a/HDL-ON_iOS/Info.plist b/HDL-ON_iOS/Info.plist
index 9e1f4f5..0e6ff11 100644
--- a/HDL-ON_iOS/Info.plist
+++ b/HDL-ON_iOS/Info.plist
@@ -100,9 +100,9 @@
 	<key>UIStatusBarStyle</key>
 	<string>UIStatusBarStyleLightContent</string>
 	<key>CFBundleShortVersionString</key>
-	<string>1.2.202109161</string>
+	<string>1.2.202109231</string>
 	<key>CFBundleVersion</key>
-	<string>1.2.09161</string>
+	<string>1.2.09231</string>
 	<key>NSLocationWhenInUseUsageDescription</key>
 	<string>Use geographic location to provide services such as weather</string>
 	<key>NSAppleMusicUsageDescription</key>
diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs
index 9786858..d03d275 100644
--- a/HDL_ON/Common/ApiUtlis.cs
+++ b/HDL_ON/Common/ApiUtlis.cs
@@ -56,7 +56,9 @@
 
             return result;
         }
-
+        /// <summary>
+        /// 涓嬭浇鏁版嵁瀹屾垚鏍囪
+        /// </summary>
         public bool DownloadDataComplete = true;
         /// <summary>
         /// 涓嬭浇鏁版嵁
diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index f05e584..0efa582 100644
--- a/HDL_ON/DAL/DriverLayer/Control.cs
+++ b/HDL_ON/DAL/DriverLayer/Control.cs
@@ -875,7 +875,6 @@
                         }
 
                         //鏇存柊鐣岄潰鐘舵��
-                        Function localObj = null;
                         switch (localFunction.spk)
                         {
                             case SPK.AirSwitch:
diff --git a/HDL_ON/DAL/DriverLayer/Packet.cs b/HDL_ON/DAL/DriverLayer/Packet.cs
index 60a593d..173d521 100644
--- a/HDL_ON/DAL/DriverLayer/Packet.cs
+++ b/HDL_ON/DAL/DriverLayer/Packet.cs
@@ -133,7 +133,7 @@
                             {
                                 if (updataObj.spk != SPK.LightRGB)
                                 {
-                                    updataObj.trait_on_off.curValue = receiveBytes[2] > 0 ? "on" : "off";
+                                    updataObj.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[2] > 0 ? "on" : "off");
                                     if (updataObj.trait_on_off.curValue.ToString() == "on")
                                     {
                                         switch (updataObj.spk)
@@ -177,7 +177,7 @@
                             {
                                 if (light.spk != SPK.LightRGB)
                                 {
-                                    light.trait_on_off.curValue = receiveBytes[light.bus.LoopId] == 0 ? "off" : "on";
+                                    light.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[light.bus.LoopId] == 0 ? "off" : "on");
                                     if (light.trait_on_off.curValue.ToString() == "on")
                                     {
                                         light.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[i+1].ToString());
@@ -234,7 +234,7 @@
                             {
                                 if (lightTeme.spk == SPK.LightRGB)
                                 {
-                                    lightTeme.trait_on_off.curValue = receiveBytes[1] > 0 ? "on" : "off";
+                                    lightTeme.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[1] > 0 ? "on" : "off");
                                     if (receiveBytes[1] > 0)
                                     {
                                         lightTeme.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[1].ToString());
@@ -249,7 +249,7 @@
                                     RGBPage.UpdataStates(lightTeme);
                                 }else if(lightTeme.spk == SPK.LightCCT)
                                 {
-                                    lightTeme.trait_on_off.curValue = receiveBytes[1] > 0 ? "on" : "off";
+                                    lightTeme.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[1] > 0 ? "on" : "off");
                                     if (receiveBytes[1] > 0)
                                     {
                                         lightTeme.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[1].ToString());
@@ -276,11 +276,11 @@
                                 {
                                     if (receiveBytes[1] > 1)
                                     {
-                                        curtain.trait_on_off.curValue = "on";
+                                        curtain.SetAttrState(FunctionAttributeKey.OnOff, "on");
                                     }
                                     else
                                     {
-                                        curtain.trait_on_off.curValue = "off";
+                                        curtain.SetAttrState(FunctionAttributeKey.OnOff, "off");
                                     }
                                     curtain.SetAttrState(FunctionAttributeKey.Percent, receiveBytes[1].ToString());
                                     curtain.lastState = Language.StringByID(StringId.Open) + curtain.GetAttrState(FunctionAttributeKey.Percent) + "%";
@@ -292,14 +292,15 @@
                                     switch (receiveBytes[1])
                                     {
                                         case 0:
-                                            curtain.trait_on_off.curValue = "stop";
-                                            break;
+                                            curtain.SetAttrState(FunctionAttributeKey.OnOff, "stop");
+                                            return;
                                         case 1:
-                                            curtain.trait_on_off.curValue = "on";
+                                            curtain.SetAttrState(FunctionAttributeKey.OnOff, "on");
+                                            //curtain.
                                             curtain.lastState = Language.StringByID(StringId.Open);
                                             break;
                                         case 2:
-                                            curtain.trait_on_off.curValue = "off";
+                                            curtain.SetAttrState(FunctionAttributeKey.OnOff, "off");
                                             curtain.lastState = Language.StringByID(StringId.Close);
                                             break;
                                     }
@@ -332,7 +333,7 @@
                             {
                                 function.SetAttrState(FunctionAttributeKey.TempType, receiveBytes[1].ToString());
                                 function.SetAttrState(FunctionAttributeKey.RoomTemp, receiveBytes[2].ToString());
-                                function.trait_on_off.curValue = receiveBytes[8] == 1 ? "on" : "off";
+                                function.SetAttrState(FunctionAttributeKey.OnOff,  receiveBytes[8] == 1 ? "on" : "off");
                                 acFunction.SetMode(receiveBytes[9],function);
                                 acFunction.SetFan(receiveBytes[10],function);
                                 function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[11].ToString());
@@ -386,7 +387,7 @@
                             if (function.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
                             {
                                 function.SetAttrState(FunctionAttributeKey.TempType, receiveBytes[2]);
-                                function.trait_on_off.curValue = receiveBytes[1] % 2 == 0 ? "off" : "on";
+                                function.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[1] % 2 == 0 ? "off" : "on");
                                 new FloorHeating().SetModeIndex(receiveBytes[3],function);
 
                                 if (function.Fh_Mode_Temp.ContainsKey("normal"))
@@ -630,7 +631,7 @@
                                 switch (receiveBytes[0])
                                 {
                                     case 3://
-                                        function.trait_on_off.curValue = receiveBytes[1] == 1 ? "on" : "off";
+                                        function.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[1] == 1 ? "on" : "off");
                                         break;
                                     case 4:
                                     case 7:
diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs
index fbb7977..df4e13e 100644
--- a/HDL_ON/UI/MainPage.cs
+++ b/HDL_ON/UI/MainPage.cs
@@ -25,7 +25,7 @@
         /// <summary>
         /// 鐗堟湰鍙�
         /// </summary>
-        public static string VersionString = "1.2.0916";
+        public static string VersionString = "1.2.0923";
         ///// <summary>
         ///// 瀹㈡埛绔被鍨�
         ///// </summary>
diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
index 5bac77a..a99dee1 100644
--- a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
@@ -135,6 +135,10 @@
                     this.EndHeaderRefreshing();
                     Common.ApiUtlis.Ins.DownloadData();
                     LoadContentView();
+                    if(!CurShowTypeIsFunction)
+                    {
+                        contentView.PageIndex = 1;
+                    }
                 };
 
                 #region topView
@@ -704,8 +708,13 @@
                             sceneFunctionView = new VerticalScrolViewLayout();
                             contentView.AddChidren(sceneFunctionView);
                             LoadSceneFunctionControlZone();
-                            contentView.PageIndex = 0;
-
+                            if (CurShowTypeIsFunction)
+                            {
+                                contentView.PageIndex = 0;
+                            }else
+                            {
+                                contentView.PageIndex = 1;
+                            }
 
                             LoadEvent_ChangeShowedFunctionType();
 
@@ -736,7 +745,15 @@
                 sceneFunctionView = new VerticalScrolViewLayout();
                 contentView.AddChidren(sceneFunctionView);
                 LoadSceneFunctionControlZone();
-                contentView.PageIndex = 0;
+
+                if (CurShowTypeIsFunction)
+                {
+                    contentView.PageIndex = 0;
+                }
+                else
+                {
+                    contentView.PageIndex = 1;
+                }
 
 
                 LoadEvent_ChangeShowedFunctionType();
diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
index 013396b..75cec12 100644
--- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
@@ -266,7 +266,6 @@
                 btnChangeScene.IsBold = false;
                 CurShowTypeIsFunction = true;
                 contentView.PageIndex = 0;
-
             };
 
             //var client = new BlufiClient();
@@ -298,7 +297,6 @@
                     btnChangeScene.TextSize = CSS.CSS_FontSize.TextFontSize;
                     btnChangeScene.IsSelected = false;
                     btnChangeScene.IsBold = false;
-                    CurShowTypeIsFunction = true;
                 }
                 else
                 {
@@ -308,7 +306,6 @@
                     btnChangeFunction.TextSize = CSS.CSS_FontSize.TextFontSize;
                     btnChangeFunction.IsSelected = false;
                     btnChangeFunction.IsBold = false;
-                    CurShowTypeIsFunction = false;
                 }
             };
         }
@@ -332,7 +329,15 @@
                                 if (function.spk == SPK.CurtainRoller || function.spk == SPK.CurtainShades || function.spk == SPK.CurtainTrietex ||
                                 function.spk == SPK.CurtainSwitch)//绐楀笜璁惧鏍规嵁鐧惧垎姣斿垽鏂紑鍏崇姸鎬�
                                 {
-                                    state = function.GetAttrState(FunctionAttributeKey.Percent) != "0";
+                                    if (function.GetAttribute(FunctionAttributeKey.Percent) != null)
+                                    {
+                                        state = function.GetAttrState(FunctionAttributeKey.Percent) != "0";
+                                    }else
+                                    {
+                                        if (function.GetAttrState(FunctionAttributeKey.OnOff) == "stop")
+                                            return;
+                                        state = function.trait_on_off.curValue.ToString() == "on";
+                                    }
                                 }
                                 else
                                 {

--
Gitblit v1.8.0