void ExecuteLoadItemsCommand() { RegisteredDevices.Add(new RegisteredDevice { Id = "1", Description = "Smatt Sung's Phone is connected", Text = "OnePlus", deviceType = "Phone", device = "OnePlus 5.0".ToUpper(), deviceName = "OnePlus 5", manufacturer = "OnePlus", version = "5.0", platform = "Android", idiom = "Phone", Flash = "Flash", Sound = "Sound", Vibration = "Vibration", Distance = "34", Measurement = "ft" }); RegisteredDevices.Add(new RegisteredDevice { Id = "1", Description = "Micheal Smith's watch is Connected", Text = "Samsung Watch", deviceType = "Wear", device = "Galaxy Watch".ToUpper(), deviceName = "LRS", manufacturer = "Samsung", version = "10.0", platform = "Android", idiom = "Watch", Flash = "Flash", Sound = "Sound", Vibration = "Vibration", Distance = "43", Measurement = "ft" }); RegisteredDevices.Add(new RegisteredDevice { Id = "1", Description = "Jonh Doe's Watch is connected", Text = "Moto Watch", deviceType = "Wear", device = "LRS 365".ToUpper(), deviceName = "LRS", manufacturer = "Motorola", version = "7.0", platform = "Android", idiom = "Watch", Flash = "Flash", Sound = "Sound", Vibration = "Vibration", Distance = "25", Measurement = "ft" }); }
public void AddRegisteredDevice(IDevice device) { if (device != null) { RegisteredDevices.Add(device); SaveDeviceCollection(); } else { throw new NoDeviceException(); } }
public void LoadDeviceCollection() { RegisteredDevices.Clear(); // just for safety but it's not even neccesary, because LoadDeviceCollection() gets only called when the app starts or when the registeredDevice array is already empty DeviceCollectionData deviceCollectionData = SaveAndLoadSystem.LoadDeviceCollection(); if (deviceCollectionData != null) { if (deviceCollectionData.DeviceDataList != null) { for (int i = 0; i < deviceCollectionData.DeviceDataList.Length; i++) { DeviceData deviceData = (DeviceData)deviceCollectionData.DeviceDataList[i]; IDevice device = null; Debug.Log("device type name: " + deviceData.GetType().Name); switch (deviceData.GetType().Name) { case "LampData": device = new Lamp(deviceData.DeviceName, deviceData.Id, deviceData.Name); break; default: Debug.LogError("Unknown Device Data Type"); break; } if (device != null) { device.LoadDevice(deviceData); RegisteredDevices.Add(device); } } } AllDevicesOff = deviceCollectionData.AllDevicesOff; } }