Example #1
0
        private async void LoadConfig()
        {
            ConfigManager.ConfigManager.Init();

            if (!ConfigManager.ConfigManager.GetStatementConfirmed())
            {
                StatementGrid.Visibility = Visibility.Visible;
            }

            BiliApi.CookieCollection = ConfigManager.ConfigManager.GetCookieCollection();
            SettingsBox.SetSettings(ConfigManager.ConfigManager.GetSettings());

            List <DownloadInfo> infos = ConfigManager.ConfigManager.GetDownloadInfos();

            foreach (DownloadInfo info in infos)
            {
                DownloadQueuePanel.Append(new DownloadTask(info));
            }

            ResultBox.SetHistory(ConfigManager.ConfigManager.GetSearchHistory());

            if (BiliApi.CookieCollection != null)
            {
                UserInfo userInfo = await UserInfo.GetUserInfoAsync(BiliApi.CookieCollection);

                if (userInfo != null)
                {
                    ShowUserInfo(userInfo);
                    LoginBtn.Content = "登出";
                }
            }
        }
Example #2
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     UpdatePromptBox.StopCheckVersion();
     DownloadQueuePanel.StopAll();
     SettingPanel.Settings settings = ConfigManager.ConfigManager.GetSettings();
     if (settings.MovedTempPath != null && settings.MovedTempPath != settings.TempPath)
     {
         CopyDirectory(settings.TempPath, settings.MovedTempPath);
         settings.TempPath      = settings.MovedTempPath;
         settings.MovedTempPath = null;
         ConfigManager.ConfigManager.SetSettings(settings);
     }
 }
Example #3
0
 private void DownloadOptionPanel_TaskCreated(DownloadTask downloadTask)
 {
     if (DownloadQueuePanel.Append(downloadTask))
     {
         Prompt.Text = "已添加到下载队列";
         ((System.Windows.Media.Animation.Storyboard)Resources["ShowPrompt"]).Begin();
     }
     else
     {
         Prompt.Text = "已存在于下载队列";
         ((System.Windows.Media.Animation.Storyboard)Resources["ShowPrompt"]).Begin();
     }
 }