| | |
| | | /// <summary>
|
| | | /// 网关列表的备份界面
|
| | | /// </summary>
|
| | | public class HdlGatewayListBackUpForm : UserCenterCommonForm
|
| | | public class HdlGatewayListBackUpForm : EditorCommonForm
|
| | | {
|
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 列表控件 |
| | | /// </summary> |
| | | private VerticalScrolViewLayout listview = null; |
| | | /// <summary> |
| | | /// 生成的网关状态控件暂时存入内存中 |
| | | /// </summary> |
| | | private Dictionary<string, GatewayViewRow> dicRowContr = new Dictionary<string, GatewayViewRow>();
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | #endregion |
| | | /// <summary>
|
| | | /// 列表控件
|
| | | /// </summary>
|
| | | private VerticalScrolViewLayout listview = null;
|
| | | /// <summary>
|
| | | /// 生成的网关状态控件暂时存入内存中
|
| | | /// </summary>
|
| | | private Dictionary<string, GatewayRowControl> dicRowContr = new Dictionary<string, GatewayRowControl>();
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary> |
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建) |
| | | /// </summary> |
| | | public void ShowForm() |
| | | /// <summary>
|
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
| | | /// </summary>
|
| | | public void ShowForm()
|
| | | {
|
| | | //设置标题信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uGatewayBackup)); |
| | | |
| | | //初始化中部控件 |
| | | this.InitMiddleFrame(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化中部控件 |
| | | /// </summary> |
| | | private void InitMiddleFrame() |
| | | { |
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uGatewayBackup));
|
| | |
|
| | | //初始化中部控件
|
| | | this.InitMiddleFrame();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化中部控件
|
| | | /// </summary>
|
| | | private void InitMiddleFrame()
|
| | | {
|
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame();
|
| | |
|
| | | listview = new VerticalScrolViewLayout();
|
| | | listview.Height = bodyFrameLayout.Height;
|
| | | bodyFrameLayout.AddChidren(listview);
|
| | |
|
| | | //设定中部信息
|
| | | this.SetMiddleFrameInfo(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设定中部信息 |
| | | /// </summary> |
| | | private void SetMiddleFrameInfo() |
| | | this.SetMiddleFrameInfo();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 设定中部信息
|
| | | /// </summary>
|
| | | private void SetMiddleFrameInfo()
|
| | | {
|
| | | //设置接受在线状态推送
|
| | | this.AddGatewayOnlinePush(); |
| | | |
| | | new System.Threading.Thread(() => |
| | | this.AddGatewayOnlinePush();
|
| | |
|
| | | new System.Threading.Thread(() =>
|
| | | {
|
| | | List<ZbGateway> listway = Common.LocalGateway.Current.GetAllLocalGateway();
|
| | | List<ZbGateway> listway = HdlGatewayLogic.Current.GetAllLocalGateway();
|
| | | if (listway.Count == 0)
|
| | | {
|
| | | return;
|
| | |
| | | for (int i = 0; i < listway.Count; i++)
|
| | | {
|
| | | //添加行
|
| | | this.AddRowLayout(Common.LocalGateway.Current.GetGatewayId(listway[i]));
|
| | | this.AddRowLayout(HdlGatewayLogic.Current.GetGatewayId(listway[i]));
|
| | | }
|
| | | this.CloseProgressBar();
|
| | | //开启网关在线监测的线程
|
| | | this.StartGatewayOnlieCheckThread(listway);
|
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | });
|
| | | })
|
| | | { IsBackground = true }.Start();
|
| | | }
|
| | |
|
| | | #endregion |
| | | #endregion
|
| | |
|
| | | #region ■ 添加网关行_________________________
|
| | |
|
| | | /// <summary> |
| | | /// 添加行 |
| | | /// </summary> |
| | | /// <param name="strWayId">String way.</param> |
| | | public void AddRowLayout(string strWayId) |
| | | /// <summary>
|
| | | /// 添加行
|
| | | /// </summary>
|
| | | /// <param name="strWayId">String way.</param>
|
| | | public void AddRowLayout(string strWayId)
|
| | | {
|
| | | //网关控件
|
| | | var Gateway = LocalGateway.Current.GetLocalGateway(strWayId);
|
| | | var gatewayRow = new GatewayViewRow(listview, Gateway);
|
| | | var Gateway = HdlGatewayLogic.Current.GetLocalGateway(strWayId);
|
| | | var gatewayRow = new GatewayRowControl(Gateway);
|
| | | listview.AddChidren(gatewayRow);
|
| | | //向右图标
|
| | | gatewayRow.AddRightIconControl();
|
| | | gatewayRow.frameTable.AddRightArrow();
|
| | |
|
| | | //提示有新版本
|
| | | var btnNew = new InformationTipView(gatewayRow.btnIcon);
|
| | | btnNew.Visible = false;
|
| | | gatewayRow.AddChidren(btnNew, ChidrenBindMode.BindEventOnly);
|
| | | gatewayRow.frameTable.AddChidren(btnNew, ChidrenBindMode.BindEventOnly);
|
| | | gatewayRow.AddTag("btnNew", btnNew);
|
| | |
|
| | | this.dicRowContr[strWayId] = gatewayRow; |
| | | |
| | | //单击事件 |
| | | gatewayRow.MouseUpEvent += (sender, e) => |
| | | this.dicRowContr[strWayId] = gatewayRow;
|
| | |
|
| | | //单击事件
|
| | | gatewayRow.frameTable.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //如果点击的是不在线的网关,则当什么事都没有发生
|
| | | if (gatewayRow.IsOnline == false) |
| | | { |
| | | //指定的网关不在线 |
| | | this.ShowNormalMsg(Language.StringByID(R.MyInternationalizationString.uTheGatewayIsNotOnline)); |
| | | return; |
| | | } |
| | | //如果存在新版本,并且单击他的话 |
| | | if (gatewayRow.IsOnline == false)
|
| | | {
|
| | | //指定的网关不在线
|
| | | this.ShowMassage(ShowMsgType.Normal, Language.StringByID(R.MyInternationalizationString.uTheGatewayIsNotOnline));
|
| | | return;
|
| | | }
|
| | | //如果存在新版本,并且单击他的话
|
| | | if (btnNew.Visible == true)
|
| | | {
|
| | | if (sender is InformationTipView || sender is RowLeftIconView)
|
| | | if (sender is InformationTipView || sender is IconViewControl)
|
| | | {
|
| | | //打开编辑界面
|
| | | btnNew.Visible = false;
|
| | | var form = new Gateway.GatewayInfoEditorForm();
|
| | | this.AddForm(form, Gateway);
|
| | | var form = new GatewayManage.GatewayInfoEditorForm();
|
| | | form.AddForm(Gateway);
|
| | | return;
|
| | | }
|
| | | } |
| | | ZbGateway realWay = null; |
| | | if (Common.LocalGateway.Current.GetRealGateway(ref realWay, strWayId) == false)
|
| | | }
|
| | | ZbGateway realWay = null;
|
| | | if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, strWayId) == false)
|
| | | {
|
| | | //错误:网关对象丢失
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uErrorGatewayLostMsg);
|
| | | this.ShowTip(msg);
|
| | | this.ShowMassage(ShowMsgType.Tip, msg);
|
| | | return;
|
| | | } |
| | | var form2 = new HdlGatewayBackUpForm(); |
| | | this.AddForm(form2, realWay); |
| | | }; |
| | | }
|
| | | var form2 = new HdlGatewayBackUpForm();
|
| | | form2.AddForm(realWay);
|
| | | };
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | {
|
| | | System.Threading.Thread.Sleep(300);
|
| | | //刷新网关在线状态
|
| | | Common.LocalGateway.Current.RefreshGatewayOnlineStatu(listway);
|
| | | HdlGatewayLogic.Current.RefreshGatewayOnlineStatu(listway);
|
| | | foreach (var way in listway)
|
| | | {
|
| | | if (this.Parent == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | bool online = Common.LocalGateway.Current.CheckGatewayOnlineByFlag(way);
|
| | | bool online = HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(way);
|
| | | this.GatewayOnlinePush(way, online);
|
| | | }
|
| | | //网关新版本检测
|
| | |
| | | /// <summary>
|
| | | /// 网关在线状态变更
|
| | | /// </summary>
|
| | | /// <param name="gateWay">网关对象</param> |
| | | /// <param name="gateWay">网关对象</param>
|
| | | /// <param name="online">在线状态变更后的状态</param>
|
| | | public override void GatewayOnlinePush(ZbGateway gateWay, bool online)
|
| | | {
|
| | |
| | | {
|
| | | return;
|
| | | }
|
| | | string gwid = Common.LocalGateway.Current.GetGatewayId(gateWay);
|
| | | string gwid = HdlGatewayLogic.Current.GetGatewayId(gateWay);
|
| | | if (this.dicRowContr.ContainsKey(gwid) == true)
|
| | | {
|
| | | this.dicRowContr[gwid].zbGateway = gateWay;
|
| | | this.dicRowContr[gwid].RefreshControl(online);
|
| | | this.dicRowContr[gwid].RefreshControl(gateWay);
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion |
| | | #endregion
|
| | |
|
| | | #region ■ 网关新版本检测_____________________
|
| | |
|
| | |
| | | {
|
| | | return;
|
| | | }
|
| | | if (Common.LocalGateway.Current.CheckGatewayOnlineByFlag(way) == false)
|
| | | if (HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(way) == false)
|
| | | {
|
| | | //不在线的不用理它
|
| | | continue;
|
| | | }
|
| | | //获取最新版本
|
| | | var result = await Common.LocalGateway.Current.GetGatewayAllNewVersion(way, ShowErrorMode.NO);
|
| | | var result = await HdlGatewayLogic.Current.GetGatewayAllNewVersion(way, ShowErrorMode.NO);
|
| | | if (result == null)
|
| | | {
|
| | | continue;
|
| | |
| | | if (result[0] != null || result[1] != null || result[2] != null)
|
| | | {
|
| | | //有新版本
|
| | | string gwid = Common.LocalGateway.Current.GetGatewayId(way);
|
| | | string gwid = HdlGatewayLogic.Current.GetGatewayId(way);
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | if (this.dicRowContr.ContainsKey(gwid) == true)
|