Esempio n. 1
0
        private async void Btn_GetList_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(GlobalData.VM_MA.Cookies))
            {
                await GetCheck(GlobalLanguage.Msg_CheckCk);

                return;
            }
            ShowLoading(true);
            await Task.Delay(100);

            ResultMessage _ret = null;

            GetSystemProxy();
            _utils = GlobalData.CaptureUtil;
            if (_utils is PatreonUtils)
            {
                _ret = await(_utils as PatreonUtils).InitBrowser();
                if (_ret.Error != ErrorType.NoError)
                {
                    await GetCheck(_ret.Msgs);

                    ShowLoading(false);
                    return;
                }
                else if ((bool)_ret.Result)
                {
                    while (GlobalData.VM_MA.ShowLogin)
                    {
                        await Task.Delay(1000);
                    }
                    if (!GlobalData.VM_MA.IsInitialized)
                    {
                        ShowLoading(false);
                        return;
                    }
                }
            }
            _ret = await _utils.GetArtistList();

            if (_ret.Error != ErrorType.NoError)
            {
                await GetCheck(_ret.Msgs);

                ShowLoading(false);
                return;
            }
            List <ArtistInfo> ais = (List <ArtistInfo>)_ret.Result;

            GlobalData.VM_MA.ArtistList = new System.Collections.ObjectModel.ObservableCollection <ArtistInfo>();
            foreach (var ai in ais)
            {
                GlobalData.VM_MA.ArtistList.Add(ai);
            }
            GlobalData.VM_MA.Artist = GlobalData.VM_MA.ArtistList.Last();
            await Task.Run(() => SaveSetting());

            ShowLoading(false);
        }