From 2a88b9b559fd20f42d163d08b582f2d19ff329f4 Mon Sep 17 00:00:00 2001
From: wxr <wxr@hdlchina.com.cn>
Date: 星期一, 30 九月 2024 17:05:58 +0800
Subject: [PATCH] Update HDLLinphone.cs
---
HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 108 insertions(+), 2 deletions(-)
diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
index dd9844d..53cd5a5 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,89 @@
}
}
+ 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
+ if (bodyView.linkStateMsgView != null){
+ 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 +351,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 +382,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>
/// 鍔犺浇鍔熻兘鏀惰棌鎸夐挳浜嬩欢
--
Gitblit v1.8.0