| | |
| | | var btnGoBack = new BottomClickButton(688);
|
| | | btnGoBack.Y = Application.GetRealHeight(1495);
|
| | | btnGoBack.TextID = R.MyInternationalizationString.uGobackGatewayManage;
|
| | | if (UserCenterResourse.DicActionForm.ContainsKey("GatewayListForm") == false)
|
| | | {
|
| | | //返回主页
|
| | | btnGoBack.TextID = R.MyInternationalizationString.uGobackToHomePage;
|
| | | }
|
| | | bodyFrameLayout.AddChidren(btnGoBack);
|
| | | btnGoBack.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | |
| | | {
|
| | | if (this.Parent != null)
|
| | | {
|
| | | var form = new WiredGatewayListForm();
|
| | | var form = new GatewayManage.GatewaySearchListForm();
|
| | | this.AddFromAndRemoveNowForm(form, listZbGateway, dicZbGatewayDiv);
|
| | | }
|
| | | });
|
| | |
| | | List<string> listId = new List<string>();
|
| | | for (int i = 0; i < ZbGateway.GateWayList.Count; i++)
|
| | | {
|
| | | string strip = HdlGatewayLogic.Current.GetGatewayBaseInfoAttribute(ZbGateway.GateWayList[i], "IpAddress").ToString();
|
| | | if (strip == string.Empty)
|
| | | if (ZbGateway.GateWayList[i].getGatewayBaseInfo.IpAddress == string.Empty)
|
| | | {
|
| | | //IP没有的网关,我也不知道它是干嘛的
|
| | | continue;
|
| | |
| | | {
|
| | | continue;
|
| | | }
|
| | | //收集网关对象
|
| | | this.listZbGateway.Add(way);
|
| | |
|
| | | //网关绑定模式
|
| | | GatewayBindMode mode = GatewayBindMode.BindAgain;
|
| | |
| | | if (HdlGatewayLogic.Current.HomeIdIsEmpty(way) == true
|
| | | || way.getGatewayBaseInfo.HomeId == Common.Config.Instance.HomeId)
|
| | | {
|
| | | if (way.getGatewayBaseInfo.HomeId == Common.Config.Instance.HomeId)
|
| | | if (way.getGatewayBaseInfo.HomeId != Common.Config.Instance.HomeId)
|
| | | {
|
| | | //第一次绑定,也就是网关住宅ID为空
|
| | | mode = GatewayBindMode.First;
|
| | |
| | |
|
| | | //添加搜索到的网关到缓存(执行网关保存操作)
|
| | | ShowErrorMode showMode = this.dicIdCheckCount[listId[i]] == 0 ? ShowErrorMode.YES : ShowErrorMode.NO;
|
| | | var result = await this.DoSaveGateway(way, showMode);
|
| | | var result = await HdlGatewayLogic.Current.AddNewGateway(way, ShowErrorMode.NO);
|
| | | if (result == false)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | }
|
| | | //收集网关对象
|
| | | this.listZbGateway.Add(way);
|
| | |
|
| | | //如果它已经完全成功了的话,则将它的剩余次数置零
|
| | | this.dicIdCheckCount[listId[i]] = 0;
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 执行网关保存_______________________
|
| | |
|
| | | /// <summary>
|
| | | /// 执行网关保存
|
| | | /// </summary>
|
| | | /// <param name="zbGateway">网关对象</param>
|
| | | /// <param name="mode">是否显示错误</param>
|
| | | /// <returns></returns>
|
| | | private async Task<bool> DoSaveGateway(ZbGateway zbGateway, ShowErrorMode mode)
|
| | | {
|
| | | //添加搜索到的网关到缓存
|
| | | //1:正常 -1:异常 0:当前的网关绑定在了当前账号下的不同住宅里面
|
| | | int result = await HdlGatewayLogic.Current.AddNewGateway(zbGateway, mode);
|
| | | if (result == -1)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | //前的网关绑定在了当前账号下的不同住宅里面
|
| | | if (result == 0)
|
| | | {
|
| | | if (mode == ShowErrorMode.YES)
|
| | | {
|
| | | //网关绑定在当前账号下的其他住宅里\r\n请解除绑定后再试
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uTheGatewayInOtherResidenceMsg);
|
| | | if (msg.Contains("{0}") == true)
|
| | | {
|
| | | msg = string.Format(msg, "\r\n");
|
| | | }
|
| | | this.ShowMassage(ShowMsgType.Tip, msg);
|
| | | }
|
| | | return false;
|
| | | }
|
| | | return true;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 界面关闭___________________________
|
| | |
|
| | | /// <summary>
|
| | |
| | | way.DisConnect("Search");
|
| | | }
|
| | | }
|
| | | if (UserCenterResourse.listActionFormId.Contains("GatewayManagementForm") == false)
|
| | | if (UserCenterResourse.listActionFormId.Contains("UserMainForm") == false)
|
| | | {
|
| | | //刷新主页
|
| | | UserView.UserPage.Instance.Fresh();
|