Пример #1
0
        public AllModsMissingErrorVm(
            IProfileDataFolderVm dataFolderVm,
            OpenProfileSettings openProfileSettings,
            IImplicitListingModKeyProvider implicitListingsProvider,
            IProfileLoadOrder profileLoadOrder)
        {
            var nonImplicit = profileLoadOrder.LoadOrder.Connect()
                              .Filter(x => !implicitListingsProvider.Listings.Contains(x.ModKey))
                              .ObserveOn(RxApp.MainThreadScheduler)
                              .AsObservableList();

            _InError = nonImplicit.CountChanged
                       .Select(x => x > 0)
                       .CombineLatest(
                nonImplicit.Connect()
                .FilterOnObservable(i => i.WhenAnyValue(x => x.Exists))
                .QueryWhenChanged(q => q.Count > 0),
                (hasAny, anyExist) => hasAny && !anyExist)
                       .ToGuiProperty(this, nameof(InError), deferSubscription: true);

            _ErrorString = nonImplicit.CountChanged
                           .Select(count =>
            {
                return($"Load order listed {count} mods, but none were found in the game's data folder");
            })
                           .ToGuiProperty(this, nameof(ErrorString), default(string?), deferSubscription: true);

            _DataFolderPath = dataFolderVm.WhenAnyValue(x => x.Path)
                              .Select(x => x.Path)
                              .ToGuiProperty(this, nameof(DataFolderPath), string.Empty, deferSubscription: true);

            GoToProfileSettingsCommand = openProfileSettings.OpenCommand;
        }
Пример #2
0
 public MainVm(
     ActiveRunVm activeRunVm,
     ProfileManagerVm profileManager,
     OpenProfileSettings openProfileSettings,
     OpenGlobalSettings openGlobalSettings,
     IConfirmationPanelControllerVm confirmationControllerVm,
     IProvideCurrentVersions currentVersions,
     ISelectedProfileControllerVm selectedProfile,
     ISaveSignal saveSignal,
     ISettingsSingleton settingsSingleton,
     INewestLibraryVersionsVm libVersionsVm,
     IActivePanelControllerVm activePanelControllerVm,
     IProfileFactory profileFactory,
     ILogger logger)
 {
     logger.Information("Creating MainVM");
     _selectedProfileController = selectedProfile;
     _settingsSingleton         = settingsSingleton;
     _activePanelControllerVm   = activePanelControllerVm;
     _profileFactory            = profileFactory;
     _logger      = logger;
     _activePanel = activePanelControllerVm.WhenAnyValue(x => x.ActivePanel)
                    .ToGuiProperty(this, nameof(ActivePanel), default, deferSubscription: true);