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/UI/UI1-Login/RegisterPageBLL.cs |   88 +++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 86 insertions(+), 2 deletions(-)

diff --git a/HDL_ON/UI/UI1-Login/RegisterPageBLL.cs b/HDL_ON/UI/UI1-Login/RegisterPageBLL.cs
index 4e2b8ce..50aa11f 100644
--- a/HDL_ON/UI/UI1-Login/RegisterPageBLL.cs
+++ b/HDL_ON/UI/UI1-Login/RegisterPageBLL.cs
@@ -1,4 +1,5 @@
 锘縰sing System;
+using System.Collections.Generic;
 using System.Text.RegularExpressions;
 using System.Threading;
 using HDL_ON.DAL.Server;
@@ -9,6 +10,9 @@
 {
     public partial class RegisterPage
     {
+
+        List<GlobalRegionListRes> serverList;
+
         /// <summary>
         /// 鍔犺浇浜嬩欢鍒楄〃
         /// </summary>
@@ -197,6 +201,7 @@
                                 btnGetVerificationCode_Phone.IsSelected = false;
                                 new Tip()
                                 {
+                                    MaxWidth = Application.GetRealWidth(300),
                                     CloseTime = 1,
                                     Text = Language.StringByID(StringId.PlsEntryCorrectMobilNeumber),
                                     Direction = AMPopTipDirection.None,
@@ -225,6 +230,7 @@
                                 btnGetVerificationCode_Mail.IsSelected = false;
                                 new Tip()
                                 {
+                                    MaxWidth = Application.GetRealWidth(300),
                                     CloseTime = 1,
                                     Text = Language.StringByID(StringId.PlsEntryCorrectEmailAddress),
                                     Direction = AMPopTipDirection.None,
@@ -268,6 +274,7 @@
                         HDLCommon.Current.BottomLineShowType(btnPasswordViewBottomLine, BottomLineType.Error);
                         new Tip()
                         {
+                            MaxWidth = Application.GetRealWidth(300),
                             CloseTime = 1,
                             Direction = AMPopTipDirection.None,
                             Text = Language.StringByID(StringId.PlsRegisterPassword)
@@ -625,7 +632,6 @@
             //鍒ゆ柇涔嬪墠鏄惁閫夋嫨杩�
             if (OnAppConfig.Instance.GlobalRegion != null && !string.IsNullOrEmpty(OnAppConfig.Instance.GlobalRegion.regionUrl))
             {
-
                 SetServerText();
             }
 
@@ -653,7 +659,7 @@
             if (isSelectServer == false)
             {
                 //璇峰厛閫夋嫨鍥藉/鍖哄煙
-                Utlis.ShowTip(Language.StringByID(StringId.PleaseSelectCountryOrRegion));
+                Utlis.ShowTip(Language.StringByID(StringId.PlsSelectServer));
                 ShowServerBottomLineState(true);
                 return false;
             }
@@ -758,5 +764,83 @@
             }
             return true;
         }
+
+
+        /// <summary>
+        /// 鑾峰彇鏈嶅姟鍣ㄥ垪琛�
+        /// </summary>
+        void getServerList()
+        {
+            var waitPage = new Loading();
+            bodyView.AddChidren(waitPage);
+            waitPage.Start(Language.StringByID(StringId.PleaseWait));
+
+
+            System.Threading.Tasks.Task.Run(() =>
+            {
+                try
+                {
+                    Console.WriteLine("GetCountryByIP");
+                    var ddd = JLCountrycode.CountryCodeView.Current.GetCountryByIP();
+                    Console.WriteLine(ddd);
+                    serverList = new List<GlobalRegionListRes>();
+                    var requestJson = HttpUtil.GetSignRequestJson(new GetRegionListObj() { regionMark = HttpUtil.RegionMark });
+                    var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_GlobalRegionList, requestJson, HttpUtil.GlobalRequestHttpsHost);
+                    if (revertObj.Code == StateCode.SUCCESS)
+                    {
+                        Application.RunOnMainThread(() =>
+                        {
+                            var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GlobalRegionListRes>>(revertObj.Data.ToString());
+                            if (responseDataObj != null)
+                            {
+                                serverList = responseDataObj;
+                                if (serverList.Count > 0)
+                                {
+                                    if (Language.CurrentLanguage == "Chinese")
+                                    {
+                                        var server = serverList.Find((obj) => obj.regionUrl.Contains("china-gateway"));
+                                        if (server != null)
+                                        {
+                                            OnAppConfig.Instance.GlobalRegion.regionUrl = server.regionUrl;
+                                            SetServerText();
+                                        }
+                                    }
+                                    else
+                                    {
+                                        var server = serverList.Find((obj) => obj.regionUrl.Contains("bahrain-gateway"));
+                                        if (server != null)
+                                        {
+                                            OnAppConfig.Instance.GlobalRegion.regionUrl = server.regionUrl;
+                                            SetServerText();
+                                        }
+                                    }
+                                }
+                            }
+                        });
+                    }
+                    else
+                    {
+                        //鎻愮ず閿欒
+                        IMessageCommon.Current.ShowErrorInfoAlter(revertObj.Code);
+                    }
+                }
+                catch
+                {
+
+                }
+                finally
+                {
+                    Application.RunOnMainThread(() =>
+                    {
+                        if (waitPage != null)
+                        {
+                            waitPage.RemoveFromParent();
+                            waitPage = null;
+                        }
+                    });
+                }
+            });
+
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0