| | |
| | | /// <summary>
|
| | | /// 设备的历史版本
|
| | | /// </summary>
|
| | | public class DeviceHistoryFirmwareVersionForm : UserCenterCommonForm
|
| | | public class DeviceHistoryFirmwareVersionForm : EditorCommonForm
|
| | | {
|
| | | /// <summary> |
| | | /// 升级的设备 |
| | | /// </summary> |
| | | /// <summary>
|
| | | /// 升级的设备
|
| | | /// </summary>
|
| | | private List<CommonDevice> listUpdateDevice = null;
|
| | | /// <summary>
|
| | | /// 列表控件
|
| | | /// </summary>
|
| | | private VerticalScrolViewLayout listView = null;
|
| | | private VerticalListControl listView = null;
|
| | | /// <summary>
|
| | | /// 界面关闭的Action
|
| | | /// 固件选择的事件
|
| | | /// </summary>
|
| | | public Action<FirmwareVersionInfo> FormCloseAction = null;
|
| | | public Action<FirmwareVersionInfo> SelectFirmwareInfoEvent = null;
|
| | |
|
| | | /// <summary>
|
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
| | | /// </summary>
|
| | | /// <param name="i_listdevice">设备</param> |
| | | public void ShowForm(List<CommonDevice> i_listdevice) |
| | | { |
| | | this.listUpdateDevice = i_listdevice; |
| | | |
| | | //设置标题信息 |
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uHistoryVersion)); |
| | | |
| | | //初始化中部控件 |
| | | this.InitMiddleFrame(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化中部控件 |
| | | /// </summary> |
| | | private void InitMiddleFrame() |
| | | /// <param name="deviceMac">设备Mac地址</param>
|
| | | public void ShowForm(string deviceMac)
|
| | | {
|
| | | listView = new VerticalScrolViewLayout();
|
| | | this.listUpdateDevice = HdlDeviceCommonLogic.Current.GetDevicesByMac(deviceMac);
|
| | |
|
| | | //设置标题信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uHistoryVersion));
|
| | |
|
| | | //初始化中部控件
|
| | | this.InitMiddleFrame();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化中部控件
|
| | | /// </summary>
|
| | | private void InitMiddleFrame()
|
| | | {
|
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame();
|
| | |
|
| | | listView = new VerticalListControl(12);
|
| | | listView.Height = bodyFrameLayout.Height;
|
| | | listView.BackgroundColor = UserCenterColor.Current.White;
|
| | | bodyFrameLayout.AddChidren(listView);
|
| | |
|
| | | //拥有200端口这个东西的时候,才会显示 |
| | | var oTADevice = Common.LocalDevice.Current.GetOTADevice(listUpdateDevice[0].DeviceAddr); |
| | | //拥有200端口这个东西的时候,才会显示
|
| | | var oTADevice = HdlDeviceCommonLogic.Current.GetOTADevice(listUpdateDevice[0].DeviceAddr);
|
| | | if (oTADevice == null || oTADevice.ImgVersion == -1)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | //获取历史版本
|
| | | var listData = FirmwareUpdateLogic.GetFirmwareVersionListInfo(FirmwareLevelType.ZigbeeDevice,
|
| | | var listData = HdlFirmwareUpdateLogic.Current.GetFirmwareVersionListInfo(FirmwareLevelType.A设备,
|
| | | oTADevice.HwVersion.ToString(),
|
| | | oTADevice.ImgTypeId.ToString());
|
| | |
|
| | | var btnTemp = new ButtonCommon();
|
| | | Common.LocalDevice.Current.SetDeviceBeloneIconToControl(btnTemp, listUpdateDevice);
|
| | | string unSelectPic = string.Empty;
|
| | | string selectPic = string.Empty;
|
| | | HdlDeviceCommonLogic.Current.GetDeviceObjectIcon(listUpdateDevice, ref unSelectPic, ref selectPic);
|
| | |
|
| | | new System.Threading.Thread(() =>
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | string ImagType = oTADevice.ImgTypeId.ToString();
|
| | | foreach (var data in listData)
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (data.ImagType == ImagType && oTADevice.ImgVersion == data.FirmwareVersion)
|
| | | foreach (var data in listData)
|
| | | {
|
| | | //同一个东西,不显示出来
|
| | | continue;
|
| | | if (data.ImagType == ImagType && oTADevice.ImgVersion == data.FirmwareVersion)
|
| | | {
|
| | | //同一个东西,不显示出来
|
| | | continue;
|
| | | }
|
| | | this.AddRowlayout(data, unSelectPic, selectPic);
|
| | | }
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | this.AddRowlayout(data, btnTemp.UnSelectedImagePath, btnTemp.SelectedImagePath);
|
| | | });
|
| | | }
|
| | | })
|
| | | { IsBackground = true }.Start();
|
| | | });
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | /// <param name="info"></param>
|
| | | /// <param name="unSelPath"></param>
|
| | | /// <param name="selPath"></param>
|
| | | private void AddRowlayout(FirmwareVersionInfo info, string unSelPath,string selPath)
|
| | | private void AddRowlayout(FirmwareVersionInfo info, string unSelPath, string selPath)
|
| | | {
|
| | | var rowlayout = new StatuRowLayout(listView);
|
| | |
|
| | | var rowlayout = new FrameRowControl(listView.rowSpace / 2);
|
| | | listView.AddChidren(rowlayout);
|
| | | //图标
|
| | | var btnIcon = new RowLeftIconView();
|
| | | var btnIcon = rowlayout.AddLeftIcon();
|
| | | btnIcon.UnSelectedImagePath = unSelPath;
|
| | | btnIcon.SelectedImagePath = selPath;
|
| | | rowlayout.AddChidren(btnIcon);
|
| | |
|
| | | //指定的设备
|
| | | var btnDevice = new RowTopBlackView();
|
| | | btnDevice.BackgroundColor = UserCenterColor.Current.Transparent;
|
| | | btnDevice.Text = info.ShowName;
|
| | | rowlayout.AddChidren(btnDevice);
|
| | |
|
| | | //固件信息
|
| | | var btnVersion = new RowBottomBlackView();
|
| | | btnVersion.Text = Common.LocalDevice.Current.AppendVersion(info.FirmwareVersion);
|
| | | rowlayout.AddChidren(btnVersion);
|
| | |
|
| | | rowlayout.AddTopView(info.ShowName, 800);
|
| | | //向右的图标
|
| | | rowlayout.AddRightIconControl();
|
| | | rowlayout.AddRightArrow();
|
| | | //固件信息
|
| | | string firmwareText = HdlDeviceCommonLogic.Current.AppendVersion(info.FirmwareVersion);
|
| | | firmwareText += " " + HdlCommonLogic.Current.ConvertUtcTimeToLocalTime(info.CreatedOnUtc).ToString("yyyy/MM/dd HH:mm:ss");
|
| | | rowlayout.AddBottomView(firmwareText, 800);
|
| | | //底线
|
| | | rowlayout.AddBottomLine();
|
| | |
|
| | | rowlayout.MouseUpEvent += (sender, e) =>
|
| | | rowlayout.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(this.listUpdateDevice[0]);
|
| | | if (FirmwareUpdateResourse.dicDeviceUpdateList.ContainsKey(mainKeys) == true)
|
| | | string mainKeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(this.listUpdateDevice[0]);
|
| | | if (HdlFirmwareUpdateResourse.dicUpdateList.ContainsKey(mainKeys) == true)
|
| | | {
|
| | | this.CloseForm();
|
| | | return;
|
| | | }
|
| | | if (FormCloseAction != null)
|
| | | {
|
| | | FormCloseAction(info);
|
| | | }
|
| | | SelectFirmwareInfoEvent?.Invoke(info);
|
| | | SelectFirmwareInfoEvent = null;
|
| | | this.CloseForm();
|
| | | };
|
| | | }
|