From 691dbe24f5724f153e07947c7b75bdfea5f0b6d5 Mon Sep 17 00:00:00 2001
From: wxr <wxr@hdlchina.com.cn>
Date: 星期二, 24 九月 2024 16:15:15 +0800
Subject: [PATCH] 离线控制模式
---
HDL-ON_Android/Assets/Phone/Collection/TokenInvalidTipIcon.png | 0
HDL-ON_iOS/Resources/Phone/Public/RightIcon2.png | 0
HDL_ON/UI/UI2/1-HomePage/HomePage.cs | 54 +++--
HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs | 2
HDL-ON_Android/Assets/Language.ini | 31 ++
HDL-ON_iOS/HDL-ON_iOS.csproj | 2
HDL_ON/Common/ApiUtlis.cs | 110 ++++++----
HDL_ON/DAL/DriverLayer/Control_Udp.cs | 2
HDL_ON/DAL/Mqtt/MqttClient.cs | 16
HDL-ON_Android/HDL-ON_Android.csproj | 2
HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs | 108 ++++++++++
HDL-ON_iOS/Resources/Language.ini | 31 ++
HDL_ON/Common/HDLCommon.cs | 2
HDL_ON/UI/UI0-Public/PublicAssmebly.cs | 12
HDL_ON/Common/UserInfo.cs | 24 +
HDL-ON_Android/Assets/Phone/Public/RightIcon2.png | 0
HDL_ON/Common/R.cs | 17 +
HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPage.cs | 58 -----
HDL-ON_iOS/Resources/Phone/Collection/TokenInvalidTipIcon.png | 0
HDL_ON/DAL/Server/HttpServerRequest.cs | 5
HDL_ON/DAL/DriverLayer/Control.cs | 12
HDL_ON/UI/MainPage.cs | 58 -----
22 files changed, 323 insertions(+), 223 deletions(-)
diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini
index 0a74118..a942d15 100644
--- a/HDL-ON_Android/Assets/Language.ini
+++ b/HDL-ON_Android/Assets/Language.ini
@@ -691,6 +691,10 @@
704=Non Chinese users choose
705=Please select a server
706=NewEnergy
+707=Off-line Controlling, to switch to remote control, click here to login.
+708=Your current login status has expired, please log in again.
+709=Log in
+710=Off-line Control
@@ -2097,9 +2101,10 @@
704=闈炰腑鍥界敤鎴烽�夋嫨
705=璇烽�夋嫨鏈嶅姟鍣�
706=鏂拌兘婧�
-
-
-
+707=绂荤嚎鎺у埗涓紝濡傞渶鍒囨崲鑷宠繙绋嬫帶鍒讹紝鐐规鐧诲綍
+708=鎮ㄥ綋鍓嶇殑鐧诲綍鐘舵�佸凡缁忓け鏁堬紝璇烽噸鏂扮櫥褰�
+709=鍘荤櫥褰�
+710=绂荤嚎鎺у埗
@@ -3500,7 +3505,10 @@
704=Non Chinese users choose
705=Please select a server
706=NewEnergy
-
+707=Off-line Controlling, to switch to remote control, click here to login.
+708=Your current login status has expired, please log in again.
+709=Log in
+710=Off-line Control
@@ -4898,7 +4906,10 @@
704=Non Chinese users choose
705=Please select a server
706=NewEnergy
-
+707=Off-line Controlling, to switch to remote control, click here to login.
+708=Your current login status has expired, please log in again.
+709=Log in
+710=Off-line Control
@@ -6284,7 +6295,10 @@
704=Non Chinese users choose
705=Please select a server
706=NewEnergy
-
+707=Off-line Controlling, to switch to remote control, click here to login.
+708=Your current login status has expired, please log in again.
+709=Log in
+710=Off-line Control
@@ -7688,7 +7702,10 @@
704=Non Chinese users choose
705=Please select a server
706=NewEnergy
-
+707=Off-line Controlling, to switch to remote control, click here to login.
+708=Your current login status has expired, please log in again.
+709=Log in
+710=Off-line Control
diff --git a/HDL-ON_Android/Assets/Phone/Collection/TokenInvalidTipIcon.png b/HDL-ON_Android/Assets/Phone/Collection/TokenInvalidTipIcon.png
new file mode 100644
index 0000000..b48cc2e
--- /dev/null
+++ b/HDL-ON_Android/Assets/Phone/Collection/TokenInvalidTipIcon.png
Binary files differ
diff --git a/HDL-ON_Android/Assets/Phone/Public/RightIcon2.png b/HDL-ON_Android/Assets/Phone/Public/RightIcon2.png
new file mode 100644
index 0000000..9821b76
--- /dev/null
+++ b/HDL-ON_Android/Assets/Phone/Public/RightIcon2.png
Binary files differ
diff --git a/HDL-ON_Android/HDL-ON_Android.csproj b/HDL-ON_Android/HDL-ON_Android.csproj
index ac42475..025fd1c 100644
--- a/HDL-ON_Android/HDL-ON_Android.csproj
+++ b/HDL-ON_Android/HDL-ON_Android.csproj
@@ -669,6 +669,8 @@
<AndroidAsset Include="Assets\Phone\FunctionIcon\Acst\Inverter\BatteryIconDischarg100.png" />
<AndroidAsset Include="Assets\Phone\FunctionIcon\Acst\Inverter\BatteryIconFault100.png" />
<AndroidAsset Include="Assets\Phone\FunctionIcon\Acst\Inverter\BatteryIconShutdown100.png" />
+ <AndroidAsset Include="Assets\Phone\Collection\TokenInvalidTipIcon.png" />
+ <AndroidAsset Include="Assets\Phone\Public\RightIcon2.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\values\colors.xml" />
diff --git a/HDL-ON_iOS/HDL-ON_iOS.csproj b/HDL-ON_iOS/HDL-ON_iOS.csproj
index 7bf23ac..6d6eb34 100644
--- a/HDL-ON_iOS/HDL-ON_iOS.csproj
+++ b/HDL-ON_iOS/HDL-ON_iOS.csproj
@@ -1847,6 +1847,8 @@
<BundleResource Include="Resources\Phone\FunctionIcon\Acst\Inverter\BatteryIconDischarg100.png" />
<BundleResource Include="Resources\Phone\FunctionIcon\Acst\Inverter\BatteryIconFault100.png" />
<BundleResource Include="Resources\Phone\FunctionIcon\Acst\Inverter\BatteryIconShutdown100.png" />
+ <BundleResource Include="Resources\Phone\Collection\TokenInvalidTipIcon.png" />
+ <BundleResource Include="Resources\Phone\Public\RightIcon2.png" />
</ItemGroup>
<ItemGroup>
<ITunesArtwork Include="iTunesArtwork" />
diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini
index 0a74118..a942d15 100644
--- a/HDL-ON_iOS/Resources/Language.ini
+++ b/HDL-ON_iOS/Resources/Language.ini
@@ -691,6 +691,10 @@
704=Non Chinese users choose
705=Please select a server
706=NewEnergy
+707=Off-line Controlling, to switch to remote control, click here to login.
+708=Your current login status has expired, please log in again.
+709=Log in
+710=Off-line Control
@@ -2097,9 +2101,10 @@
704=闈炰腑鍥界敤鎴烽�夋嫨
705=璇烽�夋嫨鏈嶅姟鍣�
706=鏂拌兘婧�
-
-
-
+707=绂荤嚎鎺у埗涓紝濡傞渶鍒囨崲鑷宠繙绋嬫帶鍒讹紝鐐规鐧诲綍
+708=鎮ㄥ綋鍓嶇殑鐧诲綍鐘舵�佸凡缁忓け鏁堬紝璇烽噸鏂扮櫥褰�
+709=鍘荤櫥褰�
+710=绂荤嚎鎺у埗
@@ -3500,7 +3505,10 @@
704=Non Chinese users choose
705=Please select a server
706=NewEnergy
-
+707=Off-line Controlling, to switch to remote control, click here to login.
+708=Your current login status has expired, please log in again.
+709=Log in
+710=Off-line Control
@@ -4898,7 +4906,10 @@
704=Non Chinese users choose
705=Please select a server
706=NewEnergy
-
+707=Off-line Controlling, to switch to remote control, click here to login.
+708=Your current login status has expired, please log in again.
+709=Log in
+710=Off-line Control
@@ -6284,7 +6295,10 @@
704=Non Chinese users choose
705=Please select a server
706=NewEnergy
-
+707=Off-line Controlling, to switch to remote control, click here to login.
+708=Your current login status has expired, please log in again.
+709=Log in
+710=Off-line Control
@@ -7688,7 +7702,10 @@
704=Non Chinese users choose
705=Please select a server
706=NewEnergy
-
+707=Off-line Controlling, to switch to remote control, click here to login.
+708=Your current login status has expired, please log in again.
+709=Log in
+710=Off-line Control
diff --git a/HDL-ON_iOS/Resources/Phone/Collection/TokenInvalidTipIcon.png b/HDL-ON_iOS/Resources/Phone/Collection/TokenInvalidTipIcon.png
new file mode 100644
index 0000000..b48cc2e
--- /dev/null
+++ b/HDL-ON_iOS/Resources/Phone/Collection/TokenInvalidTipIcon.png
Binary files differ
diff --git a/HDL-ON_iOS/Resources/Phone/Public/RightIcon2.png b/HDL-ON_iOS/Resources/Phone/Public/RightIcon2.png
new file mode 100644
index 0000000..9821b76
--- /dev/null
+++ b/HDL-ON_iOS/Resources/Phone/Public/RightIcon2.png
Binary files differ
diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs
index d4666d5..93b3a72 100644
--- a/HDL_ON/Common/ApiUtlis.cs
+++ b/HDL_ON/Common/ApiUtlis.cs
@@ -4,6 +4,7 @@
using System.Threading.Tasks;
using HDL_ON.DAL.Server;
using HDL_ON.Entity;
+using HDL_ON.UI;
using HDL_ON.UI.UI2.FuntionControlView.Video;
using HDL_ON.UI.UI2.Intelligence.Automation;
using Newtonsoft.Json;
@@ -104,7 +105,7 @@
string code = StateCode.SUCCESS;
Inverter.Ins.H5Page = null;//閲嶇疆鍏変紡椤甸潰
- var downloadDataThread = new System.Threading.Thread(async() =>
+ var downloadDataThread = new System.Threading.Thread(() =>
{
try
{
@@ -279,26 +280,6 @@
return;
}
MainPage.Log($"鍒锋柊涓汉淇℃伅鎴愬姛");
-
- //int count = 0;
- //while (count < 10)
- //{
- // if (DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull())
- // {
- // System.Threading.Thread.Sleep(200);
- // }
- // else
- // {
- // break;
- // }
- // count++;
- //}
- //if (DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull())
- //{
- // return;
- //}
-
- //return;
try
{
@@ -746,6 +727,34 @@
catch (Exception ex){
MainPage.Log("Error", $"璇诲彇鏈湴鏁版嵁寮傚父锛歿ex.StackTrace}");
}
+
+ try
+ {
+ HomePage.LoadEvent_CheckTokenValid();
+ if (IsValidToken && !UserInfo.Current.IsTipedInvalidToken)
+ {
+ UserInfo.Current.IsTipedInvalidToken = true;
+ UserInfo.Current.SaveUserInfo();
+ Application.RunOnMainThread(() =>
+ {
+ try
+ {
+ new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.TokenInvalidTipMsg, StringId.OfflineControl, StringId.GoLogin, () =>
+ {
+ HDLCommon.Current.Logout();
+ });
+ }
+ catch (Exception ex)
+ {
+ MainPage.Log("Error", $"鎻愮ず鐧诲綍鍑瘉绐楀彛鍔犺浇寮傚父:{ex.StackTrace}");
+ }
+ });
+ }
+ }
+ catch (Exception ex)
+ {
+ MainPage.Log("Error", $"鏇存柊鐧诲綍鍑瘉鏂规硶璋冪敤寮傚父:{ex.StackTrace}");
+ }
}
}
})
@@ -778,39 +787,50 @@
{
lock (FunctionList.List.securities)
{
- var pack = Ins.HttpRequest.GetSecurityList();
- if (pack.Code == StateCode.SUCCESS)
+ try
{
- var packList = JsonConvert.DeserializeObject<List<SecurityAlarm>>(pack.Data.ToString());
- Console.WriteLine("瀹夐槻鎬绘暟锛�" + packList.Count);
- var sidList = new List<string>();
- foreach (var function in packList)
+ var pack = Ins.HttpRequest.GetSecurityList();
+ if (pack.Code == StateCode.SUCCESS)
{
- sidList.Add(function.sid);
- }
- var infoListPack = Ins.httpRequest.GetSecurityInfo(sidList, new List<string>());
- var infoList = JsonConvert.DeserializeObject<List<SecurityAlarm>>(infoListPack.Data.ToString());
- if (infoList != null)
- {
- var filePathList = FileUtlis.Files.ReadFiles().FindAll((obj) => obj.StartsWith("SecurityData_"));
- if (filePathList != null)
+ var packList = JsonConvert.DeserializeObject<List<SecurityAlarm>>(pack.Data.ToString());
+ Console.WriteLine("瀹夐槻鎬绘暟锛�" + packList.Count);
+ var sidList = new List<string>();
+ foreach (var function in packList)
{
- foreach (var file in filePathList)
+ sidList.Add(function.sid);
+ }
+ if (sidList.Count == 0)
+ {
+ return;
+ }
+ var infoListPack = Ins.httpRequest.GetSecurityInfo(sidList, new List<string>());
+ var infoList = JsonConvert.DeserializeObject<List<SecurityAlarm>>(infoListPack.Data.ToString());
+ if (infoList != null)
+ {
+ var filePathList = FileUtlis.Files.ReadFiles().FindAll((obj) => obj.StartsWith("SecurityData_"));
+ if (filePathList != null)
{
- FileUtlis.Files.DeleteFile(file);
+ foreach (var file in filePathList)
+ {
+ FileUtlis.Files.DeleteFile(file);
+ }
+ }
+ FunctionList.List.securities.Clear();
+ foreach (var function in infoList)
+ {
+ function.SaveFile();
+ FunctionList.List.IniFunctionList(function.savePath, true);
}
}
- FunctionList.List.securities.Clear();
- foreach (var function in infoList)
- {
- function.SaveFile();
- FunctionList.List.IniFunctionList(function.savePath, true);
- }
+ }
+ else
+ {
+ MainPage.Log($"璇诲彇瀹夐槻鍒楄〃澶辫触:Code:{pack.Code}; Msg:{pack.message}");
}
}
- else
+ catch (Exception ex)
{
- MainPage.Log($"璇诲彇瀹夐槻鍒楄〃澶辫触:Code:{pack.Code}; Msg:{pack.message}");
+ MainPage.Log("Error", $"璇诲彇瀹夐槻鍒楄〃澶辫触:Code:{ex.StackTrace}");
}
}
}
diff --git a/HDL_ON/Common/HDLCommon.cs b/HDL_ON/Common/HDLCommon.cs
index 5944bdc..c9e3c41 100644
--- a/HDL_ON/Common/HDLCommon.cs
+++ b/HDL_ON/Common/HDLCommon.cs
@@ -602,7 +602,7 @@
//6.娓呯┖Siri鍏变韩鏁版嵁淇℃伅
new Other.SkipControl().SetData(false, "", "", "", "");
var sDM = new SiriKit.SceneDateManager();
- Console.WriteLine($"IsLogin:{sDM.IsLgoin};accessToken:{sDM.AccessToken};refreshToken:{sDM.RefreshToken};RegionUrl:{sDM.RegionUrl};HomeId:{sDM.HomeId}");
+ //Console.WriteLine($"IsLogin:{sDM.IsLgoin};accessToken:{sDM.AccessToken};refreshToken:{sDM.RefreshToken};RegionUrl:{sDM.RegionUrl};HomeId:{sDM.HomeId}");
#endif
}
catch (Exception ex)
diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs
index b0e0a67..8353782 100644
--- a/HDL_ON/Common/R.cs
+++ b/HDL_ON/Common/R.cs
@@ -5,6 +5,23 @@
{
public static class StringId
{
+
+ /// <summary>
+ /// 绂荤嚎鎺у埗
+ /// </summary>
+ public const int OfflineControl = 710;
+ /// <summary>
+ /// 鍘荤櫥褰�
+ /// </summary>
+ public const int GoLogin = 709;
+ /// <summary>
+ /// 鎮ㄥ綋鍓嶇殑鐧诲綍鐘舵�佸凡缁忓け鏁堬紝璇烽噸鏂扮櫥褰�
+ /// </summary>
+ public const int TokenInvalidTipMsg = 708;
+ /// <summary>
+ /// 绂荤嚎鎺у埗涓紝濡傞渶鍒囨崲鑷宠繙绋嬫帶鍒讹紝鐐规鐧诲綍
+ /// </summary>
+ public const int TokenInvalidMsg = 707;
/// <summary>
/// 鏂拌兘婧�
/// </summary>
diff --git a/HDL_ON/Common/UserInfo.cs b/HDL_ON/Common/UserInfo.cs
index 1e53ae7..4f59c01 100644
--- a/HDL_ON/Common/UserInfo.cs
+++ b/HDL_ON/Common/UserInfo.cs
@@ -164,19 +164,27 @@
/// </summary>
public List<RegionInfoRes> regionList = new List<RegionInfoRes>();
/// <summary>
+ /// token鏄惁鏈夋晥
+ /// </summary>
+ public bool ValidToken = false;
+ /// <summary>
+ /// 鏄惁鎻愮ず杩嘥oken杩囨湡
+ /// </summary>
+ public bool IsTipedInvalidToken = false;
+ /// <summary>
/// 涓婁竴娆$櫥褰曟椂闂�
/// </summary>
- public DateTime LastTime = DateTime.MinValue;
+ //public DateTime LastTime = DateTime.MinValue;
/// <summary>
/// 鏄惁鏄櫥褰曠姸鎬�
/// </summary>
- public bool IsLogin
- {
- get
- {
- return (DateTime.Now - LastTime).TotalDays < 7;
- }
- }
+ //public bool IsLogin = false;
+ //{
+ // get
+ // {
+ // return (DateTime.Now - LastTime).TotalDays < 7;
+ // }
+ //}
[Newtonsoft.Json.JsonIgnore]
public DateTime LastTimeOpenDoor = DateTime.MinValue;
diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index 318bd99..baec645 100644
--- a/HDL_ON/DAL/DriverLayer/Control.cs
+++ b/HDL_ON/DAL/DriverLayer/Control.cs
@@ -276,8 +276,8 @@
public void SearchLoaclGateway()
{
//2021-01-15 : 浣忓畢娌℃湁缁戝畾缃戝叧鐨勬椂鍊欎笉鐢ㄦ悳绱紝骞朵笖涓嶈兘閾炬帴mqtt
- if (DB_ResidenceData.Instance.HomeGateway == null || string.IsNullOrEmpty(DB_ResidenceData.Instance.HomeGateway.gatewayId) ||
- !UserInfo.Current.IsLogin)
+ if (DB_ResidenceData.Instance.HomeGateway == null || string.IsNullOrEmpty(DB_ResidenceData.Instance.HomeGateway.gatewayId))
+ //|| !UserInfo.Current.IsLogin)
{
return;
}
@@ -978,10 +978,10 @@
/// <returns></returns>
public void ConvertReceiveData(byte[] receiveBytes, string ip)
{
- if (!UserInfo.Current.IsLogin)
- {
- return;
- }
+ //if (!UserInfo.Current.IsLogin)
+ //{
+ // return;
+ //}
var reString = Encoding.UTF8.GetString(receiveBytes);
AnalysisReceiveData(reString, receiveBytes, ip);
}
diff --git a/HDL_ON/DAL/DriverLayer/Control_Udp.cs b/HDL_ON/DAL/DriverLayer/Control_Udp.cs
index 6ad5775..a697e0b 100644
--- a/HDL_ON/DAL/DriverLayer/Control_Udp.cs
+++ b/HDL_ON/DAL/DriverLayer/Control_Udp.cs
@@ -104,7 +104,7 @@
try
{
//璐﹀彿娌$櫥褰曚笉鍥炲
- if ( UserInfo.Current == null || ! UserInfo.Current.IsLogin)
+ if ( UserInfo.Current == null )///|| ! UserInfo.Current.IsLogin)
{
return;
}
diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs
index cea69ec..36272cc 100644
--- a/HDL_ON/DAL/Mqtt/MqttClient.cs
+++ b/HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -353,10 +353,10 @@
}
MainPage.LinkHdlMqttCount++;
- if (!UserInfo.Current.IsLogin)
- {
- return;
- }
+ //if (!UserInfo.Current.IsLogin)
+ //{
+ // return;
+ //}
if (DB_ResidenceData.Instance.CurrentRegion == null || DB_ResidenceData.Instance.CurrentRegion.id == null)
{
return;
@@ -868,10 +868,10 @@
return;
}
- if (!UserInfo.Current.IsLogin)
- {
- return;
- }
+ //if (!UserInfo.Current.IsLogin)
+ //{
+ // return;
+ //}
DisConnectRemoteMqttClient("鎸や笅绾�");
diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs
index d818a1c..10cec37 100644
--- a/HDL_ON/DAL/Server/HttpServerRequest.cs
+++ b/HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -171,7 +171,7 @@
UserInfo.Current.LoginTokenString = revertData.headerPrefix + revertData.accessToken;
UserInfo.Current.AccessToken = revertData.accessToken;
UserInfo.Current.RefreshToken = revertData.refreshToken;
- UserInfo.Current.LastTime = DateTime.Now;
+ UserInfo.Current.ValidToken = true;
UserInfo.Current.SaveUserInfo();
#if __IOS__
@@ -182,7 +182,7 @@
}
else if (revertObj.Code == StateCode.PasswrodError)
{
- UserInfo.Current.LastTime = DateTime.MinValue;
+ UserInfo.Current.ValidToken = false;
}
#if __IOS__
else if (revertObj.Code == "10001")
@@ -190,7 +190,6 @@
if (canRefresh)
{
UserInfo.Current.RefreshToken = SiriKit.NSUserDefaultsHelper.DataSuite.StringForKey(SiriKit.NSUserDefaultsHelper.StorageKeys.GLOBAL_GRefreshToken);
- //UserInfo.Current.AccessToken = SiriKit.NSUserDefaultsHelper.DataSuite.StringForKey(SiriKit.NSUserDefaultsHelper.StorageKeys.GLOBAL_GAccessToken);
RefreshToken(false);
}
}
diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs
index fe8645f..5abbe13 100644
--- a/HDL_ON/UI/MainPage.cs
+++ b/HDL_ON/UI/MainPage.cs
@@ -171,44 +171,22 @@
BaseView = Application.MainPage;
Application.MainPage.BackgroundColor = CSS_Color.MainBackgroundColor;
- //Application.MainPage.BackgroundColor = 0xFFFF0000;// CSS_Color.MainBackgroundColor;
- //BaseView = new FrameLayout()
- //{
- // Y = Application.GetRealHeight(20),
- // Width = Application.GetRealWidth(376),
- // Height = Application.GetRealHeight(667),
- //};
- //Application.MainPage.AddChidren(BaseView);
Language.UpdateLanguage();
- //#region 娴嬭瘯
- //var ddd = new UI.test.TestDialog();
- //ddd.InitView();
- //return;
- //#endregion
if (string.IsNullOrEmpty(OnAppConfig.Instance.LastLoginUserId))
{
- GoLoginPage();
+ GoLoginPage(UserInfo.Current);
}
else
{
//鍒ゆ柇闇�涓嶉渶瑕佺櫥褰曪紝鏈夋病鏈夌櫥褰曪紝鎴栬�呯櫥褰曟槸鍚﹁繃鏈燂紝
- if (UserInfo.Current == null || !UserInfo.Current.IsLogin)
+ if (UserInfo.Current == null)// || !UserInfo.Current.IsLogin)
{
GoLoginPage(UserInfo.Current);
}
else
{
- //new System.Threading.Thread(() =>
- //{
- // var pm = new DAL.Server.HttpServerRequest();
- // pm.RefreshToken();//鍒锋柊Token
- // pm.GetHomePager();//鍒锋柊浣忓畢淇℃伅
- // pm.GetUserInfo();//鍒锋柊涓汉淇℃伅
- //})
- //{ IsBackground = true }.Start();
Common.ApiUtlis.Ins.DownloadData();
-
GoUserPage(false, true);
}
}
@@ -239,36 +217,6 @@
}
-//#if __ANDROID__
-// new System.Threading.Thread(async () =>
-// {
-// int i = 10;
-// while (i < 10) {
-// try
-// {
-// var location_android = await HDL_ON_Android.LocationUtils.GetCurrentLocationAsync();
-// if (location_android != null)
-// {
-// MainPage.cityInfo.lat = location_android.Latitude.ToString();
-// MainPage.cityInfo.lon = location_android.Longitude.ToString();
-// new HDL_ON.DAL.Server.HttpServerRequest().GetCityWeatherInfo(MainPage.cityInfo.lon.Replace(",", "."), MainPage.cityInfo.lat.ToString().Replace(",", "."));
-// i = 100;
-// Application.RunOnMainThread(() => {
-// HomePage.LoadEvent_RefreshAir();
-// });
-// }
-// else
-// {
-// i++;
-// }
-// } catch (Exception ex)
-// {
-// Log($"缁忕含搴﹁幏鍙栧紓甯�: {ex.Message}");
-// }
-// }
-// })
-// { IsBackground = true }.Start();
-//#endif
}
/// <summary>
@@ -284,6 +232,8 @@
}
}
catch { }
+ OnAppConfig.Instance.LastLoginUserId = "";
+ UserInfo.Current.ClearUserInfo();
BaseView.BackgroundColor = CSS_Color.BackgroundColor;
var fisrtView = new UI.UI1Login.LoginPage();
fisrtView.BackgroundColor = CSS_Color.MainBackgroundColor;
diff --git a/HDL_ON/UI/UI0-Public/PublicAssmebly.cs b/HDL_ON/UI/UI0-Public/PublicAssmebly.cs
index ef20fb3..5ac7e29 100644
--- a/HDL_ON/UI/UI0-Public/PublicAssmebly.cs
+++ b/HDL_ON/UI/UI0-Public/PublicAssmebly.cs
@@ -244,13 +244,19 @@
{
TipOptionMsg(titleId, Language.StringByID(msgId), callBackAction);
}
+
+ public void TipOptionMsg(int titleId, int msgId,int cancelTextId,int confrimTextId, Action callBackAction)
+ {
+ TipOptionMsg(titleId, Language.StringByID(msgId), callBackAction, 0,cancelTextId, confrimTextId);
+ }
+
/// <summary>
/// 鍔犺浇鎻愮ず寮圭獥
/// </summary>
/// <param name="titleId"></param>
/// <param name="msgId"></param>
/// <param name="callBackAction"></param>
- public void TipOptionMsg(int titleId, string msg, Action callBackAction,int extraHeight = 0)
+ public void TipOptionMsg(int titleId, string msg, Action callBackAction,int extraHeight = 0, int cancelTextId = StringId.Cancel, int confrimTextId = StringId.Confirm)
{
Dialog dialog = new Dialog()
{
@@ -314,7 +320,7 @@
TextSize = CSS_FontSize.SubheadingFontSize,
//SelectedTextColor = CSS_Color.MainBackgroundColor,
//SelectedBackgroundColor = CSS_Color.MainColor,
- TextID = StringId.Cancel,
+ TextID = cancelTextId,
};
contentView.AddChidren(btnCancel);
@@ -329,7 +335,7 @@
TextSize = CSS_FontSize.SubheadingFontSize,
TextColor = CSS_Color.MainBackgroundColor,
BackgroundColor = CSS_Color.MainColor,
- TextID = StringId.Confirm,
+ TextID = confrimTextId,
};
contentView.AddChidren(btnConfirm);
//渚嬶細鍙充笅鍦嗚 澶у皬涓�50
diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
index e69bd40..48d096f 100644
--- a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
@@ -1,5 +1,6 @@
锘縰sing System;
using System.Collections.Generic;
+using HDL_ON.Common;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
@@ -24,7 +25,11 @@
/// <summary>
/// 杩炴帴鐘舵�佹彁绀�
/// </summary>
- FrameLayout divLinkStateTip;
+ FrameLayout linkStateMsgView;
+ /// <summary>
+ /// 鐧诲綍鐘舵�佹彁绀哄尯鍩�
+ /// </summary>
+ FrameLayout tokenInvalidMsgView;
/// <summary>
/// 瀹夐槻鐘舵�佸浘鏍�
/// </summary>
@@ -159,14 +164,14 @@
};
topView = new FrameLayout()
{
- Height = Application.GetRealHeight(113),//216),
+ Height = Application.GetRealHeight(113) + Application.GetRealWidth(24),//216),
BackgroundImagePath = DB_ResidenceData.Instance.residenceImage,
};
bodyView.AddChidren(topView);
#else
VerticalRefreshLayout refreshLayout = new VerticalRefreshLayout()
{
- Height = Application.GetRealHeight(113),//216),
+ Height = Application.GetRealHeight(113) + Application.GetRealWidth(24),//216),
BackgroundImagePath = DB_ResidenceData.Instance.residenceImage,
};
bodyView.AddChidren(refreshLayout);
@@ -179,20 +184,21 @@
};
topView = new FrameLayout()
{
- Height = Application.GetRealHeight(113),//216),
+ Height = Application.GetRealHeight(113) + Application.GetRealWidth(24),//216),
};
refreshLayout.AddChidren(topView);
#endif
- #region topView
-
-
-
- Button btnTop;
- btnTop = new Button()
+ topView.AddChidren(new Button()
{
BackgroundColor = CSS_Color.DialogTransparentColor2,
- };
- topView.AddChidren(btnTop);
+ });
+
+ topView.AddChidren(
+ new Button() {Y = Application.GetRealHeight(113),
+ BackgroundColor = CSS_Color.BackgroundColor,
+ Height = Application.GetRealWidth(24) });
+
+ #region topView
btnResidenceName = new Button()
{
@@ -207,15 +213,19 @@
IsBold = true
};
topView.AddChidren(btnResidenceName);
+ //鐧诲綍鍑瘉鏄惁鏈夋晥
+ CheckTokenValid();
- divLinkStateTip = new FrameLayout()
+ #region 缃戝叧杩炴帴鐘舵��
+ linkStateMsgView = new FrameLayout()
{
- Y = Application.GetRealHeight(113) - Application.GetRealWidth(24),
+ Y = ApiUtlis.Ins.IsValidToken ? Application.GetRealHeight(113) : Application.GetRealHeight(113) - Application.GetRealWidth(24),
Height = Application.GetRealWidth(24),
BackgroundColor = 0xFFFF4747,
Visible = false,
};
- topView.AddChidren(divLinkStateTip);
+ topView.AddChidren(linkStateMsgView);
+
Button btnLinkStateIcon = new Button()
{
X = Application.GetRealWidth(16),
@@ -224,7 +234,7 @@
Height = Application.GetRealWidth(20),
UnSelectedImagePath = "Collection/GatewayOnlineTipIcon.png"
};
- divLinkStateTip.AddChidren(btnLinkStateIcon);
+ linkStateMsgView.AddChidren(btnLinkStateIcon);
var btnLinkStateTip = new Button()
{
@@ -234,15 +244,18 @@
TextColor = CSS_Color.MainBackgroundColor,
TextID = StringId.NetworkAnomaly,
};
- divLinkStateTip.AddChidren(btnLinkStateTip);
+ linkStateMsgView.AddChidren(btnLinkStateTip);
+
//鏇存柊閾炬帴鐘舵�乮con棰滆壊
+ CheckLinkStatus();//2020-12-22
+ #endregion
+
environmentalView = new FrameLayout()
{
Y = Application.GetRealHeight(1) + btnResidenceName.Bottom,
Height = Application.GetRealHeight(32),
};
topView.AddChidren(environmentalView);
- CheckLinkStatus();//2020-12-22
#region 鐜鏁版嵁
var tempSensorList = FunctionList.List.GetEnvirSensorsList().FindAll((obj) => obj.spk == SPK.SensorTemperature);
@@ -535,7 +548,7 @@
#region 鍔熻兘鍦烘櫙鍒囨崲
- bodyView.AddChidren(new Button() { Height = Application.GetRealHeight(20), BackgroundColor = 0xFFFF0000 });
+ //bodyView.AddChidren(new Button() { Height = Application.GetRealHeight(20), BackgroundColor = 0xFFFF0000 });
loadNavView();
@@ -553,10 +566,7 @@
#if DEBUG
btnResidenceName.MouseUpEventHandler = (envent, ee) =>
{
- MainPage.Log("sss");
-
#if __ANDROID__
- //HDLLinphoneKit.Instance.MediaPlayerLooping(true);
Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.PlayRingtone();
#elif __IOS__
diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
index dd9844d..6093297 100644
--- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
@@ -1,8 +1,10 @@
锘縰sing System;
using System.Collections.Generic;
+using HDL_ON.Common;
using HDL_ON.DAL.Server;
using HDL_ON.DriverLayer;
using HDL_ON.Entity;
+using HDL_ON.UI.CSS;
using Shared;
namespace HDL_ON.UI
@@ -254,7 +256,87 @@
}
}
+ void CheckTokenValid()
+ {
+ //Dome妯″紡
+ if (MainPage.NoLoginMode)
+ {
+ return;
+ }
+ try
+ {
+ #region 璐﹀彿鐧诲綍鐘舵�侊紙鐧诲綍token鏄惁鏈夋晥锛�
+ if (ApiUtlis.Ins.IsValidToken)
+ {
+ if (tokenInvalidMsgView == null)
+ {
+ tokenInvalidMsgView = new FrameLayout()
+ {
+ Y = Application.GetRealHeight(113) - Application.GetRealWidth(24),
+ Height = Application.GetRealWidth(24),
+ BackgroundColor = 0xFF69A0F7,
+ };
+ topView.AddChidren(tokenInvalidMsgView);
+
+ Button btnTokenInvalidIcon = new Button()
+ {
+ X = Application.GetRealWidth(16),
+ Gravity = Gravity.CenterVertical,
+ Width = Application.GetRealWidth(20),
+ Height = Application.GetRealWidth(20),
+ UnSelectedImagePath = "Collection/TokenInvalidTipIcon.png"
+ };
+ tokenInvalidMsgView.AddChidren(btnTokenInvalidIcon);
+ var btnTokenInvalidTip = new Button()
+ {
+ X = btnTokenInvalidIcon.Right + Application.GetRealWidth(4),
+ TextAlignment = TextAlignment.CenterLeft,
+ TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+ TextColor = CSS_Color.MainBackgroundColor,
+ TextID = StringId.TokenInvalidMsg,
+ };
+ btnTokenInvalidTip.Width = btnTokenInvalidTip.GetTextWidth() + Application.GetRealWidth(8);
+ tokenInvalidMsgView.AddChidren(btnTokenInvalidTip);
+ btnTokenInvalidTip.MouseUpEventHandler = (sender, e) => {
+ new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.TokenInvalidTipMsg,StringId.Cancel,StringId.GoLogin, () => {
+ HDLCommon.Current.Logout();
+ });
+ };
+
+ var btnRight = new Button()
+ {
+ X= btnTokenInvalidTip.Right,
+ Gravity = Gravity.CenterVertical,
+ Width = Application.GetMinRealAverage(8),
+ Height = Application.GetMinRealAverage(8),
+ UnSelectedImagePath = "Public/RightIcon2.png",
+ };
+
+ tokenInvalidMsgView.AddChidren(btnRight);
+
+ }
+ }
+ else
+ {
+ if (tokenInvalidMsgView != null)
+ {
+ if (tokenInvalidMsgView.Parent != null)
+ {
+ tokenInvalidMsgView.RemoveAll();
+ tokenInvalidMsgView.RemoveFromParent();
+ tokenInvalidMsgView = null;
+ }
+ }
+ }
+ #endregion
+ bodyView.linkStateMsgView.Y = ApiUtlis.Ins.IsValidToken ? Application.GetRealHeight(113) : Application.GetRealHeight(113) - Application.GetRealWidth(24);
+ }
+ catch (Exception ex)
+ {
+ MainPage.Log("Error", $"HomePage 璐﹀彿鐧诲綍鐘舵�佷俊鎭樉绀哄紓甯�:{ex.StackTrace}");
+ }
+ }
/// <summary>
/// 鏇存柊杩炴帴鐘舵�佸浘鏍�
@@ -267,13 +349,15 @@
return;
}
+ bodyView.linkStateMsgView.Y = ApiUtlis.Ins.IsValidToken ? Application.GetRealHeight(113) : Application.GetRealHeight(113) - Application.GetRealWidth(24);
+
if (!Control.Ins.GatewayOnline_Local && !Control.Ins.GatewayOnline_Cloud)
{
- bodyView.divLinkStateTip.Visible = true;
+ bodyView.linkStateMsgView.Visible = true;
}
else
{
- bodyView.divLinkStateTip.Visible = false;
+ bodyView.linkStateMsgView.Visible = false;
}
}
@@ -296,6 +380,26 @@
}
});
}
+ /// <summary>
+ /// 纭Token鏄惁鏈夋晥
+ /// </summary>
+ public static void LoadEvent_CheckTokenValid()
+ {
+ Application.RunOnMainThread(() =>
+ {
+ try
+ {
+ if (bodyView != null)
+ {
+ bodyView.CheckTokenValid();
+ }
+ }
+ catch (Exception ex)
+ {
+ MainPage.Log("Error",$"LoadEvent_CheckTokenValid : {ex.StackTrace}");
+ }
+ });
+ }
/// <summary>
/// 鍔犺浇鍔熻兘鏀惰棌鎸夐挳浜嬩欢
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPage.cs
index 85a2377..d62276a 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPage.cs
@@ -444,7 +444,7 @@
userEmailInfoView.AddChidren(btnUserEmailRight);
optionListView.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor });
#endregion
-#region 涓汉閫夐」-鎵嬫満淇℃伅鍖哄煙
+ #region 涓汉閫夐」-鎵嬫満淇℃伅鍖哄煙
/// <summary>
/// 涓汉閫夐」-鎵嬫満淇℃伅鍖哄煙
/// </summary>
@@ -559,11 +559,11 @@
resetPasswordView.AddChidren(btnResetPasswordRight);
optionListView.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor });
#endregion
-
+
#region 涓汉閫夐」-娣诲姞浣忓畢
addResidenceView = new FrameLayout()
{
- Height = Application.GetRealHeight(50),
+ Height = Application.GetRealHeight(50),
};
optionListView.AddChidren(addResidenceView);
btnAddResidenceScan = new Button()
@@ -765,58 +765,6 @@
Height = Application.GetRealHeight(8)
};
bodyScrolView.AddChidren(topPaddingView2);
-
-#region 瑙i攣璁剧疆鍖哄煙
- ///// <summary>
- ///// 瑙i攣璁剧疆鍖哄煙
- ///// </summary>
- //interpretationSettingsView = new FrameLayout()
- //{
- // BackgroundColor = CSS_Color.MainBackgroundColor,
- // Height = Application.GetRealHeight(70),
- //};
- //bodyScrolView.AddChidren(interpretationSettingsView);
- //if(Language.CurrentLanguage != "Chinese")
- //{
- // interpretationSettingsView.Height = Application.GetRealHeight(80);
- //}
-
- //btnInterpretationSettingsTitle = new Button()
- //{
- // X = Application.GetRealWidth(16),
- // Height = Application.GetRealHeight(32),
- // TextAlignment = TextAlignment.BottomLeft,
- // TextColor = CSS_Color.FirstLevelTitleColor,
- // TextSize = CSS_FontSize.SubheadingFontSize,
- // TextID = StringId.InterpretationSettings,
- //};
- //interpretationSettingsView.AddChidren(btnInterpretationSettingsTitle);
-
- //btnInterpretationSettingsTip = new Button()
- //{
- // X = Application.GetRealWidth(16),
- // Y = btnInterpretationSettingsTitle.Bottom,
- // Height = Application.GetRealHeight(32),
- // Width = Application.GetRealWidth(310),
- // TextAlignment = TextAlignment.TopLeft,
- // TextColor = CSS_Color.PromptingColor1,
- // TextSize = CSS_FontSize.TextFontSize,
- // TextID = StringId.AppUnlockSettingsTip,
- // IsMoreLines = true,
- //};
- //interpretationSettingsView.AddChidren(btnInterpretationSettingsTip);
-
- //btnInterpretationSettingsRight = new Button()
- //{
- // X = Application.GetRealWidth(339),
- // Gravity = Gravity.CenterVertical,
- // Width = Application.GetMinRealAverage(16),
- // Height = Application.GetMinRealAverage(16),
- // UnSelectedImagePath = "Public/Right.png",
- //};
- //interpretationSettingsView.AddChidren(btnInterpretationSettingsRight);
- //interpretationSettingsView.AddChidren(new LineView(interpretationSettingsView.Height));
-#endregion
#region 鏈嶅姟鍣ㄤ俊鎭�
ListCellView myServerInfoCellView = new ListCellView()
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs
index e84a5cb..706e841 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs
@@ -420,7 +420,7 @@
}
#endregion
-#region 瑙i攣璁剧疆鍖哄煙
+ #region 瑙i攣璁剧疆鍖哄煙
//void LoadEvent_SkipInterpretationSettings()
//{
// EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
--
Gitblit v1.8.0