void DisposeControl(object o, DataLive dataLive) { int i = -1; if (dataLive.ControlType == "Device") { i = DeviceC.FindIndex(x => x.ID == dataLive.ControlName); DeviceC[i].userRelease(); cloud.IPmanager("Remove", "DeviceList", cloud.FindIp("DeviceList", DeviceC[i].ID)); if (i != -1) { DeviceC.RemoveAt(i); } Console.WriteLine("RemoveDevice"); m.SimulateNewIPLEvent(cloud.DeviceList); } if (dataLive.ControlType == "User") { i = UserC.FindIndex(x => x.ID == dataLive.ControlName); UserC[i].release(); cloud.IPmanager("Remove", "UserList", cloud.FindIp("UserList", UserC[i].ID)); UserC[i].Unregister(); if (i != -1) { UserC.RemoveAt(i); } Console.WriteLine("RemoveUser"); } }
public void SimulateNewDataLiveEvent(string type, string name, bool live) { DataLive e = new DataLive(type, name, live); OnDataLiveEvent(e); }
public void OnDataLiveEvent(DataLive e) { DataLiveEvent?.Invoke(this, e); }