public void Dispose()
 {
     _applicationViewModel.OnLoadModSet        -= BuildModList;
     _applicationViewModel.OnGetModsForThisApp -= BuildModList;
     OpenModFolderCommand?.Dispose();
     ConfigureModCommand?.Dispose();
     GC.SuppressFinalize(this);
 }
        public ApplicationSummaryViewModel(ApplicationViewModel model)
        {
            ApplicationTuple      = model.ApplicationTuple;
            OpenModFolderCommand  = new OpenModFolderCommand(this);
            ConfigureModCommand   = new ConfigureModCommand(this);
            _applicationViewModel = model;

            // Wait for parent to fully initialize.
            PropertyChanged += UpdateIcon;
            _applicationViewModel.OnGetModsForThisApp += BuildModList;
            _applicationViewModel.OnLoadModSet        += BuildModList;
            BuildModList();
        }
        public AppSummaryViewModel(ApplicationViewModel model)
        {
            ApplicationTuple      = model.ApplicationTuple;
            OpenModFolderCommand  = new OpenModFolderCommand(this);
            ConfigureModCommand   = new ConfigureModCommand(this);
            _applicationViewModel = model;

            // Wait for parent to fully initialize.
            _applicationViewModel.OnGetModsForThisApp += BuildModList;
            _applicationViewModel.OnLoadModSet        += BuildModList;
            BuildModList();

            SelectedMod = AllMods.FirstOrDefault();
        }
Example #4
0
    private void UpdateCommands()
    {
        // Some operations like swapping order of 2 lists might fire a
        // event with SelectedMod == null, then select our mod again.
        // Setting up some commands (particularly ConfigureMod) can cause lag, so let's mitigate this.
        if (SelectedMod == null || SelectedMod == _cachedModEntry)
        {
            return;
        }

        OpenModFolderCommand      = new OpenModFolderCommand(SelectedMod.Tuple);
        EditModCommand            = new EditModCommand(SelectedMod.Tuple, null);
        PublishModCommand         = new PublishModCommand(SelectedMod.Tuple);
        VisitModProjectUrlCommand = new VisitModProjectUrlCommand(SelectedMod.Tuple);

        var userConfig = _userConfigService.ItemsById.GetValueOrDefault(SelectedMod.Tuple.Config.ModId);

        EditModUserConfigCommand    = new EditModUserConfigCommand(userConfig);
        OpenUserConfigFolderCommand = new OpenUserConfigFolderCommand(userConfig);
        ConfigureModCommand         = new ConfigureModCommand(SelectedMod.Tuple, userConfig, ApplicationTuple);
        _cachedModEntry             = SelectedMod;
    }