コード例 #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 SidePanelActionsHandler(OsuFileIo osuFileIo, ICollectionEditor collectionEditor, IUserDialogs userDialogs, IMainFormView mainForm, IBeatmapListingBindingProvider beatmapListingBindingProvider, MainFormPresenter mainFormPresenter, ILoginFormView loginForm)
        {
            _osuFileIo        = osuFileIo;
            _collectionEditor = collectionEditor;
            _userDialogs      = userDialogs;
            _mainForm         = mainForm;
            _beatmapListingBindingProvider = beatmapListingBindingProvider;
            _mainFormPresenter             = mainFormPresenter;
            _loginForm           = loginForm;
            _collectionGenerator = new CollectionsApiGenerator(Initalizer.OsuFileIo.LoadedMaps);

            BindMainFormActions();
        }
コード例 #3
0
        public static LoginData GetLoginData(this ILoginFormView loginForm)
        {
            loginForm.ShowAndBlock();
            LoginData loginData = new LoginData();

            if (loginForm.ClickedLogin)
            {
                loginData.Username = loginForm.Login;
                loginData.Password = loginForm.Password;
            }

            return(loginData.isValid() ? loginData : null);
        }
コード例 #4
0
        public static LoginData GetLoginData(this ILoginFormView loginForm,
                                             IReadOnlyList <IDownloadSource> downloadSources)
        {
            loginForm.SetDownloadSources(downloadSources);
            loginForm.ShowAndBlock();
            var loginData = new LoginData();

            if (loginForm.ClickedLogin)
            {
                loginData.Username       = loginForm.Login;
                loginData.Password       = loginForm.Password;
                loginData.SiteCookies    = loginForm.OsuCookies;
                loginData.DownloadSource = loginForm.DownloadSource;
            }

            return(loginData);
        }
コード例 #5
0
        public BeatmapListingActionsHandler(ICollectionEditor collectionEditor, IUserDialogs userDialogs, ILoginFormView loginForm, OsuFileIo osuFileIo)
        {
            _collectionEditor = collectionEditor;
            _userDialogs      = userDialogs;
            _loginForm        = loginForm;
            _osuFileIo        = osuFileIo;

            _beatmapOperationHandlers = new Dictionary <BeatmapListingAction, Action <object> >
            {
                { BeatmapListingAction.CopyBeatmapsAsText, CopyBeatmapsAsText },
                { BeatmapListingAction.CopyBeatmapsAsUrls, CopyBeatmapsAsUrls },
                { BeatmapListingAction.DeleteBeatmapsFromCollection, DeleteBeatmapsFromCollection },
                { BeatmapListingAction.DownloadBeatmapsManaged, DownloadBeatmapsManaged },
                { BeatmapListingAction.DownloadBeatmaps, DownloadBeatmaps },
                { BeatmapListingAction.OpenBeatmapPages, OpenBeatmapPages },
                { BeatmapListingAction.OpenBeatmapFolder, OpenBeatmapFolder }
            };
        }
コード例 #6
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);
        }
コード例 #7
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);
 }
コード例 #8
0
        public GuiActionsHandler(OsuFileIo osuFileIo, ICollectionEditor collectionEditor, IUserDialogs userDialogs, IMainFormView mainFormView, MainFormPresenter mainFormPresenter, ILoginFormView loginForm)
        {
            _mainFormView           = mainFormView;
            SidePanelActionsHandler = new SidePanelActionsHandler(osuFileIo, collectionEditor, userDialogs, mainFormView, this, mainFormPresenter, loginForm);

            _beatmapListingActionsHandler = new BeatmapListingActionsHandler(collectionEditor, userDialogs, loginForm, osuFileIo);
            _beatmapListingActionsHandler.Bind(mainFormPresenter.BeatmapListingModel);

            Initalizer.CollectionsManager.LoadedCollections.CollectionChanged += LoadedCollectionsOnCollectionChanged;
        }
コード例 #9
0
        public GuiActionsHandler(OsuFileIo osuFileIo, ICollectionEditor collectionEditor, IUserDialogs userDialogs, IMainFormView mainFormView, MainFormPresenter mainFormPresenter, ILoginFormView loginForm)
        {
            _sidePanelActionsHandler = new SidePanelActionsHandler(osuFileIo, collectionEditor, userDialogs, mainFormView, this, mainFormPresenter, loginForm);

            _beatmapListingActionsHandler = new BeatmapListingActionsHandler(collectionEditor, userDialogs, loginForm, osuFileIo);
            _beatmapListingActionsHandler.Bind(mainFormPresenter.BeatmapListingModel);
        }