public ContentViewModel(IPlayShellViewModel shellVM, GamesViewModel games, ServersViewModel servers, MissionsViewModel missions, ModsViewModel mods, HomeViewModel home, IUpdateManager updateManager, Func <RepoAppsContextMenu> contextMenu, IViewModelFactory factory, IDialogManager dialogManager) { _dialogManager = dialogManager; HostScreen = shellVM; Games = games; Servers = servers; Missions = missions; Mods = mods; Home = home; UpdateManager = updateManager; Factory = factory; RepoAppsContextMenu = contextMenu(); Activator = new ViewModelActivator(); _overlay = this.WhenAnyValue(x => x.ActiveItem.Overlay.ActiveItem) .ToProperty(this, x => x.Overlay, null, Scheduler.Immediate); var once = false; this.WhenActivated(d => { d(this.WhenAnyValue(x => x.ActiveItem.DisplayName) .BindTo(this, x => x.DisplayName)); d(Games.DoubleClickedCommand.Subscribe(GameBrowserDoubleClicked)); d(UpdateManager.StateChange.ObserveOn(RxApp.MainThreadScheduler).Subscribe(data => { var customModSet = data.Item1 as CustomCollection; RepoAppsContextMenu.Refresh(customModSet); if (((IIsEmpty)RepoAppsContextMenu).IsEmpty()) { IsServerAppsEnabled = 0; } else { IsServerAppsEnabled = null; } })); d(DomainEvilGlobal.SelectedGame.WhenAnyValue(x => x.ActiveGame) .Subscribe(GameChanged)); /* this.WhenAnyValue(x => x.ActiveGame.Mods.LibraryVM.ActiveItem) * .Where(x => x != null) * .Subscribe(ActiveItemChanged);*/ d(ReactiveCommand.Create().SetNewCommand(this, x => x.SwitchMenuOpen) .Select(_ => !IsMenuOpen) .BindTo(this, x => x.IsMenuOpen)); var observable = shellVM.WhenAnyValue(x => x.GridMode) .Where(x => x.HasValue) .Select(x => x.Value ? ViewType.Grid : ViewType.List); d(observable.BindTo(Missions, x => x.LibraryVM.ViewType)); d(observable.BindTo(Mods, x => x.LibraryVM.ViewType)); d(observable.BindTo(Servers, x => x.LibraryVM.ViewType)); if (once) { return; } InitializeModules(); once = true; }); }
public GameBarMenu(GamesViewModel library) { _library = library; }
public GameContextMenu(GamesViewModel gamesViewModel) { _gamesViewModel = gamesViewModel; }