示例#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();
            }
        }