コード例 #1
0
        public MainWindowViewModel(MainWindow mainWindow)
        {
            MainWindow = mainWindow;
            BeatmapLocalUserControl            = new BeatmapLocalUserControl(mainWindow);
            BeatmapOnlineUserControl           = new BeatmapOnlineUserControl(mainWindow);
            SettingsUserControl                = new SettingsUserControl(mainWindow);
            BeatmapLocalDetailsUserControl     = new BeatmapLocalDetailsUserControl(mainWindow);
            BeatmapOnlineDetailsUserControl    = new BeatmapOnlineDetailsUserControl(mainWindow);
            SaberOnlineUserControl             = new ModelSaberOnlineUserControl(mainWindow, ModelType.Saber);
            SaberLocalUserControl              = new ModelSaberLocalUserControl(mainWindow, ModelType.Saber);
            AvatarOnlineUserControl            = new ModelSaberOnlineUserControl(mainWindow, ModelType.Avatar);
            AvatarLocalUserControl             = new ModelSaberLocalUserControl(mainWindow, ModelType.Avatar);
            PlatformOnlineUserControl          = new ModelSaberOnlineUserControl(mainWindow, ModelType.Platform);
            PlatformLocalUserControl           = new ModelSaberLocalUserControl(mainWindow, ModelType.Platform);
            BloqOnlineUserControl              = new ModelSaberOnlineUserControl(mainWindow, ModelType.Bloq);
            BloqLocalUserControl               = new ModelSaberLocalUserControl(mainWindow, ModelType.Bloq);
            ModelSaberOnlineDetailsUserControl = new ModelSaberOnlineDetailsUserControl(mainWindow);
            ModelSaberLocalDetailsUserControl  = new ModelSaberLocalDetailsUserControl(mainWindow);
            NavigationBeatmapsUserControl      = new NavigationBeatmapsUserControl();
            NavigationSabersUserControl        = new NavigationModelSaberUserControl(ModelType.Saber);
            NavigationAvatarsUserControl       = new NavigationModelSaberUserControl(ModelType.Avatar);
            NavigationPlatformsUserControl     = new NavigationModelSaberUserControl(ModelType.Platform);
            NavigationBloqsUserControl         = new NavigationModelSaberUserControl(ModelType.Bloq);

            DownloadsUserControl = new DownloadsUserControl();

            NavigationBeatmapsUserControl.ViewModel.LocalEvent   += NavigationBeatmaps_LocalEvent;
            NavigationBeatmapsUserControl.ViewModel.OnlineEvent  += NavigationBeatmaps_OnlineEvent;
            NavigationSabersUserControl.ViewModel.LocalEvent     += NavigationSabers_LocalEvent;
            NavigationSabersUserControl.ViewModel.OnlineEvent    += NavigationSabers_OnlineEvent;
            NavigationAvatarsUserControl.ViewModel.LocalEvent    += NavigationAvatars_LocalEvent;
            NavigationAvatarsUserControl.ViewModel.OnlineEvent   += NavigationAvatars_OnlineEvent;
            NavigationPlatformsUserControl.ViewModel.LocalEvent  += NavigationPlatforms_LocalEvent;
            NavigationPlatformsUserControl.ViewModel.OnlineEvent += NavigationPlatforms_OnlineEvent;
            NavigationBloqsUserControl.ViewModel.LocalEvent      += NavigationBloqs_LocalEvent;
            NavigationBloqsUserControl.ViewModel.OnlineEvent     += NavigationBloqs_OnlineEvent;

            App.BeatSaverApi.DownloadStarted += BeatSaverApi_DownloadStarted;
            App.BeatSaverApi.DownloadFailed  += BeatSaverApi_DownloadFailed;

            App.ModelSaberApi.DownloadStarted += ModelSaberApi_DownloadStarted;
            App.ModelSaberApi.DownloadFailed  += ModelSaberApi_DownloadFailed;

            Updater = new Updater("casperb123", "BeatManager", Resources.GitHubToken);
            Updater.UpdateAvailable       += Updater_UpdateAvailable;
            Updater.DownloadingStarted    += Updater_DownloadingStarted;
            Updater.DownloadingProgressed += Updater_DownloadingProgressed;
            Updater.DownloadingCompleted  += Updater_DownloadingCompleted;
            Updater.DownloadingFailed     += Updater_DownloadingFailed;
            Updater.InstallationFailed    += Updater_InstallationFailed;

            CheckForUpdates();
        }
 public BeatmapOnlineDetailsUserControlViewModel(BeatmapOnlineDetailsUserControl userControl, MainWindow mainWindow)
 {
     this.userControl = userControl;
     this.mainWindow  = mainWindow;
 }