| | |
| | | /// <param name="zbGateway">网关</param> |
| | | /// <param name="mode">是否显示错误</param> |
| | | public async Task<bool> AddNewGateway(ZbGateway zbGateway, ShowErrorMode mode) |
| | | { |
| | | {
|
| | | //设置网关的经纬度
|
| | | bool falge = this.SetGatewaySite(zbGateway, Common.Config.Instance.Home.Longitude, Common.Config.Instance.Home.Latitude, ShowErrorMode.NO); |
| | | if (falge == false)
|
| | | {
|
| | | return falge;
|
| | | } |
| | | //执行添加网关到内存 |
| | | var result = await this.DoAddGatewayToMemory(zbGateway, mode); |
| | | //前的网关绑定在了当前账号下的不同住宅里面
|
| | |
| | | return -1;
|
| | | }
|
| | | //设置网关的经纬度
|
| | | bool falge = this.SetGatewaySite(zbGateway, Common.Config.Instance.Home.Longitude, Common.Config.Instance.Home.Latitude); |
| | | bool falge = this.SetGatewaySite(zbGateway, Common.Config.Instance.Home.Longitude, Common.Config.Instance.Home.Latitude, ShowErrorMode.YES); |
| | | if (falge == false)
|
| | | {
|
| | | return -1;
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | //获取本地的属性 |
| | | //获取本地的属性
|
| | | objValue = localWay.getGwInfo.GetType().InvokeMember(attributeName, System.Reflection.BindingFlags.GetField, null, localWay.getGwInfo, null);
|
| | | }
|
| | |
|
| | |
| | | /// <param name="gateway">网关对象</param>
|
| | | /// <param name="Longitude">经度</param>
|
| | | /// <param name="Latitude">维度</param>
|
| | | /// <param name="mode">显示错误</param>
|
| | | /// <returns></returns>
|
| | | public bool SetGatewaySite(ZbGateway gateway, double Longitude, double Latitude)
|
| | | public bool SetGatewaySite(ZbGateway gateway, double Longitude, double Latitude, ShowErrorMode mode)
|
| | | {
|
| | | ZbGateway realWay = null;
|
| | | if (this.GetRealGateway(ref realWay, gateway) == false)
|
| | | {
|
| | | //错误:网关对象丢失
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uErrorGatewayLostMsg);
|
| | | this.ShowTipMsg(msg);
|
| | | if (mode == ShowErrorMode.YES)
|
| | | {
|
| | | //错误:网关对象丢失
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uErrorGatewayLostMsg);
|
| | | this.ShowTipMsg(msg);
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | |
| | | realWay.Actions -= action;
|
| | | if (result != 0)
|
| | | {
|
| | | //设置网关经纬度失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uSetGatewaySiteFail);
|
| | | if (result == -1)
|
| | | if (mode == ShowErrorMode.YES)
|
| | | {
|
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, null, "回复超时");
|
| | | //设置网关经纬度失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uSetGatewaySiteFail);
|
| | | if (result == -1)
|
| | | {
|
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, null, "回复超时");
|
| | | }
|
| | | this.ShowTipMsg(msg);
|
| | | }
|
| | | this.ShowTipMsg(msg);
|
| | | return false;
|
| | | }
|
| | |
|