From 82b67388873fdd2213b00fa212b9e46c0d40e3cf Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期一, 04 九月 2023 13:35:18 +0800 Subject: [PATCH] 备份2 --- OnPro/RongAn/ViewController.cs | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 100 insertions(+), 9 deletions(-) diff --git a/OnPro/RongAn/ViewController.cs b/OnPro/RongAn/ViewController.cs index aeef105..6921dd3 100644 --- a/OnPro/RongAn/ViewController.cs +++ b/OnPro/RongAn/ViewController.cs @@ -1,25 +1,116 @@ -锘縰sing Foundation; -using System; +锘縰sing System; +using Foundation; +using HDL_ON; using UIKit; namespace RongAn { - public partial class ViewController : UIViewController + public partial class ViewController : ViewControllerBase { - public ViewController (IntPtr handle) : base (handle) + + public override void ViewWillAppear(bool animated) { + base.ViewWillAppear(animated); + //2021-02-01 璁剧疆NavigationBarHidden true + if (this.NavigationController != null) + { + this.NavigationController.NavigationBar.Hidden = true; + this.NavigationController.NavigationBar.TintColor = UIColor.Black; + } } - public override void ViewDidLoad () + public override void ViewDidLoad() { - base.ViewDidLoad (); - // Perform any additional setup after loading the view, typically from a nib. + base.ViewDidLoad(); + + HDL_ON.MainPage.Show(); + + try + { + //渚︽祴缃戠粶鍙樺寲 + Reachability.ReachabilityChanged += UpdateStatus; + + UITapGestureRecognizer oTapRecognizer = new UITapGestureRecognizer(); + oTapRecognizer.CancelsTouchesInView = false; + oTapRecognizer.AddTarget( + this, + new ObjCRuntime.Selector("ViewTappedSelector:") + ); + this.View.AddGestureRecognizer(oTapRecognizer); + MainPage.InternetStatus = (int)Reachability.InternetConnectionStatus(); + //HDLCommon.Current.UpdateInternetStatus((int)Reachability.InternetConnectionStatus(), SharedMethod.SharedMethod.IsBackground); + } + catch + { + + } + + //鍚姩鍙嬬洘sdk + new System.Threading.Thread(() => { + while (true) + { + if (OnAppConfig.Instance.IsLogin) + { + //var um = new UMSdk.HDLUMSDK(); + //UMSdk.HDLUMSDK.InitUMSDKWithAppKey("61d56642e0f9bb492bbc3e72", "IOS"); + break; + } + System.Threading.Thread.Sleep(1000); + } + }) + { IsBackground = true }.Start(); + + + + } + public override UIStatusBarStyle PreferredStatusBarStyle() + { + return UIStatusBarStyle.LightContent; } - public override void DidReceiveMemoryWarning () + [Export("ViewTappedSelector:")] + public void ViewTapped(UIGestureRecognizer sender) { - base.DidReceiveMemoryWarning (); + //Txt鎺т欢鍚嶇О.ResignFirstResponder(); + UIView v = View.FindFirstResponder(); + if (v != null) + { + v.ResignFirstResponder(); + } + } + + public override void DidReceiveMemoryWarning() + { + base.DidReceiveMemoryWarning(); // Release any cached data, images, etc that aren't in use. } + + NetworkStatus internetStatus; + void UpdateStatus(object sender, EventArgs e) + { + internetStatus = Reachability.InternetConnectionStatus(); + //MainPage.Log($"缃戠粶鐘舵�佸彉鍖栵紝褰撳墠缃戠粶:{internetStatus}"); + //缃戠粶鍙樺寲澶勭悊 + HDLCommon.Current.UpdateInternetStatus((int)internetStatus, MainPage.IsEnterBackground); + + //if (internetStatus == NetworkStatus.NotReachable)//娌℃湁缃戠粶杩炴帴 0 + //{ + // Control.Ins.GatewayOnline = false; + // Control.Ins.IsRemote = false; + // MainPage.InternetStatus = 0; + //} + //else if (internetStatus == NetworkStatus.ReachableViaCarrierDataNetwork)//3,4G鐨勭綉缁滆繛鎺� 1 + //{ + // Control.Ins.SearchLoaclGateway(); + // MainPage.InternetStatus = 1; + //} + //else if (internetStatus == NetworkStatus.ReachableViaWiFiNetwork) + //{ + // Control.Ins.SearchLoaclGateway(); + // MainPage.InternetStatus = 2; + //} + } + + } } -- Gitblit v1.8.0