可视对讲,注册
1.可视对讲(安卓)点击通知栏进去的时候可以打开接听界面
2.注册增加根据IP地址选择默认服务器
| | |
| | | using System; |
| | | using Android.App; |
| | | using Android.Content; |
| | | using Android.OS; |
| | | using Java.IO; |
| | | |
| | | namespace HDL_ON_Android |
| | |
| | | } |
| | | } |
| | | |
| | | //public static void StartSplashActivity() |
| | | //{ |
| | | // Intent intent = new Intent(Shared.Application.Activity, typeof(SplashActivity)); |
| | | // Shared.Application.Activity.StartActivity(intent); |
| | | // Shared.Application.Activity.Finish(); |
| | | //} |
| | | |
| | | [Obsolete] |
| | | public static bool IsAppInForeground(Context context) |
| | | { |
| | | ActivityManager activityManager = (ActivityManager)context.GetSystemService(Context.ActivityService); |
| | | |
| | | if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) |
| | | { |
| | | var appProcesses = activityManager.RunningAppProcesses; |
| | | if (appProcesses != null) |
| | | { |
| | | string packageName = context.PackageName; |
| | | foreach (var appProcess in appProcesses) |
| | | { |
| | | if (appProcess.Importance == Importance.Foreground && appProcess.ProcessName.Equals(packageName)) |
| | | { |
| | | return true; // 应用在前台 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var tasks = activityManager.GetRunningTasks(1); |
| | | if (tasks != null && tasks.Count > 0) |
| | | { |
| | | var topActivity = tasks[0].TopActivity; |
| | | if (topActivity.PackageName.Equals(context.PackageName)) |
| | | { |
| | | return true; // 应用在前台 |
| | | } |
| | | } |
| | | } |
| | | |
| | | return false; // 应用不在前台 |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | /// <param name="notificationMessage"></param> |
| | | public override void OnNotifyMessageOpened(Context context, NotificationMessage notificationMessage) |
| | | { |
| | | |
| | | |
| | | //2020-12-23 解决点击通知栏打开不了APP问题 |
| | | //base.OnNotifyMessageOpened(context, notificationMessage); |
| | | OpenNotification(context, notificationMessage); |
| | | MainPage.Log("接收到推送:点击通知回调"); |
| | | OpenNotification(context, notificationMessage,true); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="context"></param> |
| | | /// <param name="notificationMessage"></param> |
| | | public static void OpenNotification(Context context, NotificationMessage notificationMessage) |
| | | public static void OpenNotification(Context context, NotificationMessage notificationMessage,bool isNotification = false) |
| | | {
|
| | | try |
| | | { |
| | | MainPage.Log("接收到推送:打开消息显示界面"); |
| | | var pushMes = new JPushMessageInfo() |
| | | { |
| | | Title = notificationMessage.NotificationTitle, |
| | | Content = notificationMessage.NotificationContent, |
| | | Extras = notificationMessage.NotificationExtras |
| | | Extras = notificationMessage.NotificationExtras, |
| | | isNotificationGoing = isNotification |
| | | }; |
| | | |
| | | var jpushExpandData = GetJPushExpandData(pushMes); |
| | |
| | | else |
| | | { |
| | | Intent i = new Intent(context, typeof(BaseActivity)); |
| | | i.SetFlags(ActivityFlags.SingleTop); |
| | | i.SetFlags(ActivityFlags.ClearTop); |
| | | i.SetFlags(ActivityFlags.NewTask); |
| | | context.StartActivity(i); |
| | | } |
| | | //解析msg
|
| | | AdjustPushMessage(pushMes);
|
| | |
|
| | | } |
| | | catch |
| | | { |
| | |
| | | { |
| | | protected override void OnActivityResult(int requestCode, Result resultVal, Intent data) |
| | | { |
| | | Console.WriteLine("123456"); |
| | | if (requestCode == 99) |
| | | { |
| | | if (resultVal == Result.Ok) |
| | |
| | | [Obsolete] |
| | | protected override void OnCreate(Bundle savedInstanceState) |
| | | { |
| | | Console.WriteLine("123456"); |
| | | base.OnCreate(savedInstanceState); |
| | | |
| | | if(Shared.Application.Activity != null && Shared.Application.Activity.GetType() == typeof(BaseActivity)) |
| | |
| | | |
| | | #endregion |
| | | |
| | | ///// <summary> |
| | | ///// 恢复住宅 |
| | | ///// 2020-12-03 待测试未检测 |
| | | ///// </summary> |
| | | //public void RestoreHomeBackup(string RegionID) |
| | | //{ |
| | | // var isExist = FileUtils.ExistRegion(RegionID); |
| | | // if (isExist) |
| | | // { |
| | | // //存在则恢复 |
| | | // string newRegionRootPath = FileUtils.CreateRegionBackup(RegionID); |
| | | // FileUtils.RestoreRegionFiles(newRegionRootPath); |
| | | // } |
| | | //} |
| | | |
| | | #region ■ 推送处理_______________________ |
| | | /// <summary> |
| | | /// 推送消息处理 |
| | |
| | | { |
| | | try |
| | | { |
| | | //Console.WriteLine($"接收到推送,,,,.{Newtonsoft.Json.JsonConvert.SerializeObject(jpushMessageInfo).ToString()}"); |
| | | |
| | | //MainPage.Log($"接收到推送,,,,.{Newtonsoft.Json.JsonConvert.SerializeObject(jpushMessageInfo).ToString()}"); |
| | | //Extras为空不处理 |
| | | if (string.IsNullOrEmpty(jpushMessageInfo.Extras)) return; |
| | | |
| | |
| | | //报警推送弹窗提示 |
| | | ShowAlarmPushMessage(jpushMessageInfo, true); |
| | | //萤石门锁推送 |
| | | HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.DoorLockPush(jpushMessageInfo); |
| | | UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.DoorLockPush(jpushMessageInfo); |
| | | } |
| | | else if (jpushMessageInfo.messageType == (PushMessageType.FLCall.ToString())) |
| | | { |
| | |
| | | } |
| | | else if (jpushMessageInfo.messageType == PushMessageType.HDL_INTERPHONE.ToString()) |
| | | { |
| | | |
| | | if (string.IsNullOrEmpty(jpushMessageInfo.expantContent)) return; |
| | | |
| | | //字段兼容问题,只能直接取值了 |
| | | var json = Newtonsoft.Json.Linq.JObject.Parse(jpushMessageInfo.expantContent); |
| | | |
| | | |
| | | //1.视对讲厂家类型 |
| | | string interphoneTypeEnum = json["interphoneTypeEnum"].ToString(); |
| | |
| | | } |
| | | } |
| | | } |
| | | catch { } |
| | | |
| | | |
| | | catch (Exception ex) { |
| | | MainPage.Log("Error", $"自研可视对讲通知异常:{ex.StackTrace}"); |
| | | } |
| | | |
| | | #if __ANDROID__ |
| | | Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.MissedCallsTime = 30; |
| | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | #elif __IOS__ |
| | | #elif __IOS__ |
| | | SoundPlayer.Ins.PlaySound(); |
| | | new Thread(() => { |
| | | int count = 0; |
| | |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | #endif |
| | | #endif |
| | | |
| | | |
| | | //HDL Linphone 狄耐克 |
| | | MainPage.Log("接收到推送:HDL Linphone 狄耐克"); |
| | | eSVideoInfo.HomeId = jpushMessageInfo.HomeId; |
| | | eSVideoInfo.callId = json["callId"].ToString(); |
| | | eSVideoInfo.Lc_DeviceId = json["deviceId"].ToString(); |
| | | eSVideoInfo.DeviceName = json["deviceName"].ToString(); |
| | | eSVideoInfo.deviceSipAccount = json["deviceSipAccount"].ToString(); |
| | | eSVideoInfo.spk = json["spk"].ToString(); |
| | | |
| | | |
| | | //ShowAlert("狄耐克门口机呼叫"); |
| | | //打开呼叫页面 |
| | | HDLLinphone.Current.ShowESVideoIntercom(eSVideoInfo, InterphoneType.HDL.ToString()); |
| | | HDLLinphone.Current.ShowESVideoIntercom(eSVideoInfo, InterphoneType.HDL.ToString(), jpushMessageInfo.isNotificationGoing); |
| | | return; |
| | | } |
| | | else if (interphoneTypeEnum == InterphoneType.FREEVIEW.ToString()) |
| | |
| | | Utlis.WriteLine("catch: " + EX.ToString()); |
| | | } |
| | | } |
| | | //{"code":0,"data":{"list":[{"createTime":"1625798305115","modifyTime":"1625798305115","region":"100000000000000001","id":"1413326644794294273","alarmId":"20210709103818-F41014762-1-10000","channelNo":1,"deviceSerial":"F41014762","alarmName":"人体感应事件","alarmPicUrl":"https://i.ys7.com/streamer/alarm/url/get?fileId=20210709103818-F41014762-1-10000-2-1&deviceSerialNo=F41014762&cn=1&isEncrypted=0&isCloudStored=0&ct=1&lc=7&bn=1_hikalarm&isDevVideo=0","alarmTime":"2021-07-09T10:38:17","homeId":"1396717478877241345","alarmType":"pir","isChecked":0,"isEncrypt":0,"deleted":0,"tenantId":"20"},{"createTime":"1625798057197","modifyTime":"1625798057197","region":"100000000000000001","id":"1413325604946640898","alarmId":"20210709103413-F41014762-1-10000","channelNo":1,"deviceSerial":"F41014762","alarmName":"人体感应事件","alarmPicUrl":"https://i.ys7.com/streamer/alarm/url/get?fileId=20210709103413-F41014762-1-10000-2-1&deviceSerialNo=F41014762&cn=1&isEncrypted=0&isCloudStored=0&ct=1&lc=7&bn=1_hikalarm&isDevVideo=0","alarmTime":"2021-07-09T10:34:12","homeId":"1396717478877241345","alarmType":"pir","isChecked":0,"isEncrypt":0,"deleted":0,"tenantId":"20"},{ "createTime":"1625797973320","modifyTime":"1625797973320","region":"100000000000000001","id":"1413325253141004289","alarmId":"20210709103236-F41014762-1-10000","channelNo":1,"deviceSerial":"F41014762","alarmName":"人体感应事件","alarmPicUrl":"https://i.ys7.com/streamer/alarm/url/get?fileId=20210709103236-F41014762-1-10000-2-1&deviceSerialNo=F41014762&cn=1&isEncrypted=0&isCloudStored=0&ct=1&lc=7&bn=1_hikalarm&isDevVideo=0","alarmTime":"2021-07-09T10:32:31","homeId":"1396717478877241345","alarmType":"pir","isChecked":0,"isEncrypt":0,"deleted":0,"tenantId":"20"},{ "createTime":"1625797782136","modifyTime":"1625797782136","region":"100000000000000001","id":"1413324451261382658","alarmId":"20210709102937-F41014762-1-10000","channelNo":1,"deviceSerial":"F41014762","alarmName":"人体感应事件","alarmPicUrl":"https://i.ys7.com/streamer/alarm/url/get?fileId=20210709102937-F41014762-1-10000-2-1&deviceSerialNo=F41014762&cn=1&isEncrypted=0&isCloudStored=0&ct=1&lc=7&bn=1_hikalarm&isDevVideo=0","alarmTime":"2021-07-09T10:29:37","homeId":"1396717478877241345","alarmType":"pir","isChecked":0,"isEncrypt":0,"deleted":0,"tenantId":"20"},{ "createTime":"1625797668771","modifyTime":"1625797668771","region":"100000000000000001","id":"1413323975769915394","alarmId":"20210709102743-F41014762-1-10000","channelNo":1,"deviceSerial":"F41014762","alarmName":"人体感应事件","alarmPicUrl":"https://i.ys7.com/streamer/alarm/url/get?fileId=20210709102743-F41014762-1-10000-2-1&deviceSerialNo=F41014762&cn=1&isEncrypted=0&isCloudStored=0&ct=1&lc=7&bn=1_hikalarm&isDevVideo=0","alarmTime":"2021-07-09T10:27:42","homeId":"1396717478877241345","alarmType":"pir","isChecked":0,"isEncrypt":0,"deleted":0,"tenantId":"20"},{ "createTime":"1625797539846","modifyTime":"1625797539846","region":"100000000000000001","id":"1413323435023466498","alarmId":"20210709102534-F41014762-1-10000","channelNo":1,"deviceSerial":"F41014762","alarmName":"人体感应事件","alarmPicUrl":"https://i.ys7.com/streamer/alarm/url/get?fileId=20210709102534-F41014762-1-10000-2-1&deviceSerialNo=F41014762&cn=1&isEncrypted=0&isCloudStored=0&ct=1&lc=7&bn=1_hikalarm&isDevVideo=0","alarmTime":"2021-07-09T10:25:34","homeId":"1396717478877241345","alarmType":"pir","isChecked":0,"isEncrypt":0,"deleted":0,"tenantId":"20"},{ "createTime":"1625797530627","modifyTime":"1625797530627","region":"100000000000000001","id":"1413323396351983618","alarmId":"20210709102525-F41014762-1-10000","channelNo":1,"deviceSerial":"F41014762","alarmName":"人体感应事件","alarmPicUrl":"https://i.ys7.com/streamer/alarm/url/get?fileId=20210709102525-F41014762-1-10000-2-1&deviceSerialNo=F41014762&cn=1&isEncrypted=0&isCloudStored=0&ct=1&lc=7&bn=1_hikalarm&isDevVideo=0","alarmTime":"2021-07-09T10:25:25","homeId":"1396717478877241345","alarmType":"pir","isChecked":0,"isEncrypt":0,"deleted":0,"tenantId":"20"},{ "createTime":"1625796028089","modifyTime":"1625796028089","region":"100000000000000001","id":"1413317094255034369","alarmId":"20210709100024-F41014762-1-10000","channelNo":1,"deviceSerial":"F41014762","alarmName":"人体感应事件","alarmPicUrl":"https://i.ys7.com/streamer/alarm/url/get?fileId=20210709100024-F41014762-1-10000-2-1&deviceSerialNo=F41014762&cn=1&isEncrypted=0&isCloudStored=0&ct=1&lc=7&bn=1_hikalarm&isDevVideo=0","alarmTime":"2021-07-09T10:00:23","homeId":"1396717478877241345","alarmType":"pir","isChecked":0,"isEncrypt":0,"deleted":0,"tenantId":"20"},{ "createTime":"1625795974558","modifyTime":"1625795974558","region":"100000000000000001","id":"1413316869729746946","alarmId":"20210709095931-F41014762-1-10000","channelNo":1,"deviceSerial":"F41014762","alarmName":"人体感应事件","alarmPicUrl":"https://i.ys7.com/streamer/alarm/url/get?fileId=20210709095931-F41014762-1-10000-2-1&deviceSerialNo=F41014762&cn=1&isEncrypted=0&isCloudStored=0&ct=1&lc=7&bn=1_hikalarm&isDevVideo=0","alarmTime":"2021-07-09T09:59:31","homeId":"1396717478877241345","alarmType":"pir","isChecked":0,"isEncrypt":0,"deleted":0,"tenantId":"20"},{ "createTime":"1625795966933","modifyTime":"1625795966933","region":"100000000000000001","id":"1413316837748178946","alarmId":"20210709095923-F41014762-1-10000","channelNo":1,"deviceSerial":"F41014762","alarmName":"人体感应事件","alarmPicUrl":"https://i.ys7.com/streamer/alarm/url/get?fileId=20210709095923-F41014762-1-10000-2-1&deviceSerialNo=F41014762&cn=1&isEncrypted=0&isCloudStored=0&ct=1&lc=7&bn=1_hikalarm&isDevVideo=0","alarmTime":"2021-07-09T09:59:22","homeId":"1396717478877241345","alarmType":"pir","isChecked":0,"isEncrypt":0,"deleted":0,"tenantId":"20"}],"totalCount":"13","totalPage":"2","pageNo":"1","pageSize":"10"},"timestamp":"1625807415164","isSuccess":true} |
| | | //{"platform":"1","timestamp":"1625805660249","appKey":"HDL-HOME-APP-TEST","sign":"02e433c40485b30451ebdc5ca3cd959c","deviceSerial":"F41014762","homeId":"1396717478877241345"} |
| | | /// <summary> |
| | | /// 解析丰林可视对讲推送数据 |
| | | /// </summary> |
| | |
| | | } |
| | | } |
| | | |
| | | string pushSignStr; |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string PushSignStr { |
| | | get |
| | | { |
| | | if (string.IsNullOrEmpty(pushSignStr)) |
| | | { |
| | | pushSignStr = DateTime.Now.Ticks.ToString(); |
| | | } |
| | | return pushSignStr; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 存储登录过的用户 |
| | | /// </summary> |
| | |
| | | //2021-09-23 新增获取当前网关是否本地加密 |
| | | Ins.IsLocalEncrypt = device.isLocalEncrypt; |
| | | //MainPage.Log("网关本地加密状态:" + device.local_encrypt.ToString()); |
| | | //登录网关Tcp |
| | | //登录网关Tcp tcp连接网关 |
| | | //OpenTcpClent(); |
| | | |
| | | |
| | |
| | | /// <summary> |
| | | /// 推送标识 |
| | | /// </summary> |
| | | static string PushSignStr = DateTime.Now.Ticks.ToString(); |
| | | static string PushSignStr = OnAppConfig.Instance.PushSignStr; |
| | | |
| | | /// <summary> |
| | | /// 断开远程Mqtt的链接 |
| | |
| | | }); |
| | | } |
| | | |
| | | ///// <summary> |
| | | ///// 收到CheckGateway主题 |
| | | ///// </summary> |
| | | //static void ReceiveCheckGateway(string mMes) |
| | | //{ |
| | | // if (!Control.Ins.IsRemote) return; |
| | | |
| | | // Utlis.WriteLine("ReceiveCheckGateway!"); |
| | | |
| | | // //CheckIfNeedReadAllDeviceStatus (); |
| | | |
| | | // //var obj = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePack>(mMes); |
| | | // Control.Ins.GatewayOnline = true; |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// 推送挤下线主题 |
| | | /// </summary> |
| | |
| | | { |
| | | case "15626203746": |
| | | case "13580507523": |
| | | case "18475593023": |
| | | return; |
| | | } |
| | | |
| | |
| | | /// 固定域名,正式环境 |
| | | /// 公共域名就近解析 |
| | | /// </summary> |
| | | //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; |
| | | //public const string APP_KEY = "HDL-HOME-APP"; |
| | | //public const string SECRET_KEY = "CPL345bn28gHnvi9G4tYbq3cTYkiHC"; |
| | | public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; |
| | | public const string APP_KEY = "HDL-HOME-APP"; |
| | | public const string SECRET_KEY = "CPL345bn28gHnvi9G4tYbq3cTYkiHC"; |
| | | |
| | | public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; |
| | | public const string APP_KEY = "HDL-HOME-APP-TEST"; |
| | | public const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"; |
| | | //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; |
| | | //public const string APP_KEY = "HDL-HOME-APP-TEST"; |
| | | //public const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"; |
| | | |
| | | //public const string GlobalRequestHttpsHost = "http://59.41.255.150:7777";//mmmm |
| | | //const string APP_KEY = "CPEVRLRT"; |
| | |
| | | /// </summary> |
| | | public string sipAccount; |
| | | |
| | | /// <summary> |
| | | /// 是否是后台进入的信息 |
| | | /// 给安卓使用的,安卓从通知栏进入打开可视对讲界面有异常 |
| | | /// 应该是打开了两次的问题 |
| | | /// </summary> |
| | | public bool isNotificationGoing = false; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// 收到推送,后判断呼叫住宅是否为当前住宅,不是的话重新获取SIP账号并登录 |
| | | /// </summary> |
| | | /// <param name="mESVideoInfo"></param> |
| | | public void ShowESVideoIntercom(ESVideoInfo mESVideoInfo,string mInterphoneType) |
| | | public void ShowESVideoIntercom(ESVideoInfo mESVideoInfo,string mInterphoneType, bool isNotificationGoing = false) |
| | | { |
| | | if(this.mHDLCallVideoInfo != null) |
| | | #if __ANDROID__ |
| | | //isNotificationGoing参数是专门给安卓使用的,因为安卓在后面的时候已经启动了接听的界面了,从通知栏进来的时候,callid已经被使用了,所以要重置掉这个属性 |
| | | if (isNotificationGoing) |
| | | { |
| | | this.mHDLCallVideoInfo.CallId = ""; |
| | | } |
| | | #endif |
| | | if (this.mHDLCallVideoInfo != null) |
| | | { |
| | | if(this.mHDLCallVideoInfo.CallId == mESVideoInfo.callId) |
| | | { |
| | |
| | | intent.PutExtra("lpTitleName", mHDLCallVideoInfo.DeviceName); |
| | | intent.PutExtra("lpSipAccount", mHDLCallVideoInfo.DeviceSipAccount); |
| | | } |
| | | MainPage.Log("启动自研可视对讲界面"); |
| | | Shared.Application.Activity.StartActivity(intent); |
| | | #endif |
| | | } |
| | |
| | | { |
| | | Application.HideSoftInput(); |
| | | }; |
| | | //btnIcon.MouseUpEventHandler = (sender, e) => |
| | | //{ |
| | | // etAccount.Text = "13580507523"; |
| | | // etPassword.Text = "a123456"; |
| | | //}; |
| | | |
| | | #if DEBUG |
| | | btnIcon_bg.MouseUpEventHandler += (sender, e) => |
| | |
| | | etAccount.Text = "13682244600"; |
| | | etAccount.Text = "pjh@hdlchina.com.cn"; |
| | | etAccount.Text = "13580507523"; |
| | | //etAccount.Text = "18475593023"; |
| | | etAccount.Text = "18475593023"; |
| | | //etAccount.Text = "13960905167"; |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | }; |
| | | passwordView.AddChidren(etPassword); |
| | | |
| | | |
| | | etAccount.Text = "13580507523"; |
| | | etPassword.Text = "a123456"; |
| | | |
| | | #region 密码登录-控件加载 |
| | | btnVisiblePassword = new Button() |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Net.Http; |
| | | using System.Text.RegularExpressions; |
| | | using System.Threading; |
| | | using HDL_ON.DAL.Server; |
| | | using HDL_ON.UI.CSS; |
| | | using Newtonsoft.Json.Linq; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI.UI1Login |
| | |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | |
| | | |
| | | System.Threading.Tasks.Task.Run(() => |
| | | System.Threading.Tasks.Task.Run(async () => |
| | | { |
| | | try |
| | | { |
| | | Console.WriteLine("GetCountryByIP"); |
| | | var ddd = JLCountrycode.CountryCodeView.Current.GetCountryByIP(); |
| | | Console.WriteLine(ddd); |
| | | string country = "CN"; |
| | | |
| | | try |
| | | { |
| | | using (HttpClient client = new HttpClient()) |
| | | { |
| | | // 使用 ipinfo.io 获取位置信息 |
| | | HttpResponseMessage response = await client.GetAsync("https://ipinfo.io/json"); |
| | | |
| | | if (response.IsSuccessStatusCode) |
| | | { |
| | | string json = await response.Content.ReadAsStringAsync(); |
| | | JObject jsonObject = JObject.Parse(json); |
| | | |
| | | // 从返回的 JSON 中提取国家信息 |
| | | country = jsonObject["country"].ToString(); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log("Error",$"Error fetching IP info: {ex.StackTrace}"); |
| | | } |
| | | |
| | | serverList = new List<GlobalRegionListRes>(); |
| | | var requestJson = HttpUtil.GetSignRequestJson(new GetRegionListObj() { regionMark = HttpUtil.RegionMark }); |
| | | var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_GlobalRegionList, requestJson, HttpUtil.GlobalRequestHttpsHost); |
| | |
| | | serverList = responseDataObj; |
| | | if (serverList.Count > 0) |
| | | { |
| | | if (Language.CurrentLanguage == "Chinese") |
| | | if (country == "CN")//if (Language.CurrentLanguage == "Chinese") |
| | | { |
| | | var server = serverList.Find((obj) => obj.regionUrl.Contains("china-gateway")); |
| | | if (server != null) |
| | | { |
| | | OnAppConfig.Instance.GlobalRegion.regionUrl = server.regionUrl; |
| | | OnAppConfig.Instance.GlobalRegion = server; |
| | | SetServerText(); |
| | | } |
| | | } |
| | |
| | | var server = serverList.Find((obj) => obj.regionUrl.Contains("bahrain-gateway")); |
| | | if (server != null) |
| | | { |
| | | OnAppConfig.Instance.GlobalRegion.regionUrl = server.regionUrl; |
| | | OnAppConfig.Instance.GlobalRegion = server; |
| | | SetServerText(); |
| | | } |
| | | } |
| | |
| | | tipValuesView.AddChidren(new Button() |
| | | { |
| | | Width = Application.GetRealWidth(151), |
| | | Text = "40%", |
| | | Text = "70%", |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, |
| | |
| | | tipValuesView.AddChidren(new Button() |
| | | { |
| | | Width = Application.GetRealWidth(151), |
| | | Text = "70%", |
| | | Text = "40%", |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, |
| | |
| | | /// 固定域名,正式环境 |
| | | /// 公共域名就近解析 |
| | | /// </summary> |
| | | //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; |
| | | //const string APP_KEY = "HDL-HOME-APP"; |
| | | //const string SECRET_KEY = "CPL345bn28gHnvi9G4tYbq3cTYkiHC"; |
| | | public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; |
| | | const string APP_KEY = "HDL-HOME-APP"; |
| | | const string SECRET_KEY = "CPL345bn28gHnvi9G4tYbq3cTYkiHC"; |
| | | |
| | | public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; |
| | | public const string APP_KEY = "HDL-HOME-APP-TEST"; |
| | | public const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"; |
| | | //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; |
| | | //public const string APP_KEY = "HDL-HOME-APP-TEST"; |
| | | //public const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"; |
| | | |
| | | //public const string GlobalRequestHttpsHost = "http://59.41.255.150:7777";//mmmm |
| | | //const string APP_KEY = "CPEVRLRT"; |