/// <summary> /// Called when [activated]. /// </summary> /// <param name="disposables">The disposables.</param> protected override void OnActivated(CompositeDisposable disposables) { void syncPatchState() { if (modCollection != null) { IsPatchModEnabled = modCollection.PatchModEnabled = !IsPatchModEnabled; OpenClass = IsPatchModEnabled ? ActiveClass : InactiveClass; var collection = modCollectionService.Get(modCollection.Name); collection.PatchModEnabled = IsPatchModEnabled; modCollectionService.Save(collection); ForceClose(); } SetOpenCaption(); } async Task deletePatch() { if (modCollection != null) { var title = localizationManager.GetResource(LocalizationResources.Collection_Mods.PatchMod.DeletePrompt.Title); var message = localizationManager.GetResource(LocalizationResources.Collection_Mods.PatchMod.DeletePrompt.Message); if (await notificationAction.ShowPromptAsync(title, title, message, NotificationType.Warning)) { await modService.PurgeModPatchAsync(modCollection.Name); IsOpenVisible = false; SetOpenCaption(); PatchDeleted = true; } ForceClose(); PatchDeleted = false; } } CloseCommand = ReactiveCommand.Create(() => { ForceClose(); }).DisposeWith(disposables); OpenCommand = ReactiveCommand.Create(() => { IsOpen = true; }).DisposeWith(disposables); EnableCommand = ReactiveCommand.Create(() => { syncPatchState(); }).DisposeWith(disposables); DisableCommand = ReactiveCommand.Create(() => { syncPatchState(); }).DisposeWith(disposables); DeleteCommand = ReactiveCommand.CreateFromTask(() => { return(deletePatch()); }).DisposeWith(disposables); base.OnActivated(disposables); }