| | |
| | | using Foundation; |
| | | using System; |
| | | using 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 () |
| | | { |
| | | base.ViewDidLoad (); |
| | | // Perform any additional setup after loading the view, typically from a nib. |
| | | |
| | | 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; |
| | | } |
| | | |
| | | [Export("ViewTappedSelector:")] |
| | | public void ViewTapped(UIGestureRecognizer sender) |
| | | { |
| | | //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; |
| | | //} |
| | | } |
| | | |
| | | |
| | | } |
| | | } |