From 7e29d6e716ade9c9bc89ebd24cd6f35635c35767 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 06 六月 2023 11:20:10 +0800
Subject: [PATCH] 修复游客模式闪退问题
---
HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs | 8 ++++
HDL_ON/UI/UI2/1-HomePage/HomePage.cs | 10 +++--
HDL_ON/UI/UI2/UserPage.cs | 10 ++---
HDL_ON/Common/ApiUtlis.cs | 3 +
HDL_ON/UI/UI2/UserPageBLL.cs | 18 ---------
HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs | 16 ++++++++
HDL_ON/UI/MainPage.cs | 3 +
HDL-ON_iOS/AppDelegate.cs | 36 +++++++++---------
HDL_ON/DAL/Mqtt/MqttClient.cs | 2
9 files changed, 58 insertions(+), 48 deletions(-)
diff --git a/HDL-ON_iOS/AppDelegate.cs b/HDL-ON_iOS/AppDelegate.cs
index 36f83cb..e2c07be 100644
--- a/HDL-ON_iOS/AppDelegate.cs
+++ b/HDL-ON_iOS/AppDelegate.cs
@@ -199,12 +199,12 @@
public override void DidEnterBackground(UIApplication application)
{
//璁剧疆鍏ㄨ閫氱姸鎬�
- string systemVersion = UIKit.UIDevice.CurrentDevice.SystemVersion;
- string errorVersion = "16.2.0";
- if (systemVersion.CompareTo(errorVersion) < 0)///鍏ㄨ閫氫笉鍏煎ios16浠ヤ笂鐨勭郴缁燂紝涓嶈鍔犺浇杩欎釜鍏�
- {
- Shared.IOS.HDLFVSDK.Video.FVapplicationDidEnterBackground(application);
- }
+ //string systemVersion = UIKit.UIDevice.CurrentDevice.SystemVersion;
+ //string errorVersion = "16.2.0";
+ //if (systemVersion.CompareTo(errorVersion) < 0)///鍏ㄨ閫氫笉鍏煎ios16浠ヤ笂鐨勭郴缁燂紝涓嶈鍔犺浇杩欎釜鍏�
+ //{
+ // Shared.IOS.HDLFVSDK.Video.FVapplicationDidEnterBackground(application);
+ //}
//SharedMethod.SharedMethod.IsBackground = true;
//MainPage.IsEnterBackground = true;
////杩涘叆鍚庡彴mqtt姝e湪杩炴帴閲嶇疆鐘舵��
@@ -231,12 +231,12 @@
public override void OnActivated(UIApplication application)
{
//璁剧疆鍏ㄨ閫氱姸鎬�
- string systemVersion = UIKit.UIDevice.CurrentDevice.SystemVersion;
- string errorVersion = "16.2.0";
- if (systemVersion.CompareTo(errorVersion) < 0)///鍏ㄨ閫氫笉鍏煎ios16浠ヤ笂鐨勭郴缁燂紝涓嶈鍔犺浇杩欎釜鍏�
- {
- Shared.IOS.HDLFVSDK.Video.FVapplicationDidBecomeActive(application);
- }
+ //string systemVersion = UIKit.UIDevice.CurrentDevice.SystemVersion;
+ //string errorVersion = "16.2.0";
+ //if (systemVersion.CompareTo(errorVersion) < 0)///鍏ㄨ閫氫笉鍏煎ios16浠ヤ笂鐨勭郴缁燂紝涓嶈鍔犺浇杩欎釜鍏�
+ //{
+ // Shared.IOS.HDLFVSDK.Video.FVapplicationDidBecomeActive(application);
+ //}
Console.WriteLine("OnActivated");
base.OnActivated(application);
//HDL_ON.DriverLayer.Control.Ins.SearchLoaclGateway();
@@ -294,12 +294,12 @@
{
//璁剧疆鍏ㄨ閫氱姸鎬�
- string systemVersion = UIKit.UIDevice.CurrentDevice.SystemVersion;
- string errorVersion = "16.2.0";
- if (systemVersion.CompareTo(errorVersion) < 0)///鍏ㄨ閫氫笉鍏煎ios16浠ヤ笂鐨勭郴缁燂紝涓嶈鍔犺浇杩欎釜鍏�
- {
- Shared.IOS.HDLFVSDK.Video.FVapplication(application, new NSDictionary());
- }
+ //string systemVersion = UIKit.UIDevice.CurrentDevice.SystemVersion;
+ //string errorVersion = "16.2.0";
+ //if (systemVersion.CompareTo(errorVersion) < 0)///鍏ㄨ閫氫笉鍏煎ios16浠ヤ笂鐨勭郴缁燂紝涓嶈鍔犺浇杩欎釜鍏�
+ //{
+ // Shared.IOS.HDLFVSDK.Video.FVapplication(application, new NSDictionary());
+ //}
Console.WriteLine("111111111111");
SetCurrentLanguage();
//Shared.Application.FontSize = 12;
diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs
index ae98d39..5980873 100644
--- a/HDL_ON/Common/ApiUtlis.cs
+++ b/HDL_ON/Common/ApiUtlis.cs
@@ -78,7 +78,10 @@
public void DownloadData()
{
if (MainPage.InternetStatus == 0 || MainPage.NoLoginMode)
+ {
+ DownloadDataComplete = true;
return;
+ }
endTime1 = DateTime.Now.AddSeconds(25);
complateDevice = complateScene = false;
diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs
index d5cd85e..b6be181 100644
--- a/HDL_ON/DAL/Mqtt/MqttClient.cs
+++ b/HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -683,7 +683,7 @@
}
catch (Exception ex)
{
- Utlis.WriteLine($"error:" + ex.Message);
+ Utlis.WriteLine($"mqtt杩炴帴寮傚父 error:" + ex.Message);
//mqtt杩炴帴寮傚父锛屾竻绌烘湰鍦癿qtt淇℃伅锛屽彲鑳介渶瑕侀噸鏂拌幏鍙栵細wxr
MqttInfoConfig.Current.Refresh();
}
diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs
index 4f1d9af..c9bf8be 100644
--- a/HDL_ON/UI/MainPage.cs
+++ b/HDL_ON/UI/MainPage.cs
@@ -454,7 +454,8 @@
addResidencePage.LoadView();
return;
}
- new System.Threading.Thread(async () =>
+
+ new System.Threading.Thread(() =>
{
try
{
diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
index 4f2d2b4..0c52ed6 100644
--- a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
@@ -455,7 +455,8 @@
};
btnPm25Values.Width = btnPm25Values.GetTextWidth();
environmentalView.AddChidren(btnPm25Values);
-#endregion
+ #endregion
+
btnSecurityStatus = new Button()
{
@@ -604,9 +605,9 @@
TextAlignment = TextAlignment.Center,
};
changeView.AddChidren(btnChangeScene);
-#endregion
+ #endregion
-#region ContextView
+ #region ContextView
contentView = new PageLayout()
{
//Y = changeView.Bottom,
@@ -619,7 +620,7 @@
LoadContentView();
-#endregion
+ #endregion
}
catch (Exception ex)
{
@@ -633,6 +634,7 @@
/// </summary>
void LoadContentView()
{
+
if (!Common.ApiUtlis.Ins.DownloadDataComplete && !MainPage.NoLoginMode)
{
var waitPage = new Loading();
diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
index 5c82a1c..3bf20a9 100644
--- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
@@ -818,6 +818,10 @@
/// </summary>
void GetUnreadPushMessages()
{
+ if (MainPage.NoLoginMode)
+ {
+ return;
+ }
System.Threading.Tasks.Task.Run(() =>
{
try
@@ -922,6 +926,10 @@
/// </summary>
void RegisterGetPushMessageAction()
{
+ if (MainPage.NoLoginMode)
+ {
+ return;
+ }
Action RegisterGetPushMessageAction = () => {
if (bodyView != null)
{
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs
index b70cf7f..60d72bc 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs
@@ -167,6 +167,22 @@
public void LoadView()
{
+ //try
+ //{
+ // if (MainPage.CurPageIndex == 3)
+ // {
+ // Application.RunOnMainThread(() =>
+ // {
+ // this.RemoveFromParent();
+ // return;
+ // });
+ // }
+ //}
+ //catch (Exception ex)
+ //{
+ // MainPage.Log($"鐣岄潰鍒囨崲寮傚父:{ex.Message}");
+ //}
+ MainPage.CurPageIndex = 3;
#region 涓汉淇℃伅
topbg = new FrameLayout()
{
diff --git a/HDL_ON/UI/UI2/UserPage.cs b/HDL_ON/UI/UI2/UserPage.cs
index 78690ae..28e34a8 100644
--- a/HDL_ON/UI/UI2/UserPage.cs
+++ b/HDL_ON/UI/UI2/UserPage.cs
@@ -91,7 +91,7 @@
{
try
{
- bodyView = this;
+ bodyView = this;//1
bodyView.BackgroundColor = CSS_Color.MainBackgroundColor;
ContextView = new FrameLayout()
{
@@ -104,12 +104,10 @@
{
Y = Application.GetRealHeight(607),
Height = Application.GetMinRealAverage(60),
- //BackgroundColor = CSS_Color.BackgroundColor
};
bodyView.AddChidren(navigationView);
if (MainPage.Increase)
{
- //ContextView.Height = Application.GetRealHeight(618 + 20);
navigationView.Y = Application.GetRealHeight(597 + 5);
navigationView.Height = Application.GetRealHeight(70 - 5);
}
@@ -117,9 +115,9 @@
LoadEventList();
- var homePage = new HomePage();
- ContextView.AddChidren(homePage);
- homePage.LoadPage();
+ //var homePage = new HomePage();
+ //ContextView.AddChidren(homePage);
+ //homePage.LoadPage();
if (!MainPage.NoLoginMode)
{
diff --git a/HDL_ON/UI/UI2/UserPageBLL.cs b/HDL_ON/UI/UI2/UserPageBLL.cs
index b7c69dd..2dddfeb 100644
--- a/HDL_ON/UI/UI2/UserPageBLL.cs
+++ b/HDL_ON/UI/UI2/UserPageBLL.cs
@@ -12,26 +12,8 @@
void LoadEventList()
{
LoadEvent_NavigationSelection();
- LoadEvent_RefreshData();
}
- /// <summary>
- /// 鍒锋柊浣忓畢鏁版嵁
- /// </summary>
- void LoadEvent_RefreshData()
- {
- //ContextView.BeginHeaderRefreshingAction = () => {
- // if (CurAnimationEffect == 0)
- // {
- // Common.ApiUtlis.Ins.DownloadData();
- // ContextView.RemoveAll();
- // var homePage = new HomePage();
- // ContextView.AddChidren(homePage);
- // homePage.LoadPage();
- // ContextView.EndHeaderRefreshing();
- // }
- //};
- }
/// <summary>
/// 鍔犺浇瀵艰埅鏍忕偣鍑讳簨浠�
--
Gitblit v1.8.0