public DownloadPackagesPage() { SwappedOut += Dispose; InitializeComponent(); _cacheService = Lib.IoC.GetConstant <ImageCacheService>(); ViewModel = Lib.IoC.Get <DownloadPackagesViewModel>(); ViewModel.SelectNextItem.AfterExecute += o => OpenPackagePreviewPage(SlideDirection.Right, SlideDirection.Left); ViewModel.SelectLastItem.AfterExecute += o => OpenPackagePreviewPage(SlideDirection.Left, SlideDirection.Right); ControllerSupport.SubscribeCustomInputs(ProcessEvents); }
/// <summary> /// Creates a viewmodel used to download a package. /// </summary> /// <param name="parent">The parent to create this viewmodel from. Copies currently selected package.</param> public DownloadPackagePreviewViewModel(DownloadPackagesViewModel parent) { Package = parent.SelectedResult; DownloadPackageStatus = parent.DownloadPackageStatus; DownloadModCommand = parent.DownloadModCommand; SelectNextItem = parent.SelectNextItem; SelectLastItem = parent.SelectLastItem; _cacheService = IoC.GetConstant <ImageCacheService>(); // Select default image if (Package.Images is { Length : > 0 })
/// <inheritdoc /> public DownloadPackageCommand(IDownloadablePackage?package, DownloadPackagesViewModel viewModel, ModConfigService modConfigService) { _package = package; _viewModel = viewModel; _modConfigService = modConfigService; }