old mode 100755
new mode 100644
File was renamed from ZigbeeApp/GateWay.Ios/AppDelegate.cs |
| | |
| | | using 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 |
| | |
| | | //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) => |
| | | { |
| | |
| | | } |
| | | 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)) |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | 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. |
| | |
| | | { |
| | | // 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); |
| | | } |
| | |
| | | // 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(); |
| | |
| | | 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); |
| | |
| | | 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; |
| | |
| | | { |
| | | 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(); |
| | |
| | | { |
| | | Width = width, |
| | | Height = height, |
| | | Margin = 10 |
| | | Margin = 0 |
| | | } |
| | | }; |
| | | |
| | |
| | | return resultBytes; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |