| | |
| | | /// <summary>
|
| | | /// 网关列表的备份界面
|
| | | /// </summary>
|
| | | public class HdlGatewayListBackUpForm : UserCenterCommonForm
|
| | | public class HdlGatewayListBackUpForm : EditorCommonForm
|
| | | {
|
| | | #region ■ 变量声明___________________________ |
| | | |
| | |
| | | /// <summary> |
| | | /// 生成的网关状态控件暂时存入内存中 |
| | | /// </summary> |
| | | private Dictionary<string, GatewayViewRow> dicRowContr = new Dictionary<string, GatewayViewRow>();
|
| | | private Dictionary<string, GatewayRowControl> dicRowContr = new Dictionary<string, GatewayRowControl>();
|
| | |
|
| | | #endregion |
| | |
|
| | |
| | | /// </summary> |
| | | private void InitMiddleFrame() |
| | | { |
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame();
|
| | |
|
| | | listview = new VerticalScrolViewLayout();
|
| | | listview.Height = bodyFrameLayout.Height;
|
| | | bodyFrameLayout.AddChidren(listview);
|
| | |
| | | |
| | | 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();
|
| | | //开启网关在线监测的线程
|
| | |
| | | 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) => |
| | | gatewayRow.frameTable.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //如果点击的是不在线的网关,则当什么事都没有发生
|
| | | if (gatewayRow.IsOnline == false) |
| | | { |
| | | //指定的网关不在线 |
| | | this.ShowNormalMsg(Language.StringByID(R.MyInternationalizationString.uTheGatewayIsNotOnline)); |
| | | 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)
|
| | | 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); |
| | | form2.AddForm(realWay);
|
| | | }; |
| | | }
|
| | |
|
| | |
| | | {
|
| | | 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);
|
| | | }
|
| | | //网关新版本检测
|
| | |
| | | {
|
| | | 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);
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | {
|
| | | 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)
|