public InfoDevice(AddRoomPage p) { InitializeComponent(); aboutUSPage = new AboutUSPage() { device = p.selectedItem }; AddDevicePageViewModel.Name = aboutUSPage.device.myDevice.Name; AddDevicePageViewModel.Pin = aboutUSPage.device.myDevice.Pin; AddDevicePageViewModel.Type = aboutUSPage.device.myDevice.Type; AddDevicePageViewModel.Id = aboutUSPage.device.myDevice.Id; AddDevicePageViewModel.MyRoom = aboutUSPage.device.MyRoom; if (aboutUSPage.device.MyRoom.ToString().IndexOf("Name: Type: ") > -1) { AddDevicePageViewModel.MyRooms = "free"; } else { AddDevicePageViewModel.MyRooms = aboutUSPage.device.MyRoom.ToString(); } //AddDevicePageViewModel.Name = aboutUSPage.addElementName; //AddDevicePageViewModel.Pin = aboutUSPage.addElementPin; //AddDevicePageViewModel.Type = aboutUSPage.addElementType; //AddDevicePageViewModel.Id = aboutUSPage.addElementId; this.BindingContext = AddDevicePageViewModel; }
public AddDevicePage(AboutUSPage mp, bool isedit = false) { InitializeComponent(); mainPage = mp; isEdit = isedit; DeviceTypePicker.ItemsSource = DevicesTypes.DevicesType; if (isedit) { // Name.Text = mainPage.addElementName; // Pin.Text = mainPage.addElementPin; Name.Text = mainPage.device.myDevice.Name; Name.Text = mainPage.device.Name; Pin.Text = mainPage.device.myDevice.Pin; int idx = DevicesTypes.DevicesType.IndexOf(mainPage.device.myDevice.Type); DeviceTypePicker.SelectedIndex = idx + 1; DeviceTypePicker.SelectedItem = DevicesTypes.DevicesType[idx]; // DeviceTypePicker.ItemDisplayBinding = DevicesTypes.DevicesType[idx]; DeviceTypePicker.IsEnabled = false; } }
public InfoDevice(AboutUSPage p) { InitializeComponent(); aboutUSPage = p; AddDevicePageViewModel.Name = aboutUSPage.device.myDevice.Name; AddDevicePageViewModel.Pin = aboutUSPage.device.myDevice.Pin; AddDevicePageViewModel.Type = aboutUSPage.device.myDevice.Type; AddDevicePageViewModel.Id = aboutUSPage.device.myDevice.Id; AddDevicePageViewModel.MyRoom = aboutUSPage.device.MyRoom; if (aboutUSPage.device.myDevice.Type.IndexOf("temperature") > -1) { TemperaturePressureHumidity t = aboutUSPage.device.myDevice as TemperaturePressureHumidity; AddDevicePageViewModel.Temperature = t.Temperature; AddDevicePageViewModel.Pressure = t.Pressure; AddDevicePageViewModel.Humidity = t.Humidity; AddDevicePageViewModel.Altitude = t.Altitude; stack1.IsVisible = true; stack2.IsVisible = true; } if (aboutUSPage.device.MyRoom.ToString().IndexOf("Name: Type: ") > -1) { AddDevicePageViewModel.MyRooms = "free"; } else { AddDevicePageViewModel.MyRooms = aboutUSPage.device.MyRoom.ToString(); } //AddDevicePageViewModel.Name = aboutUSPage.addElementName; //AddDevicePageViewModel.Pin = aboutUSPage.addElementPin; //AddDevicePageViewModel.Type = aboutUSPage.addElementType; //AddDevicePageViewModel.Id = aboutUSPage.addElementId; this.BindingContext = AddDevicePageViewModel; }