From 404cdc88627f942df7944af04ee05b9d527752d6 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 30 九月 2019 13:22:40 +0800
Subject: [PATCH] 合并了徐梅的按键面板绑定
---
ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFirmwareInfoForm.cs | 394 +++++++++++++++++++++++++++++++++++--------------------
1 files changed, 250 insertions(+), 144 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFirmwareInfoForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFirmwareInfoForm.cs
index 4726719..dd3e8ed 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFirmwareInfoForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFirmwareInfoForm.cs
@@ -8,22 +8,18 @@
/// <summary>
/// 璁惧鍥轰欢淇℃伅鐣岄潰
/// </summary>
- public class DeviceFirmwareInfoForm : UserCenterCommonForm
+ public class DeviceFirmwareInfoForm : EditorCommonForm
{
#region 鈻� 鍙橀噺澹版槑___________________________
- /// <summary>
- /// 鍒楄〃鎺т欢
- /// </summary>
- private VerticalScrolViewLayout listView = null;
/// <summary>
- /// 璁惧瀵硅薄
+ /// 璁惧mac鍦板潃
/// </summary>
- private List<CommonDevice> listNewDevice = null;
+ private string deviceMac = null;
/// <summary>
- /// OTADevice
+ /// 鍥轰欢淇℃伅
/// </summary>
- private OTADevice oTADevice = null;
+ private FirmwareVersionInfo deviceFirmware = null;
#endregion
@@ -32,28 +28,24 @@
/// <summary>
/// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
/// </summary>
- /// <param name="listdevices">璁惧鍒楄〃</param>
- public void ShowForm(List<CommonDevice> listdevices)
+ /// <param name="i_deviceMac">璁惧mac鍦板潃</param>
+ public void ShowForm(string i_deviceMac)
{
- if (listNewDevice != null && listNewDevice[0].DeviceAddr != listdevices[0].DeviceAddr)
+ if (deviceMac != null && deviceMac != i_deviceMac)
{
//涓嶆槸鍚屼竴涓笢瑗�
return;
}
- this.listNewDevice = listdevices;
+ this.deviceMac = i_deviceMac;
//璁剧疆鏍囬淇℃伅
- base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uFirmwareInformation));
-
- //鎷ユ湁200绔彛杩欎釜涓滆タ鐨勬椂鍊欙紝鎵嶄細鏄剧ず
- this.oTADevice = Common.LocalDevice.Current.GetOTADevice(listNewDevice[0].DeviceAddr);
- if (oTADevice == null || oTADevice.ImgVersion == -1)
- {
- return;
- }
+ base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uFirmwareUpdate));
//鍒濆鍖栦腑閮ㄦ帶浠�
this.InitMiddleFrame();
+
+ //鍘嗗彶鐗堟湰
+ this.InitTopRightMenu();
}
/// <summary>
@@ -61,146 +53,260 @@
/// </summary>
private void InitMiddleFrame()
{
- bodyFrameLayout.RemoveAll();
+ var oTADevice = Common.LocalDevice.Current.GetOTADevice(deviceMac);
+ //鑾峰彇璁惧鏈�鏂扮増鏈�
+ this.deviceFirmware = HdlFirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.ZigbeeDevice,
+ oTADevice.HwVersion.ToString(),
+ oTADevice.ImgTypeId.ToString(),
+ oTADevice.ImgVersion);
- listView = new VerticalScrolViewLayout();
- listView.Height = bodyFrameLayout.Height;
- bodyFrameLayout.AddChidren(listView);
-
- //娣诲姞闀滃儚ID琛�
- this.AddImageIdRow();
-
- //娣诲姞鍥轰欢鐗堟湰琛�
- this.AddFirmwareVersionRow();
-
- //娣诲姞纭欢鐗堟湰琛�
- this.AddHardwareVersionRow();
-
- //鎴愬憳娌℃湁鍗囩骇鏉冮檺
- if (UserCenterResourse.UserInfo.AuthorityNo != 3)
+ if (deviceFirmware != null && deviceFirmware.FirmwareVersion > oTADevice.ImgVersion)
{
- //娣诲姞鍥轰欢鍗囩骇琛�
- this.AddFirmwareUpdateRow();
+ //鎷ユ湁鏂扮増鏈�
+ this.InitControlByNewVersion();
+ }
+ else
+ {
+ //娌℃湁鏂扮増鏈�
+ this.InitControlByNotNewVersion();
}
}
#endregion
- #region 鈻� 娣诲姞闀滃儚ID琛宊______________________
+ #region 鈻� 鍙充笂瑙掕彍鍗昣________________________
/// <summary>
- /// 娣诲姞闀滃儚ID琛�
+ /// 鍒濆鍖栧彸涓婅鑿滃崟
/// </summary>
- private void AddImageIdRow()
+ private void InitTopRightMenu()
{
- var row = new RowLayout();
- row.Height = ControlCommonResourse.ListViewRowHeight;
- listView.AddChidren(row);
-
- //璁惧闀滃儚ID
- var btnUpview = new RowCenterView(false);
- btnUpview.TextID = R.MyInternationalizationString.uDeviceImageId;
- row.AddChidren(btnUpview);
- //闀滃儚ID
- var btnVersion = new RowMostRightTextView();
- btnVersion.TextColor = UserCenterColor.Current.TextGrayColor;
- btnVersion.Text = oTADevice.ImgTypeId.ToString();
- row.AddChidren(btnVersion);
- }
-
- #endregion
-
- #region 鈻� 娣诲姞鍥轰欢鐗堟湰琛宊____________________
-
- /// <summary>
- /// 娣诲姞鍥轰欢鐗堟湰琛�
- /// </summary>
- private void AddFirmwareVersionRow()
- {
- var row = new RowLayout();
- row.Height = ControlCommonResourse.ListViewRowHeight;
- listView.AddChidren(row);
-
- //璁惧鍥轰欢鐗堟湰
- var btnUpview = new RowCenterView(false);
- btnUpview.TextID = R.MyInternationalizationString.uDeviceFirmwareVersion;
- row.AddChidren(btnUpview);
- //鐗堟湰鍙�
- var btnVersion = new RowMostRightTextView();
- btnVersion.TextColor = UserCenterColor.Current.TextGrayColor;
- btnVersion.Text = Common.LocalDevice.Current.AppendVersion(oTADevice.ImgVersion);
- row.AddChidren(btnVersion);
- }
-
- #endregion
-
- #region 鈻� 娣诲姞纭欢鐗堟湰琛宊____________________
-
- /// <summary>
- /// 娣诲姞纭欢鐗堟湰琛�
- /// </summary>
- private void AddHardwareVersionRow()
- {
- var row = new RowLayout();
- row.Height = ControlCommonResourse.ListViewRowHeight;
- listView.AddChidren(row);
-
- //璁惧纭欢鐗堟湰
- var btnUpview = new RowCenterView(false);
- btnUpview.TextID = R.MyInternationalizationString.uDeviceHardwareVersion;
- row.AddChidren(btnUpview);
- //鐗堟湰鍙�
- var btnVersion = new RowMostRightTextView();
- btnVersion.TextColor = UserCenterColor.Current.TextGrayColor;
- btnVersion.Text = Common.LocalDevice.Current.AppendVersion(oTADevice.HwVersion);
- row.AddChidren(btnVersion);
- }
-
- #endregion
-
- #region 鈻� 娣诲姞鍥轰欢鍗囩骇琛宊____________________
-
- /// <summary>
- /// 娣诲姞鍥轰欢鍗囩骇琛�
- /// </summary>
- private void AddFirmwareUpdateRow()
- {
- var statuRow = new StatuRowLayout(listView);
- //鍥轰欢鍗囩骇
- var btnUpview = new RowCenterView(false);
- btnUpview.TextID = R.MyInternationalizationString.uFirmwareUpdate;
- statuRow.AddChidren(btnUpview);
-
- //鎻愮ず鏈夋柊鐗堟湰
- var btnNewVersion = new RowNewVersionTipView();
- btnNewVersion.Visible = false;
- statuRow.AddChidren(btnNewVersion);
-
- //鑾峰彇璁惧鏈�鏂扮増鏈�
- var deviceFirmware = FirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.ZigbeeDevice,
- oTADevice.HwVersion.ToString(),
- oTADevice.ImgTypeId.ToString(),
- oTADevice.ImgVersion);
-
- if (deviceFirmware != null)
+ var btnIcon = new MostRightIconControl(69, 69);
+ btnIcon.UnSelectedImagePath = "Item/More.png";
+ topFrameLayout.AddChidren(btnIcon);
+ btnIcon.InitControl();
+ btnIcon.ButtonClickEvent += ((sender, e) =>
{
- if (deviceFirmware.FirmwareVersion > oTADevice.ImgVersion)
+ //鏄剧ず鍙充笂瑙掕彍鍗曠晫闈�
+ this.ShowTopRightMenu();
+ });
+ }
+
+ /// <summary>
+ /// 鏄剧ず鍙充笂瑙掕彍鍗曠晫闈�
+ /// </summary>
+ private void ShowTopRightMenu()
+ {
+ var frame = new TopRightMenuControl(this, 1);
+ //鍘嗗彶鐗堟湰
+ var deviceMenu = Language.StringByID(R.MyInternationalizationString.uHistoryVersion);
+ frame.AddRowMenu(deviceMenu, "", "", () =>
+ {
+ var form = new DeviceHistoryFirmwareVersionForm();
+ form.AddForm(deviceMac);
+ form.SelectFirmwareInfoEvent += (info) =>
{
- btnNewVersion.Visible = true;
- }
- else
+ this.deviceFirmware = info;
+ //鎷ユ湁鏂扮増鏈�
+ this.InitControlByNewVersion();
+ };
+ });
+ }
+
+ #endregion
+
+ #region 鈻� 鎷ユ湁鏂扮増鏈琠________________________
+
+ /// <summary>
+ /// 鎷ユ湁鏂扮増鏈�
+ /// </summary>
+ private void InitControlByNewVersion()
+ {
+ //娓呯┖bodyFrame
+ this.ClearBodyFrame();
+
+ var oTADevice = Common.LocalDevice.Current.GetOTADevice(deviceMac);
+
+ //鍗囩骇
+ var btnUpdate = new BottomClickButton();
+ btnUpdate.TextID = R.MyInternationalizationString.uLevelUp;
+ bodyFrameLayout.AddChidren(btnUpdate);
+ btnUpdate.ButtonClickEvent += (sender, e) =>
+ {
+ //鐣岄潰鍙冲垝涓嶅彲
+ UserView.HomePage.Instance.ScrollEnabled = false;
+
+ var form = new DeviceFirmwareUpdateForm();
+ form.AddForm(oTADevice, deviceFirmware);
+ //瀹屾垚鍗囩骇浜嬩欢
+ form.FinishUpdateEvent += (() =>
{
- deviceFirmware = null;
- }
+ //鍒濆鍖栦腑閮ㄦ帶浠�
+ this.InitMiddleFrame();
+ //鐣岄潰鍙冲垝鍙�
+ UserView.HomePage.Instance.ScrollEnabled = true;
+ });
+ };
+
+ var frameWhiteBack = new FrameLayout();
+ frameWhiteBack.Height = Application.GetRealHeight(286);
+ frameWhiteBack.BackgroundColor = UserCenterColor.Current.White;
+ bodyFrameLayout.AddChidren(frameWhiteBack);
+
+ //褰撳墠鍥轰欢鐗堟湰
+ var frameNow = new FrameRowControl();
+ frameNow.UseClickStatu = false;
+ frameNow.Y = Application.GetRealHeight(20);
+ frameWhiteBack.AddChidren(frameNow);
+ frameNow.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uNowFirmwareVersion), 500);
+ frameNow.AddMostRightView(Common.LocalDevice.Current.AppendVersion(oTADevice.ImgVersion), 500);
+ frameNow.AddBottomLine();
+
+ //鏈�鏂板浐浠剁増鏈�
+ var frameNew = new FrameRowControl();
+ frameNew.UseClickStatu = false;
+ frameNew.Y = frameNow.Bottom + Application.GetRealHeight(12);
+ frameWhiteBack.AddChidren(frameNew);
+ frameNew.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uNewFirmwareVersion), 500);
+ frameNew.AddMostRightView(Common.LocalDevice.Current.AppendVersion(deviceFirmware.FirmwareVersion), 500);
+ frameNew.AddBottomLine();
+
+ //娣诲姞鍥轰欢浠嬬粛琛�
+ int maxHeight = btnUpdate.Y - ControlCommonResourse.BottomButtonAndListViewSpace - frameNew.Bottom;
+ this.AddUpdateContent(deviceFirmware, maxHeight, frameNew.Bottom);
+ }
+
+ #endregion
+
+ #region 鈻� 娌℃湁鏂扮増鏈琠________________________
+
+ /// <summary>
+ /// 娌℃湁鏂扮増鏈�
+ /// </summary>
+ private void InitControlByNotNewVersion()
+ {
+ //娓呯┖bodyFrame
+ this.ClearBodyFrame();
+
+ var oTADevice = Common.LocalDevice.Current.GetOTADevice(deviceMac);
+
+ var frameWhiteBack = new FrameLayout();
+ frameWhiteBack.Height = Application.GetRealHeight(308);
+ frameWhiteBack.BackgroundColor = UserCenterColor.Current.White;
+ bodyFrameLayout.AddChidren(frameWhiteBack);
+
+ //褰撳墠鍥轰欢鐗堟湰
+ var frameNow = new FrameRowControl();
+ frameNow.UseClickStatu = false;
+ frameNow.Y = Application.GetRealHeight(20);
+ frameWhiteBack.AddChidren(frameNow);
+ frameNow.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uNowFirmwareVersion), 500);
+ frameNow.AddMostRightView(Common.LocalDevice.Current.AppendVersion(oTADevice.ImgVersion), 500);
+ frameNow.AddBottomLine();
+
+ //鏈�鏂板浐浠剁増鏈�
+ var frameNew = new FrameRowControl();
+ frameNew.UseClickStatu = false;
+ frameNew.Y = frameNow.Bottom + Application.GetRealHeight(12);
+ frameWhiteBack.AddChidren(frameNew);
+ frameNew.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uNewFirmwareVersion), 500);
+ frameNew.AddMostRightView(Language.StringByID(R.MyInternationalizationString.uNothing), 500);
+ }
+
+ #endregion
+
+ #region 鈻� 娣诲姞鍥轰欢浠嬬粛琛宊____________________
+
+ /// <summary>
+ /// 娣诲姞鍥轰欢浠嬬粛琛�
+ /// </summary>
+ /// <param name="versionInfo">鍥轰欢瀵硅薄</param>
+ /// <param name="Maxheight">鏈�澶ч珮搴�</param>
+ /// <param name="YY"></param>
+ private void AddUpdateContent(FirmwareVersionInfo versionInfo, int Maxheight,int YY)
+ {
+ FrameListControl listFrame = null;
+ VerticalListControl listView = null;
+
+ var realHeight = Application.GetRealHeight(40 + 12) * versionInfo.UpdateContent.Count;
+ realHeight += Application.GetRealHeight(17 + 12 + 49 + 8 + 63);
+
+ //琛岄棿璺�
+ int rowSpace = 0;
+ if (realHeight > Maxheight)
+ {
+ realHeight = Maxheight;
+ listView = new VerticalListControl(12);
+ listView.Height = realHeight;
+ listView.Y = YY;
+ listView.BackgroundColor = UserCenterColor.Current.White;
+ bodyFrameLayout.AddChidren(listView);
+ rowSpace = listView.rowSpace / 2;
+ }
+ else
+ {
+ listFrame = new FrameListControl(12);
+ listFrame.Height = realHeight;
+ listFrame.Y = YY;
+ listFrame.BackgroundColor = UserCenterColor.Current.White;
+ bodyFrameLayout.AddChidren(listFrame);
+ rowSpace = listFrame.rowSpace / 2;
}
- //鐗堟湰鍚戝彸鐨勫浘鏍�
- statuRow.AddRightIconControl();
- statuRow.MouseUpEvent += (sender, e) =>
+ //娣诲姞澶撮儴绌虹櫧闂撮殭
+ var frameSpace1 = new FrameLayout();
+ frameSpace1.Height = Application.GetRealHeight(17);
+ listView?.AddChidren(frameSpace1);
+ listFrame?.AddChidren(frameSpace1);
+
+ //淇敼鍐呭
+ var btnContentRow = new FrameRowControl(rowSpace);
+ btnContentRow.UseClickStatu = false;
+ btnContentRow.Height = Application.GetRealHeight(49);
+ listView?.AddChidren(btnContentRow);
+ listFrame?.AddChidren(btnContentRow);
+ var btnContent = btnContentRow.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uEditorContent), 500);
+ btnContent.TextSize = 12;
+
+ //绋嶅井鍐嶆坊鍔犵┖鐧介棿闅�
+ var frameSpace2 = new FrameLayout();
+ frameSpace2.Height = Application.GetRealHeight(8);
+ listView?.AddChidren(frameSpace2);
+ listFrame?.AddChidren(frameSpace2);
+
+ foreach (var msg in versionInfo.UpdateContent)
{
- var form = new DeviceFirmwareUpdateForm();
- this.AddForm(form, listNewDevice, deviceFirmware, oTADevice.ImgVersion);
- };
+ var btnRow = new FrameRowControl(rowSpace);
+ btnRow.UseClickStatu = false;
+ btnRow.Height = Application.GetRealHeight(40);
+ listView?.AddChidren(btnRow);
+ listFrame?.AddChidren(btnRow);
+
+ var btnMsg = btnRow.AddLeftCaption(msg, 965);
+ btnMsg.TextSize = 10;
+ btnMsg.TextColor = UserCenterColor.Current.TextGrayColor3;
+ }
+
+ //娣诲姞搴曢儴绌虹櫧闂撮殭
+ var frameSpace3 = new FrameLayout();
+ frameSpace3.Height = Application.GetRealHeight(63);
+ listView?.AddChidren(frameSpace3);
+ listFrame?.AddChidren(frameSpace3);
+ }
+
+ #endregion
+
+ #region 鈻� 鐣岄潰鍏抽棴___________________________
+
+ /// <summary>
+ /// 鐣岄潰鍏抽棴
+ /// </summary>
+ public override void CloseForm()
+ {
+ //鐣岄潰鍙冲垝鍙�
+ UserView.HomePage.Instance.ScrollEnabled = true;
+
+ base.CloseForm();
}
#endregion
--
Gitblit v1.8.0