From 163777d8a2cb7cfa469f54a7042528870ebc10a3 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 09 十二月 2019 17:46:20 +0800 Subject: [PATCH] 一个新版本 --- ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFirmwareUpdateForm.cs | 134 +++++++++++++++++++++++--------------------- 1 files changed, 69 insertions(+), 65 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFirmwareUpdateForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFirmwareUpdateForm.cs index cf755c0..afe6c49 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFirmwareUpdateForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFirmwareUpdateForm.cs @@ -30,51 +30,50 @@ /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) /// </summary> /// <param name="device">ota璁惧瀵硅薄</param> - /// <param name="deviceFirmware">鍥轰欢鍗囩骇淇℃伅</param> - public void ShowForm(OTADevice device, FirmwareVersionInfo deviceFirmware) - { - this.deviceMac = device.DeviceAddr; - //鍒濆鍖栦腑閮ㄤ俊鎭� - this.InitMiddleFrame(device, deviceFirmware); - } - - /// <summary> - /// 鍒濆鍖栦腑閮ㄤ俊鎭� - /// </summary> - /// <param name="device">ota璁惧瀵硅薄</param> - /// <param name="deviceFirmware">鍥轰欢鍗囩骇淇℃伅</param> - private void InitMiddleFrame(OTADevice device, FirmwareVersionInfo deviceFirmware) + /// <param name="deviceFirmware">鍥轰欢鍗囩骇淇℃伅</param> + public void ShowForm(OTADevice device, FirmwareVersionInfo deviceFirmware) { - var frameBack = new FrameLayout(); - frameBack.Width = Application.GetRealWidth(674); - frameBack.Height = Application.GetRealHeight(386); - frameBack.BackgroundColor = UserCenterColor.Current.White; - frameBack.Gravity = Gravity.CenterHorizontal; - frameBack.Y = Application.GetRealHeight(683); - frameBack.Radius = (uint)Application.GetMinRealAverage(6); - bodyFrameLayout.AddChidren(frameBack); - - //杩涘害鏄剧ず鏂囨湰 - var btnText = new NormalViewControl(frameBack.Width, Application.GetRealHeight(58), false); - btnText.Y = Application.GetRealHeight(248); - btnText.TextColor = UserCenterColor.Current.TextGrayColor1; - btnText.TextAlignment = TextAlignment.Center; - //btnText.Text = "鍗囩骇涓�"; + this.deviceMac = device.DeviceAddr; + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(device, deviceFirmware); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + /// <param name="device">ota璁惧瀵硅薄</param> + /// <param name="deviceFirmware">鍥轰欢鍗囩骇淇℃伅</param> + private void InitMiddleFrame(OTADevice device, FirmwareVersionInfo deviceFirmware) + { + var frameBack = new FrameLayout(); + frameBack.Width = Application.GetRealWidth(674); + frameBack.Height = Application.GetRealHeight(386); + frameBack.BackgroundColor = UserCenterColor.Current.White; + frameBack.Gravity = Gravity.CenterHorizontal; + frameBack.Y = Application.GetRealHeight(683); + frameBack.Radius = (uint)Application.GetRealHeight(17); + bodyFrameLayout.AddChidren(frameBack); + + //杩涘害鏄剧ず鏂囨湰 + var btnText = new NormalViewControl(frameBack.Width, Application.GetRealHeight(58), false); + btnText.Y = Application.GetRealHeight(248); + btnText.TextColor = UserCenterColor.Current.TextGrayColor1; + btnText.TextAlignment = TextAlignment.Center; + //btnText.Text = "鍗囩骇涓�"; frameBack.AddChidren(btnText); //杩涘害鏉� - var btnProRow = new FrameLayout(); - btnProRow.Gravity = Gravity.CenterHorizontal; - btnProRow.Y = Application.GetRealHeight(161); - btnProRow.Width = Application.GetRealWidth(559); - btnProRow.Height = Application.GetRealHeight(29); + var btnProRow = new FrameLayout(); + btnProRow.Gravity = Gravity.CenterHorizontal; + btnProRow.Y = Application.GetRealHeight(161); + btnProRow.Width = Application.GetRealWidth(559); + btnProRow.Height = Application.GetRealHeight(29); btnProRow.BackgroundColor = 0xfff5f5f5; btnProRow.Radius = (uint)Application.GetRealHeight(29) / 2; - frameBack.AddChidren(btnProRow); - var btnProgressBar = new FrameLayout(); - btnProgressBar.Width = 0; - btnProgressBar.Height = btnProRow.Height; - btnProgressBar.Radius = btnProRow.Radius; + frameBack.AddChidren(btnProRow); + var btnProgressBar = new FrameLayout(); + btnProgressBar.Width = 0; + btnProgressBar.Height = btnProRow.Height; btnProgressBar.BackgroundColor = 0xfffb744a; btnProgressBar.Radius = (uint)Application.GetRealHeight(29) / 2; btnProRow.AddChidren(btnProgressBar); @@ -89,7 +88,7 @@ var btnProgressPic = new PicViewControl(84, 60); btnProgressPic.UnSelectedImagePath = "Item/ProgressMsg.png"; frameProgress.AddChidren(btnProgressPic); - var btnProgressView = new NormalViewControl(84, 32, true); + var btnProgressView = new NormalViewControl(84, 45, true); btnProgressView.TextSize = 10; btnProgressView.TextAlignment = TextAlignment.Center; btnProgressView.Text = "0%"; @@ -121,30 +120,33 @@ //鏇存柊鐘舵�佸彉鍖栫殑浜嬩欢 updateLogic.UpdateStatuChangedEvent += (div, msg) => { - if (div == -1) + HdlThreadLogic.Current.RunMain(() => { - //寮傚父 - this.ShowMassage(ShowMsgType.Tip, msg); - this.CloseForm(); - } - else if (div == 0) - { - //涓�鑸俊鎭� - btnText.Text = msg; - } - else if (div == 1) - { - //鍗囩骇瀹屾垚 - this.ShowMassage(ShowMsgType.Tip, msg); - //璋冪敤鍥炶皟鍑芥暟 - this.FinishUpdateEvent?.Invoke(); - this.CloseForm(); - } - else if (div == 2) - { - //涓诲姩缁堟鍗囩骇 - this.CloseForm(); - } + if (div == -1) + { + //寮傚父 + this.ShowMassage(ShowMsgType.Tip, msg); + this.CloseForm(); + } + else if (div == 0) + { + //涓�鑸俊鎭� + btnText.Text = msg; + } + else if (div == 1) + { + //鍗囩骇瀹屾垚 + this.ShowMassage(ShowMsgType.Tip, msg); + //璋冪敤鍥炶皟鍑芥暟 + this.FinishUpdateEvent?.Invoke(); + this.CloseForm(); + } + else if (div == 2) + { + //涓诲姩缁堟鍗囩骇 + this.CloseForm(); + } + }); }; //杩涘害鍊兼敼鍙樹簨浠� updateLogic.ProgressEvent += (value) => @@ -180,10 +182,12 @@ /// <summary> /// 鐢婚潰鍏抽棴 /// </summary> - public override void CloseForm() + public override void CloseFormBefore() { //瀹夊崜鍙互鐐瑰嚮绯荤粺鐨勮繑鍥為敭 + UserView.HomePage.Instance.ScrollEnabled = true; Shared.Common.CommonPage.BackKeyCanClick = true; + //鍗囩骇瀵硅薄 if (FirmwareUpdateResourse.dicDeviceUpdateList.ContainsKey(deviceMac) == true && FirmwareUpdateResourse.dicDeviceUpdateList[deviceMac].IsFinishUpdate == true) @@ -194,7 +198,7 @@ } this.FinishUpdateEvent = null; - base.CloseForm(); + base.CloseFormBefore(); } #endregion -- Gitblit v1.8.0