コード例 #1
0
        public bool AskUserForSaveDirectoryAndLogin(IUserDialogs userDialogs, ILoginFormView loginForm)
        {
            if (!DownloadDirectoryIsSet)
            {
                SetDownloadDirectory(userDialogs.SelectDirectory("Select directory for saved beatmaps", true));
                if (!DownloadDirectoryIsSet)
                {
                    return(false);
                }
            }

            if (!DownloadWithVideo.HasValue)
            {
                DownloadWithVideo = userDialogs.YesNoMessageBox("Download beatmaps with video?", "Beatmap downloader",
                                                                MessageBoxType.Question);
            }
            if (!IsLoggedIn)
            {
                LogIn(loginForm.GetLoginData());
                if (!IsLoggedIn)
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #2
0
        public bool AskUserForSaveDirectoryAndLogin(IUserDialogs userDialogs, ILoginFormView loginForm)
        {
            if (IsLoggedIn)
            {
                return(true);
            }

            var downloaderSettings = JsonConvert.DeserializeObject <DownloaderSettings>(Settings.Default.DownloadManager_DownloaderSettings);

            if (downloaderSettings.LoginData == null)
            {
                downloaderSettings.LoginData = new LoginData();
            }

            var useExistingSettings = downloaderSettings.IsValid(DownloadSources) && userDialogs.YesNoMessageBox($"Reuse last downloader settings? {Environment.NewLine}{downloaderSettings}", "DownloadManager - Reuse settings", MessageBoxType.Question);

            if (useExistingSettings)
            {
                DownloadDirectory = downloaderSettings.DownloadDirectory;
                DownloadWithVideo = downloaderSettings.DownloadWithVideo;
                return(LogIn(downloaderSettings.LoginData));
            }

            DownloadDirectory = userDialogs.SelectDirectory("Select directory for saved beatmaps", true);
            if (!DownloadDirectoryIsSet)
            {
                return(false);
            }

            DownloadWithVideo = userDialogs.YesNoMessageBox("Download beatmaps with video?", "Beatmap downloader", MessageBoxType.Question);
            var userLoginData = loginForm.GetLoginData(DownloadSources);

            if (LogIn(userLoginData))
            {
                Settings.Default.DownloadManager_DownloaderSettings = JsonConvert.SerializeObject(new DownloaderSettings
                {
                    DownloadWithVideo = DownloadWithVideo,
                    DownloadDirectory = DownloadDirectory,
                    LoginData         = userLoginData
                });
            }

            return(IsLoggedIn);
        }
コード例 #3
0
 public bool AskUserForSaveDirectoryAndLogin(IUserDialogs userDIalogs, ILoginFormView loginForm)
 {
     if (!DownloadDirectoryIsSet)
     {
         SetDownloadDirectory(userDIalogs.SelectDirectory("Select directory for saved beatmaps", true));
         if (!DownloadDirectoryIsSet)
         {
             return(false);
         }
     }
     if (!IsLoggedIn)
     {
         LogIn(loginForm.GetLoginData());
         if (!IsLoggedIn)
         {
             return(false);
         }
     }
     return(true);
 }