| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Net;
|
| | | using System.Runtime.Remoting.Contexts;
|
| | | using System.Text;
|
| | | using Shared.Common;
|
| | | using Shared.Phone.Device.CommonForm;
|
| | |
|
| | | namespace Shared.Phone.UserCenter.Abount
|
| | | {
|
| | | /// <summary>
|
| | |
| | | /// <summary>
|
| | | /// The web client.
|
| | | /// </summary>
|
| | | public WebClient webClient=new WebClient { };
|
| | | public WebClient webClient = new WebClient { };
|
| | | /// <summary>
|
| | | /// 更新中
|
| | | /// </summary>
|
| | | public Button updatingBtn;
|
| | | public NormalViewControl btnUpdating;
|
| | | /// <summary>
|
| | | /// distributedMark
|
| | | /// </summary>
|
| | |
| | | /// <summary>
|
| | | /// updateRow
|
| | | /// </summary>
|
| | | public DeviceInfoRow updateRow;
|
| | | public FrameRowControl rowUpdate;
|
| | | /// <summary>
|
| | | /// 下载安卓apk的byte长度
|
| | | /// </summary>
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | /// <summary>
|
| | | /// Initializes a new instance of the <see cref="T:Shared.Phone.UserCenter.Abount.AbountForm"/> class.
|
| | | /// </summary>
|
| | | public AbountForm()
|
| | | {
|
| | |
|
| | | }
|
| | | /// <summary>
|
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
| | | /// </summary>
|
| | |
| | | public override void CloseFormBefore()
|
| | | {
|
| | | #if Android
|
| | | //if (isUpdating == true)
|
| | | //{
|
| | | //var alert = new Alert(Language.StringByID(R.MyInternationalizationString.TIP), Language.StringByID(R.MyInternationalizationString.CancelUpdating), Language.StringByID(R.MyInternationalizationString.Cancel), Language.StringByID(R.MyInternationalizationString.Confrim));
|
| | | //alert.Show();
|
| | | //alert.ResultEventHandler += (send, e) =>
|
| | | //{
|
| | | // if (e)
|
| | | // {
|
| | | SetDownLoadBtnNoVisible();
|
| | | CancelDownLoadApkAsync();
|
| | | base.CloseFormBefore();
|
| | | //}
|
| | | // else
|
| | | // {
|
| | | // return;
|
| | | // }
|
| | | // };
|
| | | //}
|
| | | //else
|
| | | //{
|
| | | // base.CloseFormBefore();
|
| | | //}
|
| | | SetDownLoadBtnNoVisible();
|
| | | CancelDownLoadApkAsync();
|
| | | base.CloseFormBefore();
|
| | | #elif iOS
|
| | | base.CloseFormBefore();
|
| | | #endif
|
| | |
| | | /// </summary>
|
| | | private void InitMiddleFrame()
|
| | | {
|
| | | bodyFrameLayout.BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor;
|
| | | var logoFrameLayout = new FrameLayout
|
| | | //头部白色背景
|
| | | var frameLogo = new FrameLayoutBase();
|
| | | frameLogo.Height = Application.GetRealHeight(484);
|
| | | frameLogo.BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
|
| | | bodyFrameLayout.AddChidren(frameLogo);
|
| | | //图标
|
| | | 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 = "Evoyo Home";
|
| | | btnName.TextSize = 15;
|
| | | btnName.TextColor = ZigbeeColor.Current.GXCTextDeepBlackColor;
|
| | | btnName.TextAlignment = TextAlignment.Center;
|
| | | frameLogo.AddChidren(btnName);
|
| | | //版本号
|
| | | var btnVersion = new NormalViewControl(700, 50, true);
|
| | | btnVersion.Y = Application.GetRealHeight(366);
|
| | | btnVersion.Gravity = Gravity.CenterHorizontal;
|
| | | btnVersion.Text = $"{Language.StringByID(R.MyInternationalizationString.VersionCode)} {CommonPage.CodeIDString}";
|
| | | btnVersion.TextSize = 12;
|
| | | btnVersion.TextColor = ZigbeeColor.Current.GXCTextGrayColor;
|
| | | btnVersion.TextAlignment = TextAlignment.Center;
|
| | | frameLogo.AddChidren(btnVersion);
|
| | | //列表控件
|
| | | var listView = new FrameListControl(12);
|
| | | listView.Y = frameLogo.Bottom + Application.GetRealHeight(23);
|
| | | listView.BackgroundColor = UserCenterColor.Current.White;
|
| | | 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();
|
| | | rowService.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | Height = Application.GetRealHeight(484),
|
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
|
| | | };
|
| | | bodyFrameLayout.AddChidren(logoFrameLayout);
|
| | |
|
| | | var logoBackground = new FrameLayout
|
| | | {
|
| | | Y = Application.GetRealHeight(104),
|
| | | Width = Application.GetMinRealAverage(167),
|
| | | Height = Application.GetMinRealAverage(167),
|
| | | Gravity = Gravity.CenterHorizontal,
|
| | | BackgroundColor = ZigbeeColor.Current.GXCButtonBlackSelectedColor,
|
| | | Radius = (uint)Application.GetRealHeight(37),
|
| | | };
|
| | | logoFrameLayout.AddChidren(logoBackground);
|
| | |
|
| | | var logoBtn = new Button()
|
| | | {
|
| | | Width = Application.GetMinRealAverage(144),
|
| | | Height = Application.GetMinRealAverage(144),
|
| | | UnSelectedImagePath = "Account/Logo_White.png",
|
| | | Gravity = Gravity.Center
|
| | | };
|
| | | logoBackground.AddChidren(logoBtn);
|
| | |
|
| | | var nameBtn = new Button()
|
| | | {
|
| | | Y = Application.GetRealHeight(294),
|
| | | Width = Application.GetRealWidth(700),
|
| | | Height = Application.GetRealHeight(60),
|
| | | Gravity = Gravity.CenterHorizontal,
|
| | | Text = "HDL Home",
|
| | | TextSize = 15,
|
| | | TextColor = ZigbeeColor.Current.GXCTextDeepBlackColor
|
| | | };
|
| | | logoFrameLayout.AddChidren(nameBtn);
|
| | |
|
| | | var versionBtn = new Button()
|
| | | {
|
| | | Y = Application.GetRealHeight(366),
|
| | | Width = Application.GetRealWidth(700),
|
| | | Height = Application.GetRealHeight(50),
|
| | | Gravity = Gravity.CenterHorizontal,
|
| | | Text = $"{Language.StringByID(R.MyInternationalizationString.VersionCode)} {CommonPage.CodeIDString}",
|
| | | TextSize = 12,
|
| | | TextColor = ZigbeeColor.Current.GXCTextGrayColor
|
| | | };
|
| | | logoFrameLayout.AddChidren(versionBtn);
|
| | |
|
| | |
|
| | | var versionFL = new FrameLayout
|
| | | {
|
| | | Y = Application.GetRealHeight(510),
|
| | | Height = Application.GetRealHeight(300),
|
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
|
| | | };
|
| | | bodyFrameLayout.AddChidren(versionFL);
|
| | |
|
| | | var SLARow = new DeviceInfoRow(12);
|
| | | SLARow.Init();
|
| | | SLARow.SetTipTitle(R.MyInternationalizationString.SLA);
|
| | | SLARow.NameText.TextAlignment = TextAlignment.CenterRight;
|
| | | versionFL.AddChidren(SLARow);
|
| | | SLARow.ClickBtn.MouseUpEventHandler += (sender, e) =>
|
| | | {
|
| | | var slaForm = new SLAForm();
|
| | | slaForm.AddForm();
|
| | | var form = new SLAForm();
|
| | | form.AddForm();
|
| | | };
|
| | |
|
| | | updateRow = new DeviceInfoRow(12 + 127 + 12);
|
| | | updateRow.Init();
|
| | | updateRow.SetTipTitle(R.MyInternationalizationString.UpdateVersion);
|
| | | updateRow.NameText.TextAlignment = TextAlignment.CenterRight;
|
| | | updateRow.HideLine(true);
|
| | | updateRow.SetTitle(R.MyInternationalizationString.TheAppVersionIsNewest);
|
| | | updateRow.CanClick(false);
|
| | | updateRow.SetTitleColor(ZigbeeColor.Current.GXCTextGrayColor);
|
| | | versionFL.AddChidren(updateRow);
|
| | | updateRow.ClickBtn.MouseUpEventHandler += (sender, e) =>
|
| | | //版本更新
|
| | | this.rowUpdate = new FrameRowControl(listView.rowSpace / 2);
|
| | | listView.AddChidren(rowUpdate);
|
| | | rowUpdate.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.UpdateVersion), 400);
|
| | | rowUpdate.AddRightArrow();
|
| | | var btnRightView = rowUpdate.AddMostRightView("", 400);
|
| | | rowUpdate.CanClick = false;
|
| | | rowUpdate.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | UpdateVersion();
|
| | | };
|
| | | //调整桌布高度
|
| | | listView.AdjustRealHeight(Application.GetRealHeight(23));
|
| | |
|
| | | //更新中
|
| | | this.btnUpdating = new NormalViewControl(556, 106, true);
|
| | | btnUpdating.Y = Application.GetRealHeight(994);
|
| | | btnUpdating.Radius = (uint)Application.GetRealHeight(53);
|
| | | btnUpdating.BackgroundColor = ZigbeeColor.Current.GXCDailogBackGroundColor;
|
| | | btnUpdating.TextID = R.MyInternationalizationString.Updating;
|
| | | btnUpdating.TextSize = 15;
|
| | | btnUpdating.TextColor = ZigbeeColor.Current.GXCTextWhiteColor;
|
| | | btnUpdating.Gravity = Gravity.CenterHorizontal;
|
| | | btnUpdating.TextAlignment = TextAlignment.Center;
|
| | | bodyFrameLayout.AddChidren(btnUpdating);
|
| | |
|
| | | updatingBtn = new Button()
|
| | | //设置进度控件不可见
|
| | | this.SetDownLoadBtnNoVisible();
|
| | |
|
| | | //检测新版本
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | Y = Application.GetRealHeight(994),
|
| | | Width = Application.GetRealWidth(556),
|
| | | Height = Application.GetRealHeight(106),
|
| | | Radius=(uint)Application.GetRealHeight(53),
|
| | | BackgroundColor=ZigbeeColor.Current.GXCDailogBackGroundColor,
|
| | | TextID = R.MyInternationalizationString.Updating,
|
| | | TextSize=15,
|
| | | TextColor = ZigbeeColor.Current.GXCTextWhiteColor,
|
| | | Gravity=Gravity.CenterHorizontal
|
| | | };
|
| | | bodyFrameLayout.AddChidren(updatingBtn);
|
| | |
|
| | | SetDownLoadBtnNoVisible();
|
| | | CheckVersion();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// CheckVersion
|
| | | /// </summary>
|
| | | private void CheckVersion()
|
| | | {
|
| | | new System.Threading.Thread(async () =>
|
| | | {
|
| | | var re = await CanUpdateAsync();
|
| | | if (re)
|
| | | var result = await CanUpdateAsync();
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | if (result)
|
| | | {
|
| | | updateRow.CanClick(true);
|
| | | updateRow.SetTitleColor(ZigbeeColor.Current.GXCButtonSelectedColor);
|
| | | updateRow.SetTitle(R.MyInternationalizationString.Update);
|
| | | });
|
| | | }
|
| | | })
|
| | | { IsBackground = true }.Start();
|
| | | //更新最新版
|
| | | btnRightView.TextID = R.MyInternationalizationString.Update;
|
| | | rowUpdate.CanClick = true;
|
| | | }
|
| | | else
|
| | | {
|
| | | btnRightView.TextID = R.MyInternationalizationString.TheAppVersionIsNewest;
|
| | | }
|
| | | });
|
| | |
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 设置进度控件不可见
|
| | | /// </summary>
|
| | | private void SetDownLoadBtnNoVisible()
|
| | | {
|
| | | isUpdating = false;
|
| | | updatingBtn.Visible = false;
|
| | | btnUpdating.Visible = false;
|
| | | }
|
| | | /// <summary>
|
| | | /// 设置进度控件可见
|
| | |
| | | private void SetDownLoadBtnVisible()
|
| | | {
|
| | | isUpdating = true;
|
| | | updatingBtn.Visible = true;
|
| | | updateRow.CanClick(false);
|
| | | btnUpdating.Visible = true;
|
| | | rowUpdate.CanClick = false;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | }
|
| | | var newVersion = results[0]["version"]?.ToString();
|
| | | var updateContent = results[0]["releaseNotes"]?.ToString();
|
| | | if (newVersion != CommonPage.CodeIDString)
|
| | | 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;
|
| | |
| | | #elif Android
|
| | | try
|
| | | {
|
| | | var requestObj = new SendDataToServer.DownLoadAndroidApk
|
| | | var pra = new { RequestVersion = CommonPage.RequestVersion, DistributedMark = distributedMark };
|
| | | var result = HdlFirmwareUpdateLogic.Current.RequestZigbeeHttps("FirmwareMana/DownloadPlatformUploadFirmwarePreLength", pra, 8);
|
| | | if (result == null || result.Length == 0)
|
| | | {
|
| | | RequestVersion = CommonPage.RequestVersion,
|
| | | DistributedMark = distributedMark
|
| | | };
|
| | | var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj);
|
| | |
|
| | | var bytesTotalLengthResult = await CommonPage.Instance.RequestHttpsZigbeeAsync("FirmwareMana/DownloadPlatformUploadFirmwarePreLength", Encoding.UTF8.GetBytes(requestJson));
|
| | | if (bytesTotalLengthResult == null || bytesTotalLengthResult.ResponseData == null)
|
| | | {
|
| | | CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.UpdateAppFail);
|
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.UpdateAppFail));
|
| | | return;
|
| | | }
|
| | | var bytesTotalLength = Newtonsoft.Json.JsonConvert.DeserializeObject<long>(bytesTotalLengthResult.ResponseData.ToString());
|
| | | var jobject = Newtonsoft.Json.Linq.JObject.Parse(Encoding.UTF8.GetString(result));
|
| | | if (jobject.Property("StateCode") == null || jobject["StateCode"].ToString().ToUpper() != "SUCCESS")
|
| | | {
|
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.UpdateAppFail));
|
| | | return;
|
| | | }
|
| | |
|
| | | var bytesTotalLength = Newtonsoft.Json.JsonConvert.DeserializeObject<long>(jobject["ResponseData"].ToString());
|
| | | if (bytesTotalLength == 0)
|
| | | {
|
| | | CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.UpdateAppFail);
|
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.UpdateAppFail));
|
| | | return;
|
| | | }
|
| | | ApkBytesTotalLength = bytesTotalLength;
|
| | | var bytes = await DownLoadApkAsync("FirmwareMana/DownloadPlatformUploadFirmware", Encoding.UTF8.GetBytes(requestJson));
|
| | | var bytes = await DownLoadApkAsync("FirmwareMana/DownloadPlatformUploadFirmware", Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(pra)));
|
| | | if (bytes == null)
|
| | | {
|
| | | CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.UpdateAppFail);
|
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.UpdateAppFail));
|
| | | return;
|
| | | }
|
| | | if (bytes.ToString().Contains("DownloadFail"))
|
| | | {
|
| | | CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.FailedPleaseTryAgain);
|
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.FailedPleaseTryAgain));
|
| | | return;
|
| | | }
|
| | | var path = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, "home.apk");
|
| | |
| | | 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 ApkInfoOBJ RequestHttpsAndroidAppVersionAsync()
|
| | | {
|
| | | try
|
| | | {
|
| | | var requestOBJ = new SendDataToServer.GetAndroidApkInfoOBJ
|
| | | {
|
| | | Name = "ZigbeeApp",
|
| | | RequestVersion = CommonPage.CodeIDString
|
| | | };
|
| | | var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestOBJ);
|
| | | var result = await CommonPage.Instance.RequestHttpsZigbeeAsync("FirmwareMana/DetectionPlatformUploadFirmware", System.Text.Encoding.UTF8.GetBytes(requestJson));
|
| | | if (result == null)
|
| | | var pra = new { Name = "ZigbeeApp", RequestVersion = Common.CommonPage.RequestVersion };
|
| | | var result = HdlFirmwareUpdateLogic.Current.RequestZigbeeHttps("FirmwareMana/DetectionPlatformUploadFirmware", pra, 4);
|
| | | if (result == null || result.Length == 0)
|
| | | {
|
| | | return null;
|
| | | }
|
| | | if (result.StateCode.ToUpper() == "SUCCESS")
|
| | | var jobject = Newtonsoft.Json.Linq.JObject.Parse(Encoding.UTF8.GetString(result));
|
| | | if (jobject.Property("StateCode") == null || jobject["StateCode"].ToString().ToUpper() != "SUCCESS")
|
| | | {
|
| | | if (result.ResponseData == null)
|
| | | {
|
| | | return null;
|
| | | }
|
| | |
|
| | | var responeData = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.ResponseEntity.ApkInfoRes>(result.ResponseData.ToString());
|
| | | if (responeData == null || responeData.pageData == null || responeData.pageData.Count == 0)
|
| | | {
|
| | | return null;
|
| | | }
|
| | | int MaxIndex = 0;
|
| | | int NewVersion = 0;
|
| | | for (int i = 0; i < responeData.pageData.Count; i++)
|
| | | {
|
| | | var apkInfo = responeData.pageData[i];
|
| | | var version = int.Parse(apkInfo.FirmwareVersion.Replace(".", ""));
|
| | | if (version > NewVersion)
|
| | | {
|
| | | NewVersion = version;
|
| | | MaxIndex = i;
|
| | | }
|
| | | }
|
| | | return responeData.pageData[MaxIndex];
|
| | | return null;
|
| | | }
|
| | | return null;
|
| | | string resultValue = jobject["ResponseData"].ToString();
|
| | |
|
| | | var responeData = Newtonsoft.Json.JsonConvert.DeserializeObject<ApkInfoRes>(resultValue);
|
| | | if (responeData == null || responeData.pageData == null || responeData.pageData.Count == 0)
|
| | | {
|
| | | return null;
|
| | | }
|
| | |
|
| | | ApkInfoOBJ apkInfoOBJ = null;
|
| | | for (int i = 0; i < responeData.pageData.Count; i++)
|
| | | {
|
| | | var apkInfo = responeData.pageData[i];
|
| | | if (apkInfoOBJ == null || apkInfo.FirmwareVersion.CompareTo(apkInfoOBJ.FirmwareVersion) > 0)
|
| | | {
|
| | | apkInfoOBJ = apkInfo;
|
| | | }
|
| | | }
|
| | | return apkInfoOBJ;
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | |
| | | try
|
| | | {
|
| | | webClient.Headers.Add(HttpRequestHeader.ContentType, "application/json");
|
| | | webClient.Headers.Add(HttpRequestHeader.Authorization, Config.Instance.Token);
|
| | | webClient.UploadProgressChanged += Client_DownloadProgressChanged;
|
| | | webClient.UploadDataCompleted += Client_UploadCompleted;
|
| | | var result = webClient.UploadDataTaskAsync($"{CommonPage.RequestHttpsHost}/{requestUrl}", "POST", byteData);
|
| | | var result = webClient.UploadDataTaskAsync($"{HdlFirmwareUpdateLogic.Current.RequestHttpsHost}/{requestUrl}", "POST", byteData);
|
| | | if (result == null)
|
| | | {
|
| | | return null;
|
| | |
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | SetDownLoadBtnVisible();
|
| | | updatingBtn.Text = $"{ Language.StringByID(R.MyInternationalizationString.Updating)} {(int)(e.BytesReceived / (float)ApkBytesTotalLength * 100)}%";
|
| | | btnUpdating.Text = $"{ Language.StringByID(R.MyInternationalizationString.Updating)} {(int)(e.BytesReceived / (float)ApkBytesTotalLength * 100)}%";
|
| | | });
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | | #endif
|
| | |
|
| | | //[Serializable]
|
| | | public class ApkInfoRes
|
| | | {
|
| | | public int PageIndex;
|
| | | public int PageSize;
|
| | | public int TotalCount;
|
| | | public int TotalPages;
|
| | | public bool HasPreviousPage;
|
| | | public bool HasNextPage;
|
| | | public List<ApkInfoOBJ> pageData = new List<ApkInfoOBJ> { };
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 下载apk
|
| | | /// </summary>
|
| | | [Serializable]
|
| | | public class ApkInfoOBJ
|
| | | {
|
| | | public string Name { get; set; }
|
| | | public string FirmwareVersion { get; set; }
|
| | | public string Remarks { get; set; }
|
| | | public string DistributedMark { get; set; }
|
| | | public string Id { get; set; }
|
| | | public string CreatedOnUtc { get; set; }
|
| | | }
|
| | | }
|
| | | }
|