public MainWindowViewModel( IDialogService dialogService, IPluginLoader pluginLoader, IThemeService themeService, IModSelectionViewModel modSelectionViewModel, IMainEditorViewModel mainEditorViewModel) { _themeService = themeService; // Initial load of plugins to create cache and alert user of failures pluginLoader.LoadPlugins(out var failures); if (failures?.AnyFailures == true) { dialogService.ShowMessageBox(MessageBoxArgs.Ok( title: "Plugin Load Failures", message: $"Unable to load some of the plugins, details:\n\n{failures}", type: MessageBoxType.Warning )); } _modSelectionVm = modSelectionViewModel; _mainEditorViewModel = mainEditorViewModel; CurrentVm = _modSelectionVm; _modSelectionVm.ModSelected += OnModSelected; BackButtonCommand = new RelayCommand(OnBackButtonPressed); ToggleThemeCommand = new RelayCommand(ToggleTheme); }
public ModListItemViewModel( IModSelectionViewModel parent, ModInfo mod, IModManager modManager, IModPatchingService modPatcher, IDialogService dialogService, IPluginLoader pluginLoader, IModServiceGetterFactory modKernelFactory) { _modKernelFactory = modKernelFactory; _parentVm = parent; _modService = modManager; _dialogService = dialogService; _modPatcher = modPatcher; Mod = mod; PluginItems = pluginLoader.LoadPlugins(out var _); PatchRomCommand = new RelayCommand(() => PatchRom(Mod)); ExportModCommand = new RelayCommand(() => ExportMod(Mod)); EditModInfoCommand = new RelayCommand(() => EditModInfo(Mod)); CreateModBasedOnCommand = new RelayCommand(() => CreateModBasedOn(Mod)); DeleteModCommand = new RelayCommand(() => DeleteMod(Mod)); RunPluginCommand = new RelayCommand <PluginInfo>(parameter => RunPlugin(Mod, parameter)); }
public IModListItemViewModel CreateViewModel(IModSelectionViewModel parent, ModInfo mod) { return(_factory(parent, mod)); }