예제 #1
0
 private void UpdateCommands()
 {
     EditModCommand      = new EditModCommand(SelectedModTuple, null);
     DeleteModCommand    = new DeleteModCommand(SelectedModTuple);
     _setModImageCommand = new SetModImageCommand(SelectedModTuple);
     PublishModCommand   = new PublishModCommand(SelectedModTuple);
 }
예제 #2
0
        public ManageModsViewModel(ApplicationConfigService appConfigService, ModConfigService modConfigService)
        {
            ModConfigService    = modConfigService;
            _appConfigService   = appConfigService;
            _setModImageCommand = new SetModImageCommand(this);

            SelectedModTuple = ModConfigService.Mods.FirstOrDefault();
        }
예제 #3
0
        public ManageModsPage() : base()
        {
            InitializeComponent();
            ViewModel                       = IoC.Get <ManageModsViewModel>();
            this.DataContext                = ViewModel;
            this.AnimateOutStarted         += SaveCurrentMod;
            IoC.Get <MainWindow>().Closing += OnMainWindowClosing;

            // Setup filters
            var manipulator = new DictionaryResourceManipulator(this.Contents.Resources);

            _modsViewSource         = manipulator.Get <CollectionViewSource>("SortedMods");
            _appsViewSource         = manipulator.Get <CollectionViewSource>("SortedApps");
            _modsViewSource.Filter += ModsViewSourceOnFilter;
            _appsViewSource.Filter += AppsViewSourceOnFilter;
            _setModImageCommand     = new SetModImageCommand();
        }
예제 #4
0
    /// <inheritdoc />
    public EditModDialogViewModel(PathTuple <ModConfig> modTuple, ApplicationConfigService applicationConfigService, ModConfigService modConfigService)
    {
        _applicationConfigService = applicationConfigService;
        ConfigTuple = modTuple;
        Config      = modTuple.Config;

        // Build Dependencies
        var mods = modConfigService.Items; // In case collection changes during window open.

        foreach (var mod in mods)
        {
            bool isEnabled = modTuple.Config.ModDependencies.Contains(mod.Config.ModId, StringComparer.OrdinalIgnoreCase);
            Dependencies.Add(new BooleanGenericTuple <IModConfig>(isEnabled, mod.Config));
        }

        // Build Applications
        var apps = applicationConfigService.Items;

        foreach (var app in apps)
        {
            bool isEnabled = modTuple.Config.SupportedAppId.Contains(app.Config.AppId, StringComparer.OrdinalIgnoreCase);
            Applications.Add(new BooleanGenericTuple <IApplicationConfig>(isEnabled, app.Config));
        }

        // Build Update Configurations
        foreach (var resolver in PackageResolverFactory.All)
        {
            var result = ResolverFactoryConfiguration.TryCreate(resolver, ConfigTuple);
            if (result != null)
            {
                Updates.Add(result);
            }
        }

        // Everything Else
        _setModImageCommand = new SetModImageCommand(modTuple);
        IoC.RebindToConstant(this);
        PropertyChanged += OnPageChanged;
    }