old mode 100644
new mode 100755
| | |
| | | /// <param name="common">Common.</param> |
| | | /// <param name="typeTag">Type tag.</param> |
| | | public void DeviceInfoChange(CommonDevice common, string typeTag) |
| | | { |
| | | {
|
| | | //设备上报状态中 当CluterID=3,就证明该设备在线,直接标记 |
| | | if (typeTag == "DeviceStatusReport") |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | try |
| | | { |
| | | for (int i = 0; deviceVerticalScrolViewLayout != null && i < deviceVerticalScrolViewLayout.ChildrenCount; i++) |
| | | { |
| | | var rowFL = deviceVerticalScrolViewLayout.GetChildren(i) as FrameLayout; |
| | | var rowLayout = rowFL.GetChildren(0) as RowLayout; |
| | | var deviceUI = rowLayout.Tag as DeviceUI; |
| | | if (deviceUI.CommonDevice == null || rowLayout.ChildrenCount == 0) |
| | | { |
| | | //设备为空或者控件为空 |
| | | continue; |
| | | } |
| | | |
| | | if (common.DeviceAddr != deviceUI.CommonDevice.DeviceAddr || common.DeviceEpoint != deviceUI.CommonDevice.DeviceEpoint) |
| | | { |
| | | //判断是否为当前设备 |
| | | continue; |
| | | } |
| | | var frameLayout = rowLayout.GetChildren(0) as FrameLayout; |
| | | switch (deviceUI.CommonDevice.Type) |
| | | { |
| | | case DeviceType.OnOffOutput: |
| | | //开关功能 |
| | | if ((common as ZigBee.Device.ToggleLight).DeviceStatusReport.CluterID == 6) |
| | | { |
| | | var onOffOutputLight = deviceUI.CommonDevice as ZigBee.Device.ToggleLight; |
| | | onOffOutputLight.DeviceStatusReport = (common as ZigBee.Device.ToggleLight).DeviceStatusReport; |
| | | for (int j = 0; j < frameLayout.ChildrenCount; j++) |
| | | { |
| | | var tempView = frameLayout.GetChildren(j); |
| | | if (tempView.Tag == null) |
| | | { |
| | | continue; |
| | | } |
| | | if (tempView.Tag.ToString() == deviceStatus_OnOffStatus) |
| | | { |
| | | if (typeTag == "DeviceStatusReport")
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | try
|
| | | {
|
| | | for (int i = 0; deviceVerticalScrolViewLayout != null && i < deviceVerticalScrolViewLayout.ChildrenCount; i++)
|
| | | {
|
| | | var rowFL = deviceVerticalScrolViewLayout.GetChildren(i) as FrameLayout;
|
| | | var rowLayout = rowFL.GetChildren(0) as RowLayout;
|
| | | var deviceUI = rowLayout.Tag as DeviceUI;
|
| | | if (deviceUI.CommonDevice == null || rowLayout.ChildrenCount == 0)
|
| | | {
|
| | | //设备为空或者控件为空
|
| | | continue;
|
| | | }
|
| | |
|
| | | if (common.DeviceAddr != deviceUI.CommonDevice.DeviceAddr || common.DeviceEpoint != deviceUI.CommonDevice.DeviceEpoint)
|
| | | {
|
| | | //判断是否为当前设备
|
| | | continue;
|
| | | }
|
| | | var frameLayout = rowLayout.GetChildren(0) as FrameLayout;
|
| | | switch (deviceUI.CommonDevice.Type)
|
| | | {
|
| | | case DeviceType.OnOffOutput:
|
| | | //开关功能
|
| | | if ((common as ZigBee.Device.ToggleLight).DeviceStatusReport.CluterID == 6)
|
| | | {
|
| | | var onOffOutputLight = deviceUI.CommonDevice as ZigBee.Device.ToggleLight;
|
| | | onOffOutputLight.DeviceStatusReport = (common as ZigBee.Device.ToggleLight).DeviceStatusReport;
|
| | | for (int j = 0; j < frameLayout.ChildrenCount; j++)
|
| | | {
|
| | | var tempView = frameLayout.GetChildren(j);
|
| | | if (tempView.Tag == null)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | if (tempView.Tag.ToString() == deviceStatus_OnOffStatus)
|
| | | {
|
| | | //记录、更新状态 |
| | | if (onOffOutputLight.DeviceStatusReport.AttriBute == null || onOffOutputLight.DeviceStatusReport.AttriBute.Count == 0) |
| | | { |
| | | continue; |
| | | } |
| | | onOffOutputLight.OnOffStatus = onOffOutputLight.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | (tempView as Button).IsSelected = onOffOutputLight.OnOffStatus == 1; |
| | | (tempView as Button).IsSelected = onOffOutputLight.OnOffStatus == 1;
|
| | | //记录回复时间 |
| | | onOffOutputLight.LastDateTime = DateTime.Now; |
| | | } |
| | | } |
| | | }
|
| | | }
|
| | | } |
| | | //当CluterID=3,就证明该设备在线,直接标记 |
| | | if ((common as ZigBee.Device.ToggleLight).DeviceStatusReport.CluterID == 3) |
| | |
| | | } |
| | | |
| | | } |
| | | break; |
| | | break;
|
| | | |
| | | case DeviceType.AirSwitch: |
| | | //开关功能 |
| | | if ((common as ZigBee.Device.AirSwitch).DeviceStatusReport.CluterID == 6) |
| | | { |
| | | var airSwitch = deviceUI.CommonDevice as ZigBee.Device.AirSwitch; |
| | | airSwitch.DeviceStatusReport = (common as ZigBee.Device.AirSwitch).DeviceStatusReport; |
| | | for (int j = 0; j < frameLayout.ChildrenCount; j++) |
| | | { |
| | | var tempView = frameLayout.GetChildren(j); |
| | | if (tempView.Tag == null) |
| | | { |
| | | continue; |
| | | } |
| | | if (tempView.Tag.ToString() == deviceStatus_OnOffStatus) |
| | | { |
| | | case DeviceType.AirSwitch:
|
| | | //开关功能
|
| | | if ((common as ZigBee.Device.AirSwitch).DeviceStatusReport.CluterID == 6)
|
| | | {
|
| | | var airSwitch = deviceUI.CommonDevice as ZigBee.Device.AirSwitch;
|
| | | airSwitch.DeviceStatusReport = (common as ZigBee.Device.AirSwitch).DeviceStatusReport;
|
| | | for (int j = 0; j < frameLayout.ChildrenCount; j++)
|
| | | {
|
| | | var tempView = frameLayout.GetChildren(j);
|
| | | if (tempView.Tag == null)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | if (tempView.Tag.ToString() == deviceStatus_OnOffStatus)
|
| | | {
|
| | | //记录、更新状态 |
| | | if (airSwitch.DeviceStatusReport.AttriBute == null || airSwitch.DeviceStatusReport.AttriBute.Count == 0) |
| | | { |
| | | return; |
| | | } |
| | | airSwitch.OnOffStatus = airSwitch.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | (tempView as Button).IsSelected = airSwitch.OnOffStatus == 1; |
| | | (tempView as Button).IsSelected = airSwitch.OnOffStatus == 1;
|
| | | //记录回复时间 |
| | | airSwitch.LastDateTime = DateTime.Now; |
| | | } |
| | | } |
| | | }
|
| | | }
|
| | | } |
| | | //当CluterID=3,就证明该设备在线,直接标记 |
| | | if ((common as ZigBee.Device.AirSwitch).DeviceStatusReport.CluterID == 3) |
| | |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | break;
|
| | | |
| | | case DeviceType.WindowCoveringDevice: |
| | | case DeviceType.WindowCoveringDevice:
|
| | | if ((common as ZigBee.Device.Rollershade).DeviceStatusReport.CluterID == 3) |
| | | { |
| | | var rollershade = deviceUI.CommonDevice as ZigBee.Device.Rollershade; |
| | | var rollershade = deviceUI.CommonDevice as ZigBee.Device.Rollershade;
|
| | | rollershade.IsOnline = 1; |
| | | for (int j = 0; j < frameLayout.ChildrenCount; j++) |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | break;
|
| | | |
| | | case DeviceType.Thermostat: |
| | | //AC功能 |
| | |
| | | } |
| | | break; |
| | | |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | System.Console.WriteLine($"Error:{ex.Message}"); |
| | | } |
| | | }); |
| | | } |
| | | }
|
| | | }
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | System.Console.WriteLine($"Error:{ex.Message}");
|
| | | }
|
| | | });
|
| | | }
|
| | | //设备在线状态上报 |
| | | else if (typeTag == "OnlineStatusChange") |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | try |
| | | { |
| | | for (int i = 0; deviceVerticalScrolViewLayout != null && i < deviceVerticalScrolViewLayout.ChildrenCount; i++) |
| | | { |
| | | var rowFL = deviceVerticalScrolViewLayout.GetChildren(i) as FrameLayout; |
| | | var rowLayout = rowFL.GetChildren(0) as RowLayout; |
| | | var deviceUI = rowLayout.Tag as DeviceUI; |
| | | if (deviceUI.CommonDevice == null || rowLayout.ChildrenCount == 0) |
| | | { |
| | | //设备为空或者控件为空 |
| | | continue; |
| | | } |
| | | if (common.DeviceAddr != deviceUI.CommonDevice.DeviceAddr || common.DeviceEpoint != deviceUI.CommonDevice.DeviceEpoint) |
| | | { |
| | | //判断是否为当前设备 |
| | | continue; |
| | | } |
| | | var frameLayout = rowLayout.GetChildren(0) as FrameLayout; |
| | | switch (deviceUI.CommonDevice.Type) |
| | | { |
| | | case DeviceType.OnOffOutput: |
| | | var onOffOutputLight = deviceUI.CommonDevice as ToggleLight; |
| | | onOffOutputLight.IsOnline = (common as ToggleLight).IsOnline; |
| | | for (int j = 0; j < frameLayout.ChildrenCount; j++) |
| | | { |
| | | var tempView = frameLayout.GetChildren(j); |
| | | if (tempView.Tag == null) |
| | | { |
| | | continue; |
| | | } |
| | | if (tempView.Tag.ToString() == deviceStatus_Online) |
| | | { |
| | | (tempView as Button).IsSelected = onOffOutputLight.IsOnline == 1; |
| | | } |
| | | } |
| | | //记录回复时间 |
| | | onOffOutputLight.LastDateTime = DateTime.Now; |
| | | break; |
| | | case DeviceType.AirSwitch: |
| | | var airSwitch = deviceUI.CommonDevice as AirSwitch; |
| | | airSwitch.IsOnline = (common as AirSwitch).IsOnline; |
| | | for (int j = 0; j < frameLayout.ChildrenCount; j++) |
| | | { |
| | | var tempView = frameLayout.GetChildren(j); |
| | | if (tempView.Tag == null) |
| | | { |
| | | continue; |
| | | } |
| | | if (tempView.Tag.ToString() == deviceStatus_Online) |
| | | { |
| | | (tempView as Button).IsSelected = airSwitch.IsOnline == 1; |
| | | } |
| | | } |
| | | //记录回复时间 |
| | | airSwitch.LastDateTime = DateTime.Now; |
| | | break; |
| | | case DeviceType.WindowCoveringDevice: |
| | | var rollershade = deviceUI.CommonDevice as ZigBee.Device.Rollershade; |
| | | rollershade.IsOnline = (common as Rollershade).IsOnline; |
| | | for (int j = 0; j < frameLayout.ChildrenCount; j++) |
| | | { |
| | | var tempView = frameLayout.GetChildren(j); |
| | | if (tempView.Tag == null) |
| | | { |
| | | continue; |
| | | } |
| | | if (tempView.Tag.ToString() == deviceStatus_Online) |
| | | { |
| | | (tempView as Button).IsSelected = rollershade.IsOnline == 1; |
| | | } |
| | | } |
| | | //记录回复时间 |
| | | rollershade.LastDateTime = DateTime.Now; |
| | | break; |
| | | else if (typeTag == "OnlineStatusChange")
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | try
|
| | | {
|
| | | for (int i = 0; deviceVerticalScrolViewLayout != null && i < deviceVerticalScrolViewLayout.ChildrenCount; i++)
|
| | | {
|
| | | var rowFL = deviceVerticalScrolViewLayout.GetChildren(i) as FrameLayout;
|
| | | var rowLayout = rowFL.GetChildren(0) as RowLayout;
|
| | | var deviceUI = rowLayout.Tag as DeviceUI;
|
| | | if (deviceUI.CommonDevice == null || rowLayout.ChildrenCount == 0)
|
| | | {
|
| | | //设备为空或者控件为空
|
| | | continue;
|
| | | }
|
| | | if (common.DeviceAddr != deviceUI.CommonDevice.DeviceAddr || common.DeviceEpoint != deviceUI.CommonDevice.DeviceEpoint)
|
| | | {
|
| | | //判断是否为当前设备
|
| | | continue;
|
| | | }
|
| | | var frameLayout = rowLayout.GetChildren(0) as FrameLayout;
|
| | | switch (deviceUI.CommonDevice.Type)
|
| | | {
|
| | | case DeviceType.OnOffOutput:
|
| | | var onOffOutputLight = deviceUI.CommonDevice as ToggleLight;
|
| | | onOffOutputLight.IsOnline = (common as ToggleLight).IsOnline;
|
| | | for (int j = 0; j < frameLayout.ChildrenCount; j++)
|
| | | {
|
| | | var tempView = frameLayout.GetChildren(j);
|
| | | if (tempView.Tag == null)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | if (tempView.Tag.ToString() == deviceStatus_Online)
|
| | | {
|
| | | (tempView as Button).IsSelected = onOffOutputLight.IsOnline == 1;
|
| | | }
|
| | | }
|
| | | //记录回复时间
|
| | | onOffOutputLight.LastDateTime = DateTime.Now;
|
| | | break;
|
| | | case DeviceType.AirSwitch:
|
| | | var airSwitch = deviceUI.CommonDevice as AirSwitch;
|
| | | airSwitch.IsOnline = (common as AirSwitch).IsOnline;
|
| | | for (int j = 0; j < frameLayout.ChildrenCount; j++)
|
| | | {
|
| | | var tempView = frameLayout.GetChildren(j);
|
| | | if (tempView.Tag == null)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | if (tempView.Tag.ToString() == deviceStatus_Online)
|
| | | {
|
| | | (tempView as Button).IsSelected = airSwitch.IsOnline == 1;
|
| | | }
|
| | | }
|
| | | //记录回复时间
|
| | | airSwitch.LastDateTime = DateTime.Now;
|
| | | break;
|
| | | case DeviceType.WindowCoveringDevice:
|
| | | var rollershade = deviceUI.CommonDevice as ZigBee.Device.Rollershade;
|
| | | rollershade.IsOnline = (common as Rollershade).IsOnline;
|
| | | for (int j = 0; j < frameLayout.ChildrenCount; j++)
|
| | | {
|
| | | var tempView = frameLayout.GetChildren(j);
|
| | | if (tempView.Tag == null)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | if (tempView.Tag.ToString() == deviceStatus_Online)
|
| | | {
|
| | | (tempView as Button).IsSelected = rollershade.IsOnline == 1;
|
| | | }
|
| | | }
|
| | | //记录回复时间
|
| | | rollershade.LastDateTime = DateTime.Now;
|
| | | break;
|
| | | case DeviceType.Thermostat: |
| | | var ac = deviceUI.CommonDevice as ZigBee.Device.AC; |
| | | ac.IsOnline = (common as ZigBee.Device.AC).IsOnline; |
| | |
| | | //记录回复时间 |
| | | dimmableLight.LastDateTime = DateTime.Now; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | System.Console.WriteLine($"主页功能刷新-Error:{ex.Message}"); |
| | | } |
| | | }); |
| | | }
|
| | | }
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | System.Console.WriteLine($"主页功能刷新-Error:{ex.Message}");
|
| | | }
|
| | | });
|
| | | } |
| | | } |
| | | /// <summary> |
| | |
| | | /// <returns><c>true</c>, if bind gateway was haded, <c>false</c> otherwise.</returns> |
| | | private bool HadBindGateway() |
| | | { |
| | | var gatewayList = Common.LocalGateway.Current.GetAllLocalGateway(); |
| | | var gatewayList = UserCenter.HdlGatewayLogic.Current.GetAllLocalGateway(); |
| | | if (gatewayList.Count == 0) |
| | | { |
| | | return false; |
| | |
| | | /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param> |
| | | private void GoToAddGateWay(object sender, MouseEventArgs mouseEventArgs) |
| | | { |
| | | UserCenter.Gateway.SelectNewGateWayForm selectNewGateWayForm = new UserCenter.Gateway.SelectNewGateWayForm { }; |
| | | selectNewGateWayForm.AddForm(selectNewGateWayForm); |
| | | var selectNewGateWayForm = new UserCenter.GatewayAdd.NewGateWaySelectForm(); |
| | | selectNewGateWayForm.AddForm(); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | //开关灯 |
| | | var light = device.CommonDevice as ToggleLight; |
| | | //补上非远程 |
| | | if (light.Gateway == null) |
| | | { |
| | | continue; |
| | | if (light.Gateway == null)
|
| | | {
|
| | | continue;
|
| | | } |
| | | if (light.Gateway.IsVirtual) |
| | | { |
| | |
| | | private void ChangeResidence(House home) |
| | | { |
| | | try |
| | | { |
| | | {
|
| | | CommonPage.Loading.Start(); |
| | | new System.Threading.Thread(async () => |
| | | new System.Threading.Thread(async () =>
|
| | | { |
| | | Config.Instance.HomeId = home.Id; |
| | | Global.CreateHomeDirectory(home.Id); |
| | | Config.Instance.Save(); |
| | | //刷新个人中心的内存及线程 |
| | | Config.Instance.Save();
|
| | | //刷新个人中心的内存及线程
|
| | | await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread(); |
| | | |
| | | Room.InitAllRoom(); |
| | | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | {
|
| | | Show(); |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | {
|
| | | Application.RunOnMainThread(() => |
| | | { |
| | | {
|
| | | CommonPage.Loading.Hide(); |
| | | new Alert(Language.StringByID(R.MyInternationalizationString.Tip), Language.StringByID(R.MyInternationalizationString.CheckInternet), Language.StringByID(R.MyInternationalizationString.Close)).Show(); |
| | | Console.WriteLine(ex.Message); |
| | | //new Alert(Language.StringByID(R.MyInternationalizationString.Tip), Language.StringByID(R.MyInternationalizationString.CheckInternet), Language.StringByID(R.MyInternationalizationString.Close)).Show();
|
| | | Console.WriteLine(ex.Message);
|
| | | }); |
| | | } |
| | | } |