Beispiel #1
0
        public SearchPageViewModel()
        {
            ViewModelManager.SearchPageViewModel = this;
            SearchProgressVisibility             = Visibility.Visible;
            DataVisibility      = Visibility.Hidden;
            NoResultVisibility  = Visibility.Hidden;
            ClickBackCommand    = new DelegateCommand(new Action(() => PageManager.SearchPage.NavigationService.GoBack()));
            ClickNeteaseCommand = new DelegateCommand <object>(new Action <object>(ClickNeteaseExecute));
            ClickKugouCommand   = new DelegateCommand <object>(new Action <object>(ClickKugouExecute));
            ClickTencentCommand = new DelegateCommand <object>(new Action <object>(ClickTencentExecute));
            PrePlayCommand      = new DelegateCommand <object>(new Action <object>(PrePlayExecute));

            //搜索选项加载
            IniConfig ini = new IniConfig("Config.ini");

            ini.Load();
            try
            {
                SearchOption = ini.GetObject <SearchOptionModel>();
            }
            catch (ArgumentException)
            {
                SearchOption = new SearchOptionModel {
                    Kugou = true, Netease = true, Tencent = true
                };
                ini.SetObject(SearchOption);
                ini.Save();
            }
        }
Beispiel #2
0
        public void ClickTencentExecute(object parameter)
        {
            SearchOption.Tencent = (bool)parameter;
            var ini = new IniConfig("Config.ini");

            ini.SetObject(SearchOption);
            ini.Save();
            MusicInfos.Where(t => t.Origin == MusicSource.Tencent).ToList().ForEach(item => MusicInfos.Remove(item));
            PlayerList.SetPreList(MusicInfos, "搜索");
        }