old mode 100755
new mode 100644
| | |
| | | |
| | | internal static UINavigationController rootViewController; |
| | | |
| | | |
| | | public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) |
| | | { |
| | | //base.FinishedLaunching(application, launchOptions); |
| | | Shared.Application.IsGpsEnable = false; |
| | | Shared.Application.IsMusicEnable = false; |
| | | base.FinishedLaunching(application, launchOptions); |
| | | Shared.Application.FontSize = 12; |
| | | Shared.Application.IsUsePingFang = true; |
| | | Window = new UIWindow(UIScreen.MainScreen.Bounds); |
| | | rootViewController = new UINavigationController(new GateWay.Ios.MainViewController()) { NavigationBarHidden = true }; |
| | | Window.RootViewController = rootViewController; |
| | | Window.MakeKeyAndVisible(); |
| | |
|
| | | Shared.IOS.TBL.WXApi.RegisterApp("wx2ec8f53f6fa36e82", "https://hdlcontrol.com/ZigbeeApp/");
|
| | | |
| | | Console.WriteLine("FinishedLaunching"); |
| | | DeviceTokenAction += (deviceToken) => |
| | | { |
| | | Shared.Common.Config.Instance.RegistrationID = deviceToken; |
| | |
| | | NSString key_hiddenJson = new NSString("HiddenJson"); |
| | | if (userInfo.ContainsKey(key_hiddenJson)) |
| | | { |
| | | NSDictionary hiddenJsonDic = userInfo["HiddenJson"] as NSDictionary; |
| | | if (hiddenJsonDic != null) |
| | | var hiddenJson = userInfo["HiddenJson"].ToString(); |
| | | if (!string.IsNullOrEmpty(hiddenJson)) |
| | | { |
| | | NSString key_Offline = new NSString("Offline"); |
| | | if (hiddenJsonDic.ContainsKey(key_Offline)) |
| | | if (hiddenJson.Contains("cmtID")) |
| | | { |
| | | string signOut = hiddenJsonDic["Offline"].ToString(); |
| | | |
| | | ///目前根据这个判断是否是可视对讲数据 |
| | | // VideoMethod(hiddenJson); |
| | | } |
| | | else |
| | | { |
| | | |
| | | if (signOut == "0") |
| | | NSDictionary hiddenJsonDic = userInfo["HiddenJson"] as NSDictionary; |
| | | if (hiddenJsonDic != null) |
| | | { |
| | | //不下线 |
| | | } |
| | | else |
| | | { |
| | | //标记下线 |
| | | haveToSignOut = true; |
| | | NSString key_Offline = new NSString("Offline"); |
| | | if (hiddenJsonDic.ContainsKey(key_Offline)) |
| | | { |
| | | string signOut = hiddenJsonDic["Offline"].ToString(); |
| | | |
| | | if (signOut == "0") |
| | | { |
| | | //不下线 |
| | | } |
| | | else |
| | | { |
| | | //标记下线 |
| | | haveToSignOut = true; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action<UIBackgroundFetchResult> completionHandler) |
| | | { |
| | | Console.WriteLine("DidReceiveRemoteNotification"); |
| | | 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)) |
| | | { |
| | | NSDictionary hiddenJsonDic = userInfo["HiddenJson"] as NSDictionary; |
| | | if (hiddenJsonDic == null) |
| | | var hiddenJson = userInfo["HiddenJson"].ToString(); |
| | | if (string.IsNullOrEmpty(hiddenJson)) |
| | | { |
| | | return; |
| | | } |
| | | NSString key_Offline = new NSString("Offline"); |
| | | if (hiddenJsonDic.ContainsKey(key_Offline)) |
| | | { |
| | | string signOut = hiddenJsonDic["Offline"].ToString(); |
| | | |
| | | if (signOut == "0") |
| | | if (hiddenJson.Contains("cmtID")) |
| | | { |
| | | |
| | | ///目前根据这个判断是否是可视对讲数据 |
| | | VideoMethod(hiddenJson); |
| | | } |
| | | else |
| | | { |
| | | |
| | | NSDictionary hiddenJsonDic = userInfo["HiddenJson"] as NSDictionary; |
| | | if (hiddenJsonDic == null) |
| | | { |
| | | //不下线 |
| | | return; |
| | | } |
| | | else |
| | | NSString key_Offline = new NSString("Offline"); |
| | | if (hiddenJsonDic.ContainsKey(key_Offline)) |
| | | { |
| | | //强制下线 |
| | | CommonPage.Instance.SingOut(); |
| | | CommonPage.Instance.ShowErrorInfoAlert(Shared.R.MyInternationalizationString.YouHaveBeenSignOut); |
| | | string signOut = hiddenJsonDic["Offline"].ToString(); |
| | | |
| | | if (signOut == "0") |
| | | { |
| | | //不下线 |
| | | } |
| | | else |
| | | { |
| | | //强制下线 |
| | | CommonPage.Instance.SingOut(); |
| | | CommonPage.Instance.ShowErrorInfoAlert(Shared.R.MyInternationalizationString.uHadBeenLoginAndOffLine); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | NSString key_hiddenJson = new NSString("HiddenJson"); |
| | | if (userInfo.ContainsKey(key_hiddenJson)) |
| | | { |
| | | NSDictionary hiddenJsonDic = userInfo["HiddenJson"] as NSDictionary; |
| | | if (hiddenJsonDic == null) |
| | | { |
| | | |
| | | var hiddenJson = userInfo["HiddenJson"].ToString(); |
| | | if (string.IsNullOrEmpty(hiddenJson)) { |
| | | return; |
| | | } |
| | | NSString key_Offline = new NSString("Offline"); |
| | | if (hiddenJsonDic.ContainsKey(key_Offline)) |
| | | { |
| | | string signOut = hiddenJsonDic["Offline"].ToString(); |
| | | |
| | | if (signOut == "0") |
| | | if (hiddenJson.Contains("cmtID")) |
| | | { |
| | | ///目前根据这个判断是否是可视对讲数据 |
| | | VideoMethod(hiddenJson); |
| | | } |
| | | else |
| | | { |
| | | |
| | | NSDictionary hiddenJsonDic = userInfo["HiddenJson"] as NSDictionary; |
| | | if (hiddenJsonDic == null) |
| | | { |
| | | //不下线 |
| | | return; |
| | | } |
| | | else |
| | | NSString key_Offline = new NSString("Offline"); |
| | | if (hiddenJsonDic.ContainsKey(key_Offline)) |
| | | { |
| | | //标记下线 |
| | | haveToSignOut = true; |
| | | string signOut = hiddenJsonDic["Offline"].ToString(); |
| | | |
| | | if (signOut == "0") |
| | | { |
| | | //不下线 |
| | | } |
| | | else |
| | | { |
| | | //标记下线 |
| | | haveToSignOut = true; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | completionHandler(UIBackgroundFetchResult.NewData); |
| | | } |
| | | /// <summary> |
| | | /// ios通知栏点击打开可视对讲的方法 |
| | | /// </summary> |
| | | /// <param name="hiddenJson">云端推过来的数据</param> |
| | | private void VideoMethod(string hiddenJson) |
| | | { |
| | | |
| | | var json = Newtonsoft.Json.Linq.JObject.Parse(hiddenJson); |
| | | if (json == null) |
| | | { |
| | | return; |
| | | } |
| | | GateWay.Ios.ESVideoInfo eSVideoInfo = new GateWay.Ios.ESVideoInfo(); |
| | | if (json["uuid"].ToString().Contains(",")) |
| | | { |
| | | var uuid = json["uuid"].ToString().Split(','); |
| | | eSVideoInfo.ESVideoUUID = uuid[0]; |
| | | } |
| | | else |
| | | { |
| | | eSVideoInfo.ESVideoUUID = json["uuid"].ToString(); |
| | | } |
| | | |
| | | eSVideoInfo.DeviceName = Language.StringByID(Shared.R.MyInternationalizationString.theOutdoorUnit); |
| | | eSVideoInfo.ESRoomID = int.Parse(json["roomno"].ToString()); |
| | | if (!string.IsNullOrEmpty(json["unitno"].ToString())) |
| | | { |
| | | string str = json["unitno"].ToString(); |
| | | string str1 = str.Substring(0, 2).TrimStart('0'); |
| | | string str2 = str.Substring(2, 2).TrimStart('0'); |
| | | eSVideoInfo.RoomName = str1 + Language.StringByID(Shared.R.MyInternationalizationString.dong) + str2 + Language.StringByID(Shared.R.MyInternationalizationString.unit); |
| | | } |
| | | GateWay.Ios.ESVideo.ShowESvideoVideoIntercom(eSVideoInfo); |
| | | |
| | | //var url = "https://global.hdlcontrol.com/HangZhouHdlCloudApi/VideoIntercom/Answer"; |
| | | //var dd=await Shared.Phone.Device.Logic.Send.HttpWebRequest(url, json.ToString(), "POST", 3, true); |
| | | } |
| | | |
| | | public override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo) |
| | |
| | | { |
| | | //强制下线 |
| | | CommonPage.Instance.SingOut(); |
| | | CommonPage.Instance.ShowErrorInfoAlert(Shared.R.MyInternationalizationString.YouHaveBeenSignOut); |
| | | CommonPage.Instance.ShowErrorInfoAlert(Shared.R.MyInternationalizationString.uHadBeenLoginAndOffLine); |
| | | } |
| | | //检查连接远程 |
| | | //代码 |
| | |
| | | public static class QRCode |
| | | { |
| | | static ZXing.Mobile.MobileBarcodeScanner scanner; |
| | | public static async System.Threading.Tasks.Task ScanQRcode(Action<string> action, string topText = "", string bottomText = "", string cancel = "Cancel") |
| | | public static async System.Threading.Tasks.Task ScanQRcode(Action<string> action, string cancel = "取消", string flashText = "闪光灯", string titleText = "二维码扫描") |
| | | { |
| | | if (scanner == null) |
| | | { |
| | | scanner = new ZXing.Mobile.MobileBarcodeScanner(Home.IOS.AppDelegate.rootViewController) { FlashButtonText = "", TopText = topText, BottomText = bottomText, CancelButtonText = cancel }; |
| | | var mZXingOverlayView = new Home.IOS.ZXingOverlayView(cancel, flashText, titleText); |
| | | scanner = new ZXing.Mobile.MobileBarcodeScanner(Home.IOS.AppDelegate.rootViewController) { FlashButtonText = flashText, TopText = titleText, BottomText = "", CancelButtonText = cancel }; |
| | | scanner.UseCustomOverlay = true; |
| | | |
| | | scanner.CustomOverlay = mZXingOverlayView; |
| | | var bOn = false; |
| | | mZXingOverlayView.OnCancel += () => { |
| | | |
| | | scanner?.Cancel(); |
| | | }; |
| | | |
| | | mZXingOverlayView.OnTorch += () => |
| | | { |
| | | bOn = !bOn; |
| | | scanner?.Torch(bOn); |
| | | }; |
| | | |
| | | } |
| | | |
| | | var result = await scanner.Scan(); |