From 642fcdaeb496d9a8f3154e17fd76005be3fcf197 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期二, 03 十二月 2019 12:00:24 +0800 Subject: [PATCH] 2019.12.3 --- ZigbeeApp/Home.Ios/AppDelegate.cs | 71 ++++++++++++++++++----------------- 1 files changed, 37 insertions(+), 34 deletions(-) diff --git a/ZigbeeApp/GateWay.Ios/AppDelegate.cs b/ZigbeeApp/Home.Ios/AppDelegate.cs similarity index 87% rename from ZigbeeApp/GateWay.Ios/AppDelegate.cs rename to ZigbeeApp/Home.Ios/AppDelegate.cs index 604e0e3..35edd52 100644 --- a/ZigbeeApp/GateWay.Ios/AppDelegate.cs +++ b/ZigbeeApp/Home.Ios/AppDelegate.cs @@ -1,21 +1,17 @@ +锘縰sing System; using Foundation; -using UIKit; -using Shared; -using System; -using ObjCRuntime; -using UserNotifications; -using Shared.Common; using Microsoft.AppCenter; using Microsoft.AppCenter.Analytics; using Microsoft.AppCenter.Crashes; +using Shared; +using Shared.Common; using Shared.IOS.TBL; +using UIKit; -namespace GateWay.Ios +namespace Home.IOS { - // The UIApplicationDelegate for the application. This class is responsible for launching the - // User Interface of the application, as well as listening (and optionally responding) to application events from iOS. [Register("AppDelegate")] - public class AppDelegate : BaseApplicationDelegate + public class AppDelegate : BaseApplicationDelegate { public static bool haveToSignOut = false; // class-level declarations @@ -32,9 +28,11 @@ //base.FinishedLaunching(application, launchOptions); Shared.Application.FontSize = 12; Window = new UIWindow(UIScreen.MainScreen.Bounds); - rootViewController = new UINavigationController(new MainViewController()) { NavigationBarHidden = true }; + rootViewController = new UINavigationController(new GateWay.Ios.MainViewController()) { NavigationBarHidden = true }; Window.RootViewController = rootViewController; Window.MakeKeyAndVisible(); + + Shared.IOS.TBL.WXApi.RegisterApp("wx2ec8f53f6fa36e82", "https://hdlcontrol.com/ZigbeeApp/"); Shared.IOS.TBL.WXApi.RegisterApp("wx2ec8f53f6fa36e82", "https://hdlcontrol.com/ZigbeeApp/"); @@ -80,6 +78,7 @@ } } AppCenter.Start("0ca801a2-742b-42fb-ba10-7ba4391371aa", typeof(Analytics), typeof(Crashes)); + GDMapKit.setGDApiKey("866fae25f336bc8d9a79b1d19267fffb");//楂樺痉鍦板浘key return true; } @@ -89,13 +88,13 @@ } public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action<UIBackgroundFetchResult> completionHandler) { - if (userInfo==null) + if (userInfo == null) { return; } Console.WriteLine(userInfo); - if(application.ApplicationState==UIApplicationState.Active || application.ApplicationState==UIApplicationState.Background) + if (application.ApplicationState == UIApplicationState.Active || application.ApplicationState == UIApplicationState.Background) { NSString key_hiddenJson = new NSString("HiddenJson"); if (userInfo.ContainsKey(key_hiddenJson)) @@ -149,27 +148,32 @@ } } } - + } completionHandler(UIBackgroundFetchResult.NewData); } - public override void ReceivedRemoteNotification (UIApplication application, NSDictionary userInfo) + public override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo) { Console.WriteLine(userInfo); - if (application.ApplicationState == UIApplicationState.Active) { - System.Console.WriteLine ("ReceivedRemoteNotification1"); - } else if (application.ApplicationState == UIApplicationState.Background) { - System.Console.WriteLine ("ReceivedRemoteNotification2"); - } else if (application.ApplicationState == UIApplicationState.Inactive) { - System.Console.WriteLine ("ReceivedRemoteNotification3"); - } + if (application.ApplicationState == UIApplicationState.Active) + { + System.Console.WriteLine("ReceivedRemoteNotification1"); + } + else if (application.ApplicationState == UIApplicationState.Background) + { + System.Console.WriteLine("ReceivedRemoteNotification2"); + } + else if (application.ApplicationState == UIApplicationState.Inactive) + { + System.Console.WriteLine("ReceivedRemoteNotification3"); + } } - + public override void OnResignActivation(UIApplication application) { // Invoked when the application is about to move from active to inactive state. - // This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) + // This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) // or when the user quits the application and it begins the transition to the background state. // Games should use this method to pause the game. base.OnResignActivation(application); @@ -188,18 +192,18 @@ { // Called as part of the transiton from background to active state. // Here you can undo many of the changes made on entering the background. - System.Console.WriteLine ("WillEnterForeground"); + System.Console.WriteLine("WillEnterForeground"); UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0; base.WillEnterForeground(application); } public override void OnActivated(UIApplication application) { - // Restart any tasks that were paused (or not yet started) while the application was inactive. + // Restart any tasks that were paused (or not yet started) while the application was inactive. // If the application was previously in the background, optionally refresh the user interface. base.OnActivated(application); - - if(haveToSignOut==true) + + if (haveToSignOut == true) { //寮哄埗涓嬬嚎 CommonPage.Instance.SingOut(); @@ -218,7 +222,7 @@ public static Action<string> RespAction; public static void WXLogin() { - + var req = new SendAuthReq { Scope = "snsapi_userinfo", State = "ZigbeeApp", OpenID = "0c806938e2413ce73eef92cc3" }; WXApi.SendAuthReq(req, rootViewController, null, null); @@ -246,7 +250,8 @@ var result = new System.Net.WebClient { }.DownloadString($"https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx2ec8f53f6fa36e82&secret=a08585cd6ff2ce64570b9e7e6525dd8e&code={((SendAuthResp)resp).Code}&grant_type=authorization_code"); RespAction?.Invoke(result); } - catch { + catch + { RespAction?.Invoke(null); } break; @@ -274,7 +279,7 @@ { if (scanner == null) { - scanner = new ZXing.Mobile.MobileBarcodeScanner(GateWay.Ios.AppDelegate.rootViewController) { FlashButtonText = "", TopText = topText, BottomText = bottomText, CancelButtonText = cancel }; + scanner = new ZXing.Mobile.MobileBarcodeScanner(Home.IOS.AppDelegate.rootViewController) { FlashButtonText = "", TopText = topText, BottomText = bottomText, CancelButtonText = cancel }; } var result = await scanner.Scan(); @@ -294,7 +299,7 @@ { Width = width, Height = height, - Margin = 10 + Margin = 0 } }; @@ -309,5 +314,3 @@ } } } - - -- Gitblit v1.8.0