WJC
2019-12-30 f1c3921b08bb22ac6f5db22d620e01d7e8e5c49f
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceUpdateLogic.cs
@@ -19,6 +19,7 @@
        /// <para> 0:更新状态正常变化,后面的值为状态变更的文本翻译</para>
        /// <para> 1:升级成功</para>
        /// <para> 2:主动终止升级</para>
        /// <para> 3:从等待中取消(目前还没有用)</para>
        /// </summary>
        public Action<int, string> UpdateStatuChangedEvent = null;
        /// <summary>
@@ -92,7 +93,9 @@
                {
                    FirmwareUpdateResourse.dicDeviceUpdateList.Remove(otaDevice.DeviceAddr);
                }
                //取消
                this.UpdateStatu = UpdateStatuMode.None;
                this.UpdateStatuChangedEvent?.Invoke(3, "");
                return;
            }
            //如果它有状态,则表示之前它被什么错误中断了
@@ -382,12 +385,11 @@
            {
                this.zbGateway.ReportAction -= this.UpdateDeviceProgress;
                new System.Threading.Thread(async () =>
                HdlThreadLogic.Current.RunThread(async () =>
                {
                    //终止升级
                    await this.otaDevice.KillUpdateAsync(this.zbGateway, 200);
                })
                { IsBackground = true }.Start();
                });
                this.UpdateStatu = UpdateStatuMode.DeviceUpdateFail;
                return;
@@ -556,7 +558,7 @@
            //升级成功
            this.UpdateStatu = UpdateStatuMode.UpdateSuccess;
            new System.Threading.Thread(() =>
            HdlThreadLogic.Current.RunThread(() =>
            {
                System.Threading.Thread.Sleep(3000);
@@ -578,22 +580,18 @@
                //移除事件
                HdlDeviceImageInfoLogic.Current.RemoveDeviceFirmwareVersionThread(otaDevice);
                Application.RunOnMainThread(() =>
                {
                    //设置进度值直接为100%
                    this.ProgressEvent?.Invoke(100);
                    //状态变更
                    this.IsFinishUpdate = true;
                    //升级完成
                    this.UpdateStatu = UpdateStatuMode.UpdateFinish;
                //设置进度值直接为100%
                this.ProgressEvent?.Invoke(100);
                //状态变更
                this.IsFinishUpdate = true;
                //升级完成
                this.UpdateStatu = UpdateStatuMode.UpdateFinish;
                    HdlFirmwareUpdateLogic.DoUpdateNextFirmware();
                HdlFirmwareUpdateLogic.DoUpdateNextFirmware();
                    //设备升级成功!
                    this.UpdateStatuChangedEvent?.Invoke(1, Language.StringByID(R.MyInternationalizationString.uDeviceUpdateSuccess));
                });
            })
            { IsBackground = true }.Start();
                //设备升级成功!
                this.UpdateStatuChangedEvent?.Invoke(1, Language.StringByID(R.MyInternationalizationString.uDeviceUpdateSuccess));
            });
        }
        #endregion
@@ -636,7 +634,7 @@
        private void StartDownLoadTimeOutThread()
        {
            this.downLoadTimeOutCount = 30;
            new System.Threading.Thread(() =>
            HdlThreadLogic.Current.RunThread(() =>
            {
                while (true)
                {
@@ -665,8 +663,7 @@
                        break;
                    }
                }
            })
            { IsBackground = true }.Start();
            });
        }
        /// <summary>
@@ -691,7 +688,7 @@
        private void StartUpdateTimeOutThread()
        {
            this.UpdateTimeOutCount = 60;
            new System.Threading.Thread(() =>
            HdlThreadLogic.Current.RunThread(() =>
            {
                while (true)
                {
@@ -719,8 +716,7 @@
                        break;
                    }
                }
            })
            { IsBackground = true }.Start();
            });
        }
        /// <summary>