private void UsePropertyGridLG()
 {
     if (Content != ContentTypeVm.Light && Content != ContentTypeVm.Group)
     {
         return;
     }
     if (_selectedViewModel is ScheduleCreatorSlidersViewModel)
     {
         string json = Serializer.SerializeToJson(SelectedViewModel);
         SelectedViewModel = new ScheduleCreatorPropertyGridViewModel();
         ((ScheduleCreatorPropertyGridViewModel)SelectedViewModel).SelectedObject = Serializer.DeserializeToObject <State>(json);
     }
     else
     {
         string json = Serializer.SerializeToJson(((ScheduleCreatorPropertyGridViewModel)SelectedViewModel).SelectedObject);
         SelectedViewModel = Serializer.DeserializeToObject <ScheduleCreatorSlidersViewModel>(json);
     }
 }
        public Schedule GetSchedule()
        {
            Schedule sc = new Schedule
            {
                name        = Header.Name,
                autodelete  = Header.Autodelete,
                description = Header.Description,
                recycle     = Header.Recycle,
                status      = Header.Enabled,
                localtime   = BuildScheduleTime(),
                command     = new Command
                {
                    address = AdrTarget,
                    method  = "PUT",
                },
            };

            string body = string.Empty;

            if (_selectedViewModel is ScheduleCreatorPropertyGridViewModel)
            {
                ScheduleCreatorPropertyGridViewModel scpg = _selectedViewModel as ScheduleCreatorPropertyGridViewModel;
                body = Serializer.SerializeToJson(scpg.SelectedObject);
            }
            else if (_selectedViewModel is ScheduleCreatorSlidersViewModel)
            {
                ScheduleCreatorSlidersViewModel scsv = _selectedViewModel as ScheduleCreatorSlidersViewModel;
                body = Serializer.SerializeToJson(scsv);
            }
            else
            {
                body = Serializer.SerializeToJson(
                    new Philips_Hue.HueObjects.GroupObject.Action()
                {
                    scene = SelectedTarget.Id
                });
            }

            sc.command.body = body;

            return(sc);
        }
        private void SetEmptyViewModel()
        {
            switch (SelectedTarget)
            {
            case Sensor _:
            {
                SelectedViewModel = new ScheduleCreatorPropertyGridViewModel();
                ((ScheduleCreatorPropertyGridViewModel)SelectedViewModel).SelectedObject = HueSensorStateFactory.CreateSensorStateFromSensorType(((Sensor)SelectedTarget).type);
                break;
            }

            case Schedule _:
            {
                SelectedViewModel = new ScheduleCreatorPropertyGridViewModel();
                ((ScheduleCreatorPropertyGridViewModel)SelectedViewModel).SelectedObject = new Schedule();
                break;
            }

            case Scene _:
            {
                SelectedViewModel = null;
                break;
            }

            case Light _:
            case Group _:
            {
                if (_propGridLG)
                {
                    ((ScheduleCreatorPropertyGridViewModel)_selectedViewModel).SelectedObject = new State();
                }
                else
                {
                    SelectedViewModel = new ScheduleCreatorSlidersViewModel();
                }
                break;
            }
            }
        }