public static DdjViewModel RestoreState(string vmState)
        {
            var dvm = new DdjViewModel();

            if (!string.IsNullOrEmpty(vmState))
            {
                var vms = Serializer.LoadFromString <VMState>(vmState) as VMState;
                if (vms != null)
                {
                    //dvm._VMState = vms;
                    dvm.AddRandomDay = vms.AddRandomDay < 1 ? 1 : vms.AddRandomDay;
                    dvm.PlaylilstLen = vms.PlaylilstLen;
                    dvm.StringFilter = vms.StringFilter;
                    dvm.AutoStart    = vms.AutoStart;

                    foreach (var g in vms.GenreFilter)
                    {
                        dvm.GenreFilter.Add(new LkuGenre {
                            ID = g
                        }); dvm.onTglGenre(g);
                    }
                }
            }
            return(dvm);
        }
Beispiel #2
0
        public static DdjViewModel RestoreState()
        {
            var dvm = new DdjViewModel();

            if (AppSettings.Instance.VMState != null)
            {
                dvm.AddRandomDay = AppSettings.Instance.VMState.AddRandomDay < 1 ? 1 : AppSettings.Instance.VMState.AddRandomDay;
                dvm.PlaylilstLen = AppSettings.Instance.VMState.PlaylilstLen;
                dvm.StringFilter = AppSettings.Instance.VMState.StringFilter;
                dvm.IsAutoPlay   = AppSettings.Instance.VMState.IsAutoPlay;

                foreach (var g in AppSettings.Instance.VMState.GenresFilter)
                {
                    dvm.GenreFilter.Add(new LkuGenre {
                        ID = g
                    }); dvm.onTglGenre(g);
                }
            }

            return(dvm);
        }