using System;
|
using HDL_ON.Entity;
|
using Shared;
|
|
namespace HDL_ON.UI
|
{
|
public partial class HomePage
|
{
|
public static void UpdataLightView(Light light)
|
{
|
Application.RunOnMainThread(() =>
|
{
|
if (bodyView != null)
|
{
|
foreach (var dic in LightViews)
|
{
|
if (dic.Key == light.sid)
|
{
|
var state = light.state == 1;
|
var view = dic.Value;
|
for (int i = 0; i < view.ChildrenCount; i++)
|
{
|
if (view.GetChildren(i).GetType() == typeof(Button))
|
{
|
var btn = view.GetChildren(i) as Button;
|
btn.IsSelected = state;
|
if (btn.Tag != null && btn.Tag.ToString() == "state")
|
{
|
btn.Text = light.lastState;
|
}
|
}
|
}
|
}
|
}
|
}
|
});
|
}
|
}
|
}
|