void UpdateForItemInternal2(IContent item) { _target = item; var mission = (Mission)item; var installAction = GetAsyncItem(Install); installAction.IsVisible = !mission.IsLocal; installAction.Name = ModController.ConvertState(mission.State); GetAsyncItem(Publish) .IsVisible = mission.IsLocal; var hasPackageName = !string.IsNullOrWhiteSpace(mission.PackageName); var controller = mission.Controller; var packageItem = controller.Package; var hasPackage = packageItem != null && packageItem.Current != null; GetItem(ShowInfo) .IsVisible = hasPackageName; GetItem(OpenInExplorer) .IsVisible = mission.IsLocal || mission.Controller.IsInstalled; }
public ModBarMenu(ModLibraryViewModel library) : base(library) { this.WhenAnyValue(x => x.CurrentItem.Controller.IsInstalled, x => x.CurrentItem.State) .Select(x => new { CurrentItem, x }) .Subscribe(info => { Items.Where(x => x.AsyncAction == Uninstall) // || x.AsyncAction == LaunchMod .ForEach(x => x.IsVisible = info.x.Item1); var installAction = GetAsyncItem(Diagnose); installAction.Name = ModController.ConvertState(info.x.Item2); installAction.IsVisible = installAction.Name != null && !(info.CurrentItem is LocalMod); }); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => value == null ? null : ModController.ConvertState((ContentState)value);