using EyesAndEars.UWP.Models; using System.ComponentModel; namespace EyesAndEars.UWP.ViewModels { public class MainPageVM : INotifyPropertyChanged { /* Note: Why I did not use a collection of some sort and hard-coded the * objects instead. * ==================================================================== * Because the projects requirements are fixed in-place and this * program does not have long-term requirements, I decided to not worry * about long-term maintenance benefits. If something comes from this * project afterwards, the duplicated nature of the code below will * probably need refacorting but I will leave that to the person * needing to make that call at that time. */ public MainPageVM() { } public MainPageVM(Device f1, Device f2, Device f3, Device g1, Device g2, Device g3) { Device1 = f1; Device2 = f2; Device3 = f3; Device1 = g1; Device2 = g2; Device3 = g3; } string _baseURL; public string BaseURL { get { return _baseURL; } set { if (value != _baseURL) { _baseURL = value; NotifyPropertyChanged("BaseURL"); } } } Device _device1; public Device Device1 { get { return _device1; } set { if (value != _device1) { _device1 = value; NotifyPropertyChanged("Device1"); } } } Device _device2; public Device Device2 { get { return _device2; } set { if (value != _device2) { _device2 = value; NotifyPropertyChanged("Device2"); } } } Device _device3; public Device Device3 { get { return _device3; } set { if (value != _device3) { _device3 = value; NotifyPropertyChanged("Device3"); } } } Device _device4; public Device Device4 { get { return _device4; } set { if (value != _device4) { _device4 = value; NotifyPropertyChanged("Device4"); } } } Device _device5; public Device Device5 { get { return _device5; } set { if (value != _device5) { _device5 = value; NotifyPropertyChanged("Device5"); } } } Device _device6; public Device Device6 { get { return _device6; } set { if (value != _device6) { _device6 = value; NotifyPropertyChanged("Device6"); } } } public event PropertyChangedEventHandler PropertyChanged; protected void NotifyPropertyChanged(string info) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(info)); } } }