From 2562ee38c58a113113a2943ae057c1937ae533cb Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期四, 02 七月 2020 13:49:20 +0800 Subject: [PATCH] 2020-07-01 1.去掉读电能操作,去掉kwh状态显示。 2.当前是分享住宅,不允许删除备份。 3.进入搜索网关页面,切换到本地模式。 4.Alexa页面 增加添加设备失败提示。 5.子账号页面,底部增加文字提示。6.Android 默认隐藏底部虚拟按键。 --- Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs | 44 ++-- Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide-wal | 0 Crabtree/ON/Application.cs | 10 + Crabtree/ON/Resources/values/Styles.xml | 2 Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide | 0 Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide-shm | 0 Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddResidence.cs | 29 +++ Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs | 4 Crabtree/SmartHome/UI/SimpleControl/MainPage.cs | 4 Crabtree/SmartHome/UI/SimpleControl/CommonPage.cs | 12 Crabtree/SmartHome/HDL/Operation/Control.cs | 14 Crabtree/SmartHome/UI/SimpleControl/Phone/Register/Databackup.cs | 7 Crabtree/SmartHome/UI/SimpleControl/Phone/Alexa/AlexaDeviceListPage.cs | 78 +++++++++ Crabtree/SmartHome/UI/SimpleControl/Phone/Light/UserDeviceToSocket.cs | 43 ++-- Crabtree/SmartHome/UI/SimpleControl/Phone/Light/UserDeviceToLight.cs | 50 +++-- Crabtree/ON/Properties/AndroidManifest.xml | 2 Crabtree/.vs/SmartHome/xs/UserPrefs.xml | 38 ++-- Crabtree/SmartHome/UI/SimpleControl/Phone/Register/SubaccountListView.cs | 47 +++++ Crabtree/SmartHome/UI/SimpleControl/Phone/Room/UserRoom.cs | 42 ++-- 19 files changed, 298 insertions(+), 128 deletions(-) diff --git a/Crabtree/.vs/SmartHome/xs/UserPrefs.xml b/Crabtree/.vs/SmartHome/xs/UserPrefs.xml index fda5691..761f0f2 100644 --- a/Crabtree/.vs/SmartHome/xs/UserPrefs.xml +++ b/Crabtree/.vs/SmartHome/xs/UserPrefs.xml @@ -1,36 +1,42 @@ -锘�<Properties StartupConfiguration="{1D83BF28-BA88-4152-BA41-D7EFE90A5437}|Default"> +锘�<Properties StartupConfiguration="{9D9EF20B-6E65-4A65-92BF-567EBF1E1443}|Default"> <MonoDevelop.Ide.ItemProperties.ON.Droid PreferredExecutionTarget="Android.Android_Accelerated_Oreo" /> - <MonoDevelop.Ide.Workbench> + <MonoDevelop.Ide.Workbench ActiveDocument="SmartHome/UI/SimpleControl/Phone/Alexa/AlexaDeviceListPage.cs"> <Files> - <File FileName="ON/Properties/AndroidManifest.xml" /> - <File FileName="SmartHome/UI/SimpleControl/CommonPage.cs" /> - <File FileName="SmartHome/UI/SimpleControl/MqttCommon.cs" Line="420" Column="27" /> - <File FileName="SmartHome/UI/SimpleControl/MainPage.cs" Line="417" Column="31" /> - <File FileName="ON.Ios/Info.plist" /> + <File FileName="SmartHome/UI/SimpleControl/Phone/Alexa/AlexaDeviceListPage.cs" Line="478" Column="23" /> + <File FileName="SmartHome/HDL/Operation/ResponseEntity/ErrorCode.cs" /> + <File FileName="SmartHome/UI/SimpleControl/Phone/Light/UserDeviceToSocket.cs" /> + <File FileName="SmartHome/UI/SimpleControl/Phone/Register/Databackup.cs" /> + <File FileName="SmartHome/UI/SimpleControl/Phone/Register/SubaccountListView.cs" /> <File FileName="ON/Application.cs" /> - <File FileName="SmartHome/Net/HttpListener.cs" /> - <File FileName="SmartHome/UI/SimpleControl/EquipmentPublicClass.cs" /> - <File FileName="SmartHome/UI/SimpleControl/Phone/Schedule/HelpView.cs" /> <File FileName="SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs" /> + <File FileName="SmartHome/UI/SimpleControl/MainPage.cs" /> + <File FileName="ON/Properties/AndroidManifest.xml" /> </Files> <Pads> <Pad Id="ProjectPad"> <State name="__root__"> <Node name="SmartHome" expanded="True"> - <Node name="ON.Droid" selected="True" /> + <Node name="ON.Droid" expanded="True" selected="True"> + <Node name="Properties" expanded="True" /> + </Node> + <Node name="ON.Ios" expanded="True" /> <Node name="Shared" expanded="True"> <Node name="HDL" expanded="True"> - <Node name="Operation" expanded="True" /> + <Node name="Operation" expanded="True"> + <Node name="ResponseEntity" expanded="True" /> + </Node> </Node> - <Node name="Net" expanded="True" /> <Node name="UI" expanded="True"> <Node name="SimpleControl" expanded="True"> <Node name="Phone" expanded="True"> + <Node name="AC" expanded="True" /> + <Node name="Alexa" expanded="True" /> + <Node name="Fan" expanded="True" /> + <Node name="FoolHeat" expanded="True" /> + <Node name="Light" expanded="True" /> <Node name="Register" expanded="True" /> - <Node name="Schedule" expanded="True" /> - <Node name="UniversalDevice" expanded="True" /> + <Node name="Room" expanded="True" /> <Node name="User" expanded="True" /> - <Node name="Warning" expanded="True" /> </Node> </Node> </Node> diff --git a/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide b/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide index b504c97..e15471a 100644 --- a/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide +++ b/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide Binary files differ diff --git a/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide-shm b/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide-shm new file mode 100644 index 0000000..8a77de6 --- /dev/null +++ b/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide-shm Binary files differ diff --git a/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide-wal b/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide-wal new file mode 100644 index 0000000..98e5e0e --- /dev/null +++ b/Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide-wal Binary files differ diff --git a/Crabtree/ON/Application.cs b/Crabtree/ON/Application.cs index 5acedcf..ab2173c 100644 --- a/Crabtree/ON/Application.cs +++ b/Crabtree/ON/Application.cs @@ -4,6 +4,7 @@ using Android.Content; using Android.Net; using Android.OS; +using Android.Views; //using CN.Jpush.Android.Api; //using CN.Jpush.Android.Service; using Java.Lang; @@ -125,7 +126,7 @@ }; Shared.Application.FontSize = 16; - BaseActivity.IsHideVirualButtons = false; + BaseActivity.IsHideVirualButtons = true; ZXing.Mobile.MobileBarcodeScanner.Initialize (this); init (); BaseActivity.OnCreateActoin += (activity, application) => { @@ -350,5 +351,12 @@ Shared.BusSocket.Start (6000); } + void Hide () { +// Window _window; +// _window = this.GetWindow (); +// WindowManager.LayoutParams params = _window.getAttributes (); +//params.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; +// _window.setAttributes (params); + } } } diff --git a/Crabtree/ON/Properties/AndroidManifest.xml b/Crabtree/ON/Properties/AndroidManifest.xml index a52acdb..69c0d20 100644 --- a/Crabtree/ON/Properties/AndroidManifest.xml +++ b/Crabtree/ON/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@ 锘�<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.crabtreenew" android:versionName="2.506221" android:versionCode="202006221"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.crabtreenew" android:versionName="2.507011" android:versionCode="202007011"> <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="28" /> <!-- 鍦ㄥ畨鍗揚鐗堟湰涔嬪悗锛屽繀椤昏鎺堜簣FOREGROUND_SERVICE鏉冮檺锛屾墠鑳藉浣跨敤鍓嶅彴鏈嶅姟 --> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> diff --git a/Crabtree/ON/Resources/values/Styles.xml b/Crabtree/ON/Resources/values/Styles.xml index 2e55d47..758ca7d 100755 --- a/Crabtree/ON/Resources/values/Styles.xml +++ b/Crabtree/ON/Resources/values/Styles.xml @@ -7,7 +7,7 @@ <item name="android:windowFullscreen">false</item> <!-- 闅愯棌鏍囬鏍� --> <item name="android:windowNoTitle">true</item> - <item name="android:windowLightStatusBar">true</item> + <item name="android:windowLightStatusBar">true</item> <item name="android:windowTranslucentStatus">true</item> </style> </resources> diff --git a/Crabtree/SmartHome/HDL/Operation/Control.cs b/Crabtree/SmartHome/HDL/Operation/Control.cs index 070dcf9..8bbe6cf 100644 --- a/Crabtree/SmartHome/HDL/Operation/Control.cs +++ b/Crabtree/SmartHome/HDL/Operation/Control.cs @@ -388,13 +388,13 @@ { add (); if (CommonPage.IsRemote && !isLocal) { - if (!SmartHome.MqttCommon.IsGatewayOnline) { - System.Threading.Thread.Sleep (500); - Utlis.WriteLine ($"缃戝叧涓嶅湪绾� 鍙栨秷鍙戦��:" + SendFlag); - Packet.HaveSendCount = 3; - allDone.Set (); - return; - } + //if (!SmartHome.MqttCommon.IsGatewayOnline) { + // System.Threading.Thread.Sleep (500); + // Utlis.WriteLine ($"缃戝叧涓嶅湪绾� 鍙栨秷鍙戦��:" + SendFlag); + // Packet.HaveSendCount = 3; + // allDone.Set (); + // return; + //} if (IsEnterBackground) { System.Threading.Thread.Sleep (500); Utlis.WriteLine ("宸茶繘鍏ュ悗鍙� 鍙栨秷鍙戦��"); diff --git a/Crabtree/SmartHome/UI/SimpleControl/CommonPage.cs b/Crabtree/SmartHome/UI/SimpleControl/CommonPage.cs index a220793..28fe42e 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/CommonPage.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/CommonPage.cs @@ -348,12 +348,14 @@ UserDeviceToLight.UpdataEnergy (usefullBytes [0], updateFlag, usefullBytes [2] * 256 + usefullBytes [3]); UserRoom.UpdataEnergy (usefullBytes [0], common.Type + "_" + updateFlag, usefullBytes [2] * 256 + usefullBytes [3]); break; - } else if (usefullBytes [0] == 11) { - UserDeviceToSocket.UpdataEnergy (usefullBytes [0], updateFlag, usefullBytes [2] * 256 * 256 * 256 + usefullBytes [3] * 256 * 256 + usefullBytes [4] * 256 + usefullBytes [5]); - UserDeviceToLight.UpdataEnergy (usefullBytes [0], updateFlag, usefullBytes [2] * 256 * 256 * 256 + usefullBytes [3] * 256 * 256 + usefullBytes [4] * 256 + usefullBytes [5]); - UserRoom.UpdataEnergy (usefullBytes [0], common.Type + "_" + updateFlag, usefullBytes [2] * 256 * 256 * 256 + usefullBytes [3] * 256 * 256 + usefullBytes [4] * 256 + usefullBytes [5]); - break; } + //2020-07-01 瀹㈡埛鎻愬嚭闅愯棌kwh + //else if (usefullBytes [0] == 11) { + // UserDeviceToSocket.UpdataEnergy (usefullBytes [0], updateFlag, usefullBytes [2] * 256 * 256 * 256 + usefullBytes [3] * 256 * 256 + usefullBytes [4] * 256 + usefullBytes [5]); + // UserDeviceToLight.UpdataEnergy (usefullBytes [0], updateFlag, usefullBytes [2] * 256 * 256 * 256 + usefullBytes [3] * 256 * 256 + usefullBytes [4] * 256 + usefullBytes [5]); + // UserRoom.UpdataEnergy (usefullBytes [0], common.Type + "_" + updateFlag, usefullBytes [2] * 256 * 256 * 256 + usefullBytes [3] * 256 * 256 + usefullBytes [4] * 256 + usefullBytes [5]); + // break; + //} } diff --git a/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs b/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs index 68e6175..4c7c090 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs @@ -38,7 +38,7 @@ //public static Button LogoButton = new Button (); - public static string RequestVersion = "2.506221"; + public static string RequestVersion = "2.507011"; public static UserInfo LoginUser; /// <summary> /// 鏄惁鏄鐞嗗憳鏉冮檺(鍙樻洿浜�,鎴愬憳鐨勬椂鍊�,杩欎釜涔熶负ture銆備负浠�涔堜細澹版槑杩欐牱鍙橀噺,鍥犱负鏈変簺鎺ュ彛蹇呴』浣跨敤鍘熸潵鐨凾oken) @@ -153,7 +153,7 @@ /// <summary> - /// 澧炲姞rjfi + /// 寮瑰嚭閿欒鎻愮ず /// </summary> /// <param name="tip">Tip.</param> /// <param name="time">Time.</param> diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Alexa/AlexaDeviceListPage.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Alexa/AlexaDeviceListPage.cs index 400f3c9..b84d940 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Alexa/AlexaDeviceListPage.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Alexa/AlexaDeviceListPage.cs @@ -122,7 +122,11 @@ if (common != null) { var oldDevice = alexaDeviceLista.Find ((obj) => obj.SubnetID == common.SubnetID && obj.DeviceID == common.DeviceID && obj.LoopID == common.LoopID && obj.DeviceType == common.Type.ToString ()); if (oldDevice == null) { - AddDevice (common); + var isSuccess = AddDevice (common); + if (!isSuccess) { + //璺冲嚭寰幆 + break; + } } } } @@ -356,7 +360,11 @@ } } - AddScene (uploadScene); + var isSuccess = AddScene (uploadScene); + if (!isSuccess) { + //璺冲嚭寰幆 + break; + } } } @@ -435,8 +443,12 @@ var requestObj = new GetDeviceListObj () { RegionID = UserConfig.Instance.CurrentRegion.Id }; var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject (requestObj); var revertObj = MainPage.RequestHttps (API.GetDeviceList, requestJson); - if (revertObj.StateCode.ToUpper() == "SUCCESS") { - deviceList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<UpdateDeviceObj>> (revertObj.ResponseData.ToString()); + if (revertObj.StateCode.ToUpper () == "SUCCESS") { + deviceList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<UpdateDeviceObj>> (revertObj.ResponseData.ToString ()); + } else { + //2020-06-29 寮圭獥鎻愮ず閿欒 + + } return deviceList; } @@ -462,8 +474,49 @@ var revertObj = MainPage.RequestHttps (API.UploadDevices, requestJson); if (revertObj.StateCode.ToUpper() == "SUCCESS") { return true; + }else if (revertObj.StateCode == "Exist") { + Application.RunOnMainThread (() => { + MainPage.AddTip (ErrorCode.AddFailed + " " + ErrorCode.NameExist + " ( " + device.Name + " )"); + }); + return true; + } else { + //2020-06-29 寮瑰嚭鎻愮ず閿欒 + ShowUploadDevicesInfo (revertObj.StateCode); } return false; + } + + /// <summary> + /// 涓婁紶璁惧 閿欒鎻愮ず + /// </summary> + /// <param name="stateCodeStr"></param> + void ShowUploadDevicesInfo (string stateCodeStr) + { + string mes = ""; + if (stateCodeStr == "NoRecord") { + //浣忓畢鏈粦瀹氱綉鍏筹紒 + mes = ErrorCode.HomeNoRecord; + } else if (stateCodeStr == "NoExist") { + //浣忓畢涓嶅瓨鍦紒 + mes = ErrorCode.HomeNoExist; + } else if (stateCodeStr == "Exist") { + //璁惧鍚嶇О宸插瓨鍦� + mes = ErrorCode.NameExist; + } else if (stateCodeStr == ErrorCode.NetworkError) { + mes = ErrorCode.NetworkError; + } else { + mes = ErrorCode.OperationFailed + ErrorCode.Reason + stateCodeStr; + + } + if (!string.IsNullOrEmpty (mes)) { + Application.RunOnMainThread (() => { + MainPage.AddTip (ErrorCode.AddFailed + " " + mes); + + //new Alert ("", ErrorCode.AddFailed + " " + mes, Language.StringByID (R.MyInternationalizationString.Close)).Show (); + }); + } + + } /// <summary> @@ -476,6 +529,9 @@ var revertObj = MainPage.RequestHttps (API.DeleteDevice, requestJson); if (revertObj.StateCode.ToUpper() == "SUCCESS") { return true; + } else { + //2020-06-29 寮圭獥鎻愮ず閿欒 + } return false; } @@ -493,6 +549,8 @@ var revertObj = MainPage.RequestHttps (API.GetSceneList, requestJson); if (revertObj.StateCode.ToUpper() == "SUCCESS") { sceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SceneByRegion>> (revertObj.ResponseData.ToString ()); + } else { + //2020-06-29 寮圭獥鎻愮ず閿欒 } return sceneList; } @@ -511,7 +569,16 @@ //if (revertAddDeviceObj.StateCode.ToUpper() == "SUCCESS") { return true; //} + } else if (revertObj.StateCode == "Exist") { + Application.RunOnMainThread (() => { + MainPage.AddTip (ErrorCode.AddFailed + " " + ErrorCode.NameExist + " ( " + sceneMark.SceneName + " )"); + }); + return true; + } else { + //2020-06-29 寮瑰嚭鎻愮ず閿欒 + ShowUploadDevicesInfo (revertObj.StateCode); } + return false; } @@ -539,6 +606,9 @@ var revertObj = MainPage.RequestHttps (API.DeleteScene, requestJson); if (revertObj.StateCode.ToUpper() == "SUCCESS") { return true; + } else { + //2020-06-29 寮圭獥鎻愮ず閿欒 + } return false; } diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddResidence.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddResidence.cs index 2bda578..ebd897b 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddResidence.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddResidence.cs @@ -538,6 +538,26 @@ } /// <summary> + /// 鍚姩鏈湴妯″紡 + /// </summary> + void EnableLocalMode () { + MainPage.AddTip ("Enable local mode."); + Utlis.ShowAppLinkStatus (AppLinkStatus.WiFiOffline); + CommonPage.IsRemote = false; + SmartHome.MqttCommon.DisConnectRemoteMqttClient ("EnableLocalMode"); + } + + /// <summary> + /// 鍚姩杩滅▼妯″紡 + /// </summary> + void EnableRemoteMode () + { + MainPage.AddTip ("Restore remote mode."); + Utlis.ShowAppLinkStatus (AppLinkStatus.CloudUnlink); + CommonPage.IsRemote = true; + } + + /// <summary> /// 璺宠浆缃戝叧鎼滅储椤甸潰 /// </summary> /// <param name="home"></param> @@ -545,9 +565,12 @@ try { //杩滅▼杩炴帴鐨勬椂鍊欑姝� 鎼滅储缃戝叧鍜屾坊鍔犺澶� if (CommonPage.IsRemote) { - //褰撳墠澶勪簬杩滅▼杩炴帴妯″紡锛屾棤娉曡繘鍏ユ悳绱㈢綉鍏抽〉闈€�傝鍏堝垏鎹㈠洖鏈湴杩炴帴妯″紡銆� - new Alert ("", "Currently in remote connection mode, unable to enter the search gateway page. Please switch back to local connection mode first.", Language.StringByID (R.MyInternationalizationString.Close)).Show (); - return; + ////褰撳墠澶勪簬杩滅▼杩炴帴妯″紡锛屾棤娉曡繘鍏ユ悳绱㈢綉鍏抽〉闈€�傝鍏堝垏鎹㈠洖鏈湴杩炴帴妯″紡銆� + //new Alert ("", "Currently in remote connection mode, unable to enter the search gateway page. Please switch back to local connection mode first.", Language.StringByID (R.MyInternationalizationString.Close)).Show (); + //return; + + //2020-06-29 鍚姩鏈湴閫氫俊妯″紡 + EnableLocalMode (); } diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Light/UserDeviceToLight.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Light/UserDeviceToLight.cs index 41a7785..bea059b 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Light/UserDeviceToLight.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Light/UserDeviceToLight.cs @@ -65,11 +65,13 @@ if (btn.Tag.ToString () == DeviceType.LightEnergySwitch.ToString () + "_Voltage") { btn.Text = energy.ToString () + " W"; } - } else if (updataType == 11) { - if (btn.Tag.ToString () == DeviceType.LightEnergySwitch.ToString () + "_Electric") { - btn.Text = ((double)(Convert.ToDouble (energy) / 10)).ToString () + " kw.h"; - } } + ////2020-07-01 瀹㈡埛鎻愬嚭闅愯棌kwh + //else if (updataType == 11) { + // if (btn.Tag.ToString () == DeviceType.LightEnergySwitch.ToString () + "_Electric") { + // btn.Text = ((double)(Convert.ToDouble (energy) / 10)).ToString () + " kw.h"; + // } + //} } } } @@ -696,21 +698,21 @@ }; lightView.AddChidren (btnEnergy); EnergtLightList.Add (common); - - if (common.Type == DeviceType.LightEnergySwitch) { - Button btnElectric = new Button () { - Width = Application.GetRealWidth (200), - Height = Application.GetRealHeight (35), - X = Application.GetRealWidth (320), - Y = tempSwitch.Bottom, - TextAlignment = TextAlignment.CenterRight, - TextColor = SkinStyle.Current.TextColor1, - SelectedTextColor = SkinStyle.Current.TextColor1, - Tag = common.Type.ToString () + "_Electric", - Text = "0 kw.h" - }; - lightView.AddChidren (btnElectric); - } + //2020-07-01 瀹㈡埛鎻愬嚭闅愯棌kwh + //if (common.Type == DeviceType.LightEnergySwitch) { + // Button btnElectric = new Button () { + // Width = Application.GetRealWidth (200), + // Height = Application.GetRealHeight (35), + // X = Application.GetRealWidth (320), + // Y = tempSwitch.Bottom, + // TextAlignment = TextAlignment.CenterRight, + // TextColor = SkinStyle.Current.TextColor1, + // SelectedTextColor = SkinStyle.Current.TextColor1, + // Tag = common.Type.ToString () + "_Electric", + // Text = "0 kw.h" + // }; + // lightView.AddChidren (btnElectric); + //} } tempSwitch.MouseUpEventHandler += (sender3, e3) => { @@ -727,7 +729,8 @@ if (common.Type == DeviceType.LightEnergySwitch) { new System.Threading.Thread (() => { Control.ControlBytesSend (Command.ReadAnalogValue, light.SubnetID, light.DeviceID, new byte [] { 10, light.LoopID }, SendCount.Zero); - Control.ControlBytesSend (Command.ReadAnalogValue, light.SubnetID, light.DeviceID, new byte [] { 11, light.LoopID }, SendCount.Zero); + //2020-07-01 瀹㈡埛鎻愬嚭闅愯棌kwh + //Control.ControlBytesSend (Command.ReadAnalogValue, light.SubnetID, light.DeviceID, new byte [] { 11, light.LoopID }, SendCount.Zero); }) { IsBackground = true }.Start (); } }; @@ -998,9 +1001,10 @@ for (int i = 0; i < EnergtLightList.Count; i++) { var c = EnergtLightList [i]; Control.ControlBytesSend (Command.ReadAnalogValue, c.SubnetID, c.DeviceID, new byte [] { 10, c.LoopID }, SendCount.Zero); - //if (c.Type == DeviceType.LightEnergySwitch) { - Control.ControlBytesSend (Command.ReadAnalogValue, c.SubnetID, c.DeviceID, new byte [] { 11, c.LoopID }, SendCount.Zero); - //} + ////if (c.Type == DeviceType.LightEnergySwitch) { + ////2020-07-01 瀹㈡埛鎻愬嚭闅愯棌kwh + //Control.ControlBytesSend (Command.ReadAnalogValue, c.SubnetID, c.DeviceID, new byte [] { 11, c.LoopID }, SendCount.Zero); + ////} System.Threading.Thread.Sleep (200); } System.Threading.Thread.Sleep (10000); diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Light/UserDeviceToSocket.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Light/UserDeviceToSocket.cs index bb904ee..820539f 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Light/UserDeviceToSocket.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Light/UserDeviceToSocket.cs @@ -67,11 +67,13 @@ if (btn.Tag.ToString () == DeviceType.LightEnergySocket.ToString () + "_Voltage" || btn.Tag.ToString () == DeviceType.LightEnergySwitch.ToString () + "_Voltage") { btn.Text = energy.ToString () + " W"; } - } else if (updataType == 11) { - if (btn.Tag.ToString () == DeviceType.LightEnergySocket.ToString () + "_Electric" || btn.Tag.ToString () == DeviceType.LightEnergySwitch.ToString () + "_Electric") { - btn.Text = ((double)(Convert.ToDouble (energy) / 10)).ToString () + " kw.h"; - } } + ////2020-07-01 瀹㈡埛鎻愬嚭闅愯棌kwh + //else if (updataType == 11) { + // if (btn.Tag.ToString () == DeviceType.LightEnergySocket.ToString () + "_Electric" || btn.Tag.ToString () == DeviceType.LightEnergySwitch.ToString () + "_Electric") { + // btn.Text = ((double)(Convert.ToDouble (energy) / 10)).ToString () + " kw.h"; + // } + //} } } } @@ -482,21 +484,21 @@ }; lightView.AddChidren (btnEnergy); EnergtLightList.Add (common); - - //if (common.Type == DeviceType.LightEnergySwitch) { - Button btnElectric = new Button () { - Width = Application.GetRealWidth (200), - Height = Application.GetRealHeight (35), - X = Application.GetRealWidth (320), - Y = tempSwitch.Bottom, - TextColor = SkinStyle.Current.TextColor1, - SelectedTextColor = SkinStyle.Current.TextColor1, - TextAlignment = TextAlignment.CenterRight, - Tag = common.Type.ToString () + "_Electric", - Text = "0 kw.h" - }; - lightView.AddChidren (btnElectric); - //} + //2020-07-01 瀹㈡埛鎻愬嚭闅愯棌kwh + ////if (common.Type == DeviceType.LightEnergySwitch) { + //Button btnElectric = new Button () { + // Width = Application.GetRealWidth (200), + // Height = Application.GetRealHeight (35), + // X = Application.GetRealWidth (320), + // Y = tempSwitch.Bottom, + // TextColor = SkinStyle.Current.TextColor1, + // SelectedTextColor = SkinStyle.Current.TextColor1, + // TextAlignment = TextAlignment.CenterRight, + // Tag = common.Type.ToString () + "_Electric", + // Text = "0 kw.h" + // }; + // lightView.AddChidren (btnElectric); + ////} Button btnEnergyNull = new Button () { Y = Application.GetRealHeight (127), @@ -513,7 +515,8 @@ while (readEnergy) { foreach (var c in EnergtLightList) { Control.ControlBytesSend (Command.ReadAnalogValue, c.SubnetID, c.DeviceID, new byte [] { 10, c.LoopID }, SendCount.Zero); - Control.ControlBytesSend (Command.ReadAnalogValue, c.SubnetID, c.DeviceID, new byte [] { 11, c.LoopID }, SendCount.Zero); + //2020-07-01 瀹㈡埛鎻愬嚭闅愯棌kwh + //Control.ControlBytesSend (Command.ReadAnalogValue, c.SubnetID, c.DeviceID, new byte [] { 11, c.LoopID }, SendCount.Zero); System.Threading.Thread.Sleep (200); } Thread.Sleep (10000); diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs index b83cff7..dd9080a 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs @@ -78,10 +78,10 @@ }; #if DEBUG - etAccount.Text = "18926269190@189.cn"; + //etAccount.Text = "18926269190@189.cn"; //etAccount.Text = "721343314@qq.com"; //etAccount.Text = "crabtreel12019@gmail.com"; - //etAccount.Text = "2791308028@qq.com"; + etAccount.Text = "2791308028@qq.com"; #endif accountView.AddChidren (etAccount); diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/Databackup.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/Databackup.cs index 60f529d..3766068 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/Databackup.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/Databackup.cs @@ -390,7 +390,12 @@ alert.Show (); }; - if (MainPage.LoginUser.AccountType != 1) { + //if (MainPage.LoginUser.AccountType != 1) { + // rowView.AddRightView (btnDelFile); + //} + + //2020-07-01 褰撳墠浣忓畢灞炰簬鑷繁鐨� 鍏佽鍒犻櫎澶囦唤 + if (!MainPage.IsAdministrator) { rowView.AddRightView (btnDelFile); } diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/SubaccountListView.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/SubaccountListView.cs index 7d66fc3..2d44dc2 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/SubaccountListView.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/SubaccountListView.cs @@ -58,6 +58,11 @@ topView.AddChidren (ItemButton); #endregion + //2020-07-01 + if (UserConfig.Instance.CurrentRegion != null && !string.IsNullOrEmpty (UserConfig.Instance.CurrentRegion.Name)) { + NameButton.Text = UserConfig.Instance.CurrentRegion.Name; + } + EventHandler<MouseEventArgs> addSubaccountHandler = (sender, e) => { modifySubaccount (null); }; @@ -109,13 +114,34 @@ VerticalScrolViewLayout contentView = new VerticalScrolViewLayout () { Y = topUserMsgView.Bottom, - Height = Application.GetRealHeight (1136) - topUserMsgView.Bottom, + Height = Application.GetRealHeight (1136-80) - topUserMsgView.Bottom, BackgroundColor = SkinStyle.Current.ViewColor, ScrollEnabled = false, }; AddChidren (contentView); - + //#region + ////褰撳墠浣忓畢 + //FrameLayout homeView = new FrameLayout () { + // Height = Application.GetRealHeight (100), + // BackgroundColor = SkinStyle.Current.Transparent + //}; + //contentView.AddChidren (homeView); + + //Button btnHomeText = new Button () { + // X = Application.GetRealWidth (40), + // Width = Application.GetRealWidth (600), + // //TextID = R.MyInternationalizationString.Subaccount, + // TextAlignment = TextAlignment.CenterLeft, + // TextColor = SkinStyle.Current.TextColor1, + //}; + //homeView.AddChidren (btnHomeText); + + //if (UserConfig.Instance.CurrentRegion != null && !string.IsNullOrEmpty (UserConfig.Instance.CurrentRegion.Name)) { + // btnHomeText.Text = "Current residence: " + UserConfig.Instance.CurrentRegion.Name; + //} + //#endregion + FrameLayout subaccountView = new FrameLayout () { Height = Application.GetRealHeight (50), BackgroundColor = SkinStyle.Current.MainColor @@ -145,6 +171,23 @@ addSubaccountList (); + addTipView (); + } + + void addTipView () { + var TipView = new Button () { + Width = LayoutParams.MatchParent, + Y = Application.GetRealHeight (Application.DesignHeight - 80), + Height = Application.GetRealHeight (80), + BackgroundColor = 0xFFFFFFE0, + TextSize = 11, + TextColor = 0xFF1F1F1F, + TextAlignment = TextAlignment.Center, + IsMoreLines = true, + Text = "Manage the member list of the current residence and share it to other accounts. \n Tips: You need to add the registered member account.", + + }; + AddChidren (TipView); } void addSubaccountList () diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Room/UserRoom.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Room/UserRoom.cs index 1917d47..c8cfb7a 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Room/UserRoom.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Room/UserRoom.cs @@ -59,11 +59,13 @@ if (btn.Tag.ToString () == DeviceType.LightEnergySocket.ToString () + "_Voltage" || btn.Tag.ToString () == DeviceType.LightEnergySwitch.ToString () + "_Voltage") { btn.Text = energy.ToString () + " W"; } - } else if (updataType == 11) { - if (btn.Tag.ToString () == DeviceType.LightEnergySocket.ToString () + "_Electric" || btn.Tag.ToString () == DeviceType.LightEnergySwitch.ToString () + "_Electric") { - btn.Text = ((double)(Convert.ToDouble (energy) / 10)).ToString () + " kw.h"; - } } + //2020-07-01 瀹㈡埛鎻愬嚭闅愯棌kwh + //else if (updataType == 11) { + // if (btn.Tag.ToString () == DeviceType.LightEnergySocket.ToString () + "_Electric" || btn.Tag.ToString () == DeviceType.LightEnergySwitch.ToString () + "_Electric") { + // btn.Text = ((double)(Convert.ToDouble (energy) / 10)).ToString () + " kw.h"; + // } + //} } } } @@ -1851,19 +1853,19 @@ }; DeviceRowView.AddChidren (btnEnergy); EnergtLightList.Add (devcieCommon); - - Button btnElectric = new Button () { - Width = Application.GetRealWidth (200), - Height = Application.GetRealHeight (35), - X = Application.GetRealWidth (320), - Y = tempSwitch.Bottom, - TextColor = SkinStyle.Current.TextColor1, - TextAlignment = TextAlignment.CenterRight, - SelectedTextColor = SkinStyle.Current.TextColor1, - Tag = devcieCommon.Type.ToString () + "_Electric", - Text = "0 kw.h" - }; - DeviceRowView.AddChidren (btnElectric); + //2020-07-01 瀹㈡埛鎻愬嚭闅愯棌kwh + //Button btnElectric = new Button () { + // Width = Application.GetRealWidth (200), + // Height = Application.GetRealHeight (35), + // X = Application.GetRealWidth (320), + // Y = tempSwitch.Bottom, + // TextColor = SkinStyle.Current.TextColor1, + // TextAlignment = TextAlignment.CenterRight, + // SelectedTextColor = SkinStyle.Current.TextColor1, + // Tag = devcieCommon.Type.ToString () + "_Electric", + // Text = "0 kw.h" + //}; + //DeviceRowView.AddChidren (btnElectric); } tempSwitch.MouseUpEventHandler += (sender3, e3) => { //tempSwitch.IsSelected = !tempSwitch.IsSelected; @@ -1881,7 +1883,8 @@ if (devcieCommon.Type == DeviceType.LightEnergySocket || devcieCommon.Type == DeviceType.LightEnergySwitch) { new System.Threading.Thread (() => { Control.ControlBytesSend (Command.ReadAnalogValue, switchLight.SubnetID, switchLight.DeviceID, new byte [] { 10, switchLight.LoopID }, SendCount.Zero); - Control.ControlBytesSend (Command.ReadAnalogValue, switchLight.SubnetID, switchLight.DeviceID, new byte [] { 11, switchLight.LoopID }, SendCount.Zero); + //2020-07-01 瀹㈡埛鎻愬嚭闅愯棌kwh + //Control.ControlBytesSend (Command.ReadAnalogValue, switchLight.SubnetID, switchLight.DeviceID, new byte [] { 11, switchLight.LoopID }, SendCount.Zero); }) { IsBackground = true }.Start (); } }; @@ -2308,7 +2311,8 @@ var c = EnergtLightList [i]; Control.ControlBytesSend (Command.ReadAnalogValue, c.SubnetID, c.DeviceID, new byte [] { 10, c.LoopID }, SendCount.Zero); - Control.ControlBytesSend (Command.ReadAnalogValue, c.SubnetID, c.DeviceID, new byte [] { 11, c.LoopID }, SendCount.Zero); + //2020-07-01 瀹㈡埛鎻愬嚭闅愯棌kwh + //Control.ControlBytesSend (Command.ReadAnalogValue, c.SubnetID, c.DeviceID, new byte [] { 11, c.LoopID }, SendCount.Zero); #if DEBUG Application.RunOnMainThread (() => { Utlis.WriteLine ($"璇诲彇 { c.Name } 鐢佃兘"); diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs index 6299a4e..75f8a7a 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs @@ -26,7 +26,7 @@ //public static Button LinkStatusTip = new Button () { // Height = Application.GetRealHeight (36), - // Width = Application.GetRealWidth (640), + // Width = Application.GetRealWidth (Application.DesignWidth), // BackgroundColor = SkinStyle.Current.LinkStatusTipColor //}; @@ -34,33 +34,33 @@ IsShowPoint = false, }; public static FrameLayout FavoriteBodyView = new FrameLayout () { - Width = Application.GetRealWidth (640), - Height = Application.GetRealHeight (1136) + //Width = Application.GetRealWidth (Application.DesignWidth), + //Height = Application.GetRealHeight (Application.DesignHeight) }; public static UserRoom FavoriteRoom = new UserRoom () { - Width = Application.GetRealWidth (640), - Height = Application.GetRealHeight (1136 - 90) + //Width = Application.GetRealWidth (Application.DesignWidth), + Height = Application.GetRealHeight (Application.DesignHeight - userMenuItemHeight) }; public static PageLayout DevicePageView = new PageLayout () { IsShowPoint = false, }; public static FrameLayout DeviceBodyView = new FrameLayout () { - Width = Application.GetRealWidth (640), - Height = Application.GetRealHeight (1136) + //Width = Application.GetRealWidth (Application.DesignWidth), + Height = Application.GetRealHeight (Application.DesignHeight) }; public static VerticalScrolViewLayout DeviceView = new VerticalScrolViewLayout () { Y = Application.GetRealHeight (126), - Width = Application.GetRealWidth (640), - Height = Application.GetRealHeight (1136 - 126 - 90), + //Width = Application.GetRealWidth (Application.DesignWidth), + Height = Application.GetRealHeight (Application.DesignHeight - 126 - userMenuItemHeight), }; public static PageLayout RoomPageView = new PageLayout () { IsShowPoint = false, }; public static FrameLayout RoomBodyView = new FrameLayout () { - Width = Application.GetRealWidth (640), - Height = Application.GetRealHeight (1136) + Width = Application.GetRealWidth (Application.DesignWidth), + Height = Application.GetRealHeight (Application.DesignHeight) }; public static PageLayout SettingPageView = new PageLayout () { @@ -68,18 +68,18 @@ }; public static FrameLayout SettingBodyView = new FrameLayout () { BackgroundColor = SkinStyle.Current.MainColor, - Height = Application.GetRealHeight (1136) + Height = Application.GetRealHeight (Application.DesignHeight) }; public static VerticalScrolViewLayout SettingView = new VerticalScrolViewLayout () { Y = Application.GetRealHeight (126), - Width = Application.GetRealWidth (640), - Height = Application.GetRealHeight (1136 - 126 - 90 - 90), + Width = Application.GetRealWidth (Application.DesignWidth), + Height = Application.GetRealHeight (Application.DesignHeight - 126 - userMenuItemHeight - 90), BackgroundColor = SkinStyle.Current.ViewColor, //ScrollEnabled = true }; public static Button btnVersion = new Button () { - Y = Application.GetRealHeight (1136 - 90 - 90), - Width = Application.GetRealWidth (640), + Y = Application.GetRealHeight (Application.DesignHeight - userMenuItemHeight - 90), + Width = Application.GetRealWidth (Application.DesignWidth), Height = Application.GetRealHeight (90), Text = Language.StringByID (R.MyInternationalizationString.Version) + " : " + MainPage.RequestVersion, TextColor = SkinStyle.Current.TextColor1, @@ -88,8 +88,8 @@ }; public static FrameLayout UserMenuItem = new FrameLayout () { - Y = Application.GetRealHeight (Application.DesignHeight - 90), - Height = Application.GetRealHeight (95), + Y = Application.GetRealHeight (Application.DesignHeight - userMenuItemHeight), + Height = Application.GetRealHeight (userMenuItemHeight+5), BackgroundColor = SkinStyle.Current.MainColor }; @@ -269,9 +269,11 @@ //2020-01-14 鐧诲綍鎴愬姛鍚庯紝鍒锋柊涓�娆″綋鍓嶄綇瀹呯綉鍏� GetNowHomeGatewayAfterLoginSuccess (); } else if (!string.IsNullOrEmpty (revertObj.StateCode)) { - MainPage.LoginUser.LastTime = DateTime.Now.AddDays (-30); - MainPage.LoginUser.SaveUserInfo (); - new AccountLogin ().Show (); + if (revertObj.StateCode != ErrorCode.NetworkError && revertObj.StateCode != "Data Exception") { + MainPage.LoginUser.LastTime = DateTime.Now.AddDays (-30); + MainPage.LoginUser.SaveUserInfo (); + new AccountLogin ().Show (); + } } }); } -- Gitblit v1.8.0