old mode 100755
new mode 100644
| | |
| | | /// <summary>
|
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
| | | /// </summary>
|
| | | public void ShowForm()
|
| | | /// <param name="autoUpdate">打开界面之后,如果有新版本,是否直接升级</param>
|
| | | public void ShowForm(bool autoUpdate)
|
| | | {
|
| | | //设置标题信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAboutMe));
|
| | | //初始化中部控件
|
| | | this.InitMiddleFrame();
|
| | | this.InitMiddleFrame(autoUpdate);
|
| | | }
|
| | | /// <summary>
|
| | | /// Closes the form.
|
| | |
| | | /// <summary>
|
| | | /// 初始化中部控件
|
| | | /// </summary>
|
| | | private void InitMiddleFrame()
|
| | | /// <param name="autoUpdate">打开界面之后,如果有新版本,是否直接升级</param>
|
| | | private void InitMiddleFrame(bool autoUpdate)
|
| | | {
|
| | | //头部白色背景
|
| | | var frameLogo = new FrameLayoutBase();
|
| | | frameLogo.Height = Application.GetRealHeight(484);
|
| | | frameLogo.BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
|
| | | bodyFrameLayout.AddChidren(frameLogo);
|
| | | //图标的容器
|
| | | var frameLogoBackground = new FrameLayoutBase();
|
| | | frameLogoBackground.Y = Application.GetRealHeight(104);
|
| | | frameLogoBackground.Width = this.GetPictrueRealSize(167);
|
| | | frameLogoBackground.Height = this.GetPictrueRealSize(167);
|
| | | frameLogoBackground.Gravity = Gravity.CenterHorizontal;
|
| | | frameLogoBackground.BackgroundColor = ZigbeeColor.Current.GXCButtonBlackSelectedColor;
|
| | | frameLogoBackground.Radius = (uint)Application.GetRealHeight(37);
|
| | | frameLogo.AddChidren(frameLogoBackground);
|
| | | //图标
|
| | | var btnLogo = new IconViewControl(144);
|
| | | btnLogo.UnSelectedImagePath = "Account/Logo_White.png";
|
| | | btnLogo.Gravity = Gravity.Center;
|
| | | frameLogoBackground.AddChidren(btnLogo);
|
| | | //HDL Home
|
| | | var btnLogo = new ImageView();
|
| | | btnLogo.Y = Application.GetRealHeight(104);
|
| | | btnLogo.Width = this.GetPictrueRealSize(167);
|
| | | btnLogo.Height = this.GetPictrueRealSize(167);
|
| | | btnLogo.Radius = (uint)Application.GetRealHeight(37);
|
| | | btnLogo.ImagePath = "Account/Logo_Evoyo.png";
|
| | | btnLogo.Gravity = Gravity.CenterHorizontal;
|
| | | frameLogo.AddChidren(btnLogo);
|
| | | //Evoyo Home
|
| | | var btnName = new NormalViewControl(700, 60, true);
|
| | | btnName.Y = Application.GetRealHeight(294);
|
| | | btnName.Gravity = Gravity.CenterHorizontal;
|
| | | btnName.Text = "HDL Home";
|
| | | btnName.Text = "Evoyo Home";
|
| | | btnName.TextSize = 15;
|
| | | btnName.TextColor = ZigbeeColor.Current.GXCTextDeepBlackColor;
|
| | | btnName.TextAlignment = TextAlignment.Center;
|
| | |
| | | listView.Height = Application.GetRealHeight(500);
|
| | | bodyFrameLayout.AddChidren(listView);
|
| | | //服务协议
|
| | | //var rowService = new FrameRowControl(listView.rowSpace / 2);
|
| | | //listView.AddChidren(rowService);
|
| | | //rowService.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.SLA), 400);
|
| | | //rowService.AddRightArrow();
|
| | | //rowService.AddBottomLine();
|
| | | var rowService = new FrameRowControl(listView.rowSpace / 2);
|
| | | listView.AddChidren(rowService);
|
| | | rowService.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.SLA), 400);
|
| | | rowService.AddRightArrow();
|
| | | rowService.AddBottomLine();
|
| | | rowService.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var form = new SLAForm();
|
| | | form.AddForm();
|
| | | };
|
| | |
|
| | | //版本更新
|
| | | this.rowUpdate = new FrameRowControl(listView.rowSpace / 2);
|
| | | listView.AddChidren(rowUpdate);
|
| | |
| | | //更新最新版
|
| | | btnRightView.TextID = R.MyInternationalizationString.Update;
|
| | | rowUpdate.CanClick = true;
|
| | | if (autoUpdate == true)
|
| | | {
|
| | | //直接升级
|
| | | rowUpdate.ButtonClickEvent?.Invoke(null, null);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// CheckVersion
|
| | | /// </summary>
|
| | | private void CheckVersion()
|
| | | {
|
| | | new System.Threading.Thread(async () =>
|
| | | {
|
| | | |
| | | })
|
| | | { IsBackground = true }.Start();
|
| | |
|
| | | }
|
| | | /// <summary>
|
| | | /// 设置进度控件不可见
|
| | | /// </summary>
|
| | |
| | | if (results[0] == null)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | var newVersion = results[0]["version"]?.ToString();
|
| | | var updateContent = results[0]["releaseNotes"]?.ToString();
|
| | | if (newVersion != CommonPage.CodeIDString)
|
| | | } |
| | | var newVersion = results[0]["version"]?.ToString(); |
| | | |
| | | var updateContent = results[0]["releaseNotes"]?.ToString();
|
| | | if (newVersion.CompareTo(CommonPage.CodeIDString) > 0)
|
| | | {
|
| | | return true;
|
| | | }
|
| | |
| | | #elif Android
|
| | | try
|
| | | {
|
| | | var versionResult = await RequestHttpsAndroidAppVersionAsync();
|
| | | var versionResult = RequestHttpsAndroidAppVersionAsync();
|
| | | if (versionResult == null)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | if (int.Parse(versionResult.FirmwareVersion.Replace(".", "")) > int.Parse(CommonPage.CodeIDString.Replace(".", "")))
|
| | | if (versionResult.FirmwareVersion.CompareTo(CommonPage.CodeIDString) > 0)
|
| | | {
|
| | | distributedMark = versionResult.DistributedMark;
|
| | | return true;
|
| | |
| | | };
|
| | | var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj);
|
| | |
|
| | | var bytesTotalLengthResult = await CommonPage.Instance.RequestHttpsZigbeeAsync("FirmwareMana/DownloadPlatformUploadFirmwarePreLength", Encoding.UTF8.GetBytes(requestJson));
|
| | | var bytesTotalLengthResult = CommonPage.Instance.RequestHttpsZigbeeAsync("FirmwareMana/DownloadPlatformUploadFirmwarePreLength", Encoding.UTF8.GetBytes(requestJson));
|
| | | if (bytesTotalLengthResult == null || bytesTotalLengthResult.ResponseData == null)
|
| | | {
|
| | | CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.UpdateAppFail);
|
| | |
| | | try
|
| | | {
|
| | | var webClient = new WebClient { };
|
| | | var result = await webClient.DownloadDataTaskAsync("https://itunes.apple.com/lookup?id=1461693569");
|
| | | var result = await webClient.DownloadDataTaskAsync("https://itunes.apple.com/lookup?id=1528702586");
|
| | | if (result == null)
|
| | | {
|
| | | return null;
|
| | |
| | | /// </summary>
|
| | | public void OpenUrl()
|
| | | {
|
| | | Uri url = new Uri("https://itunes.apple.com/cn/app/hdl-home/id1461693569?mt=8");
|
| | | Uri url = new Uri("https://itunes.apple.com/cn/app/hdl-home/id1528702586?mt=8");
|
| | | UIKit.UIApplication.SharedApplication.OpenUrl(url);
|
| | | }
|
| | | #elif Android
|
| | |
| | | if (Android.OS.BuildVersionCodes.M < Android.OS.Build.VERSION.SdkInt)
|
| | | {
|
| | | //参数1 上下文, 参数2 Provider主机地址 和配置文件中保持一致 参数3 共享的文件
|
| | | var apkUri = Android.Support.V4.Content.FileProvider.GetUriForFile(context, "com.hdl.home.fileProvider", file);
|
| | | var apkUri = Android.Support.V4.Content.FileProvider.GetUriForFile(context, "com.evoyo.home.fileProvider", file);
|
| | | //添加这一句表示对目标应用临时授权该Uri所代表的文件
|
| | | intent.AddFlags(Android.Content.ActivityFlags.GrantReadUriPermission);
|
| | | intent.SetDataAndType(apkUri, "application/vnd.android.package-archive");
|
| | |
| | | /// 获取 Android-APP 版本信息
|
| | | /// </summary>
|
| | | /// <returns>The https app version async.</returns>
|
| | | private async System.Threading.Tasks.Task<Common.ResponseEntity.ApkInfoOBJ> RequestHttpsAndroidAppVersionAsync()
|
| | | private Common.ResponseEntity.ApkInfoOBJ RequestHttpsAndroidAppVersionAsync()
|
| | | {
|
| | | try
|
| | | {
|
| | |
| | | RequestVersion = CommonPage.CodeIDString
|
| | | };
|
| | | var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestOBJ);
|
| | | var result = await CommonPage.Instance.RequestHttpsZigbeeAsync("FirmwareMana/DetectionPlatformUploadFirmware", System.Text.Encoding.UTF8.GetBytes(requestJson));
|
| | | var result = CommonPage.Instance.RequestHttpsZigbeeAsync("FirmwareMana/DetectionPlatformUploadFirmware", System.Text.Encoding.UTF8.GetBytes(requestJson));
|
| | | if (result == null)
|
| | | {
|
| | | return null;
|
| | |
| | | {
|
| | | return null;
|
| | | }
|
| | | int MaxIndex = 0;
|
| | | int NewVersion = 0;
|
| | |
|
| | | Common.ResponseEntity.ApkInfoOBJ apkInfoOBJ = null;
|
| | | for (int i = 0; i < responeData.pageData.Count; i++)
|
| | | {
|
| | | var apkInfo = responeData.pageData[i];
|
| | | var version = int.Parse(apkInfo.FirmwareVersion.Replace(".", ""));
|
| | | if (version > NewVersion)
|
| | | if (apkInfoOBJ == null || apkInfo.FirmwareVersion.CompareTo(apkInfoOBJ.FirmwareVersion) > 0)
|
| | | {
|
| | | NewVersion = version;
|
| | | MaxIndex = i;
|
| | | apkInfoOBJ = apkInfo;
|
| | | }
|
| | | }
|
| | | return responeData.pageData[MaxIndex];
|
| | | return apkInfoOBJ;
|
| | | }
|
| | | return null;
|
| | | }
|