Пример #1
0
        public LightViewModel(Light light)
        {
            this.Light             = light;
            light.PropertyChanged += Light_PropertyChanged;

            SetSceneCommand = new RelayCommand(() => SetScene());

            Name  = KnownDevices.GetName(light.Id);
            Scene = new Scene(light.Scene);
            Scene.SceneChanged += Scene_SceneChanged;
        }
        public static MobileDevice GetKnownDevice(KnownDevices device)
        {
            switch (device)
            {
            case KnownDevices.AppleIPhone6:
                return(new MobileDevice
                       (
                           Manufacturers.Apple,
                           "iPhone 6",
                           new Battery(BatteryTypes.LithiumIon, 2400, "Apple Inc."),
                           new Screen(1334, 750, 4.7),
                           497.99
                       ));

            case KnownDevices.AppleIPhone7:
                return(new MobileDevice
                       (
                           Manufacturers.Apple,
                           "iPhone 7",
                           new Battery(BatteryTypes.LithiumIon, 2400, "Apple Inc."),
                           new Screen(1334, 750, 4.7),
                           742.99
                       ));

            case KnownDevices.SamsungGalaxyA3:
                return(new MobileDevice
                       (
                           Manufacturers.Samsung,
                           "Galaxy A3",
                           new Battery(BatteryTypes.LithiumPolymer, 3200, "Samsung Inc."),
                           new Screen(1280, 720, 4.7),
                           192.43
                       ));

            case KnownDevices.SamsungGalaxyA5:
                return(new MobileDevice
                       (
                           Manufacturers.Samsung,
                           "Galaxy A5",
                           new Battery(BatteryTypes.LithiumPolymer, 2900, "Samsung Inc."),
                           new Screen(1920, 1080, 5.2),
                           259.00
                       ));

            case KnownDevices.LgGoogleNexus5X:
                return(new MobileDevice
                       (
                           Manufacturers.LG,
                           "Nexus 5X",
                           new Battery(BatteryTypes.LithiumIon, 2700, "Life is Good Corporation"),
                           new Screen(1920, 1080, 5.2),
                           241.10
                       ));

            case KnownDevices.MicrosoftLumia950:
                return(new MobileDevice
                       (
                           Manufacturers.Microsoft,
                           "Lumia 950",
                           new Battery(BatteryTypes.LithiumIon, 3000, "Microsoft Corporation"),
                           new Screen(2560, 1440, 5.2),
                           241.10
                       ));

            case KnownDevices.TurboXTheIrreplaceable2:
                return(new MobileDevice
                       (
                           Manufacturers.TurboX,
                           "The Irreplaceable 2",
                           new Battery(BatteryTypes.LithiumIon, 900, "Plaisio GmbH"),
                           new Screen(360, 140, 9.2),
                           941.10
                       ));

            default:
                throw new ArgumentOutOfRangeException(nameof(device), device, null);
            }
        }