From 160785587667cc0d927f85e44c139ec9dde13a9e Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 25 十一月 2019 14:30:13 +0800 Subject: [PATCH] 原来的 IOS 工程舍弃(注:没有合并其他组员的代码) --- ZigbeeApp/Home.Ios/AppDelegate.cs | 70 +++++++++++++++++----------------- 1 files changed, 35 insertions(+), 35 deletions(-) diff --git a/ZigbeeApp/GateWay.Ios/AppDelegate.cs b/ZigbeeApp/Home.Ios/AppDelegate.cs old mode 100755 new mode 100644 similarity index 88% rename from ZigbeeApp/GateWay.Ios/AppDelegate.cs rename to ZigbeeApp/Home.Ios/AppDelegate.cs index 604e0e3..487a509 --- 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,11 +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/"); DeviceTokenAction += (deviceToken) => { @@ -89,13 +85,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,23 +145,28 @@ } } } - + } 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. @@ -188,7 +189,7 @@ { // 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); } @@ -198,8 +199,8 @@ // 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 +219,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 +247,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 +276,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 +296,7 @@ { Width = width, Height = height, - Margin = 10 + Margin = 0 } }; @@ -308,6 +310,4 @@ return resultBytes; } } -} - - +} \ No newline at end of file -- Gitblit v1.8.0