コード例 #1
0
        public TrayIconContextMenu(IPlayShellViewModel playShellViewModel) {
            _psvm = playShellViewModel;

            Items.InsertRange(0, new[] {
                new RecentContextMenu(),
                new MenuItem {IsSeparator = true}
            });
        }
コード例 #2
0
        public OptionsMenuViewModel(IPlayShellViewModel playShellViewModel) {
            _shellViewModel = playShellViewModel;
            _softwareUpdate = _shellViewModel.SoftwareUpdate;
            _factory = _shellViewModel.Factory;
            _settings = _shellViewModel.Settings;

            OptionsMenu = new OptionsMenu(this);

            this.SetCommand(x => x.OptionsMenuCommand).Subscribe(x => OptionsMenu.IsOpen = !OptionsMenu.IsOpen);
        }
コード例 #3
0
        public TrayIconContextMenu(IPlayShellViewModel playShellViewModel)
        {
            _psvm = playShellViewModel;

            Items.InsertRange(0, new[] {
                new RecentContextMenu(),
                new MenuItem {
                    IsSeparator = true
                }
            });
        }
コード例 #4
0
        public OptionsMenuViewModel(IPlayShellViewModel playShellViewModel)
        {
            _shellViewModel = playShellViewModel;
            _softwareUpdate = _shellViewModel.SoftwareUpdate;
            _factory        = _shellViewModel.Factory;
            _settings       = _shellViewModel.Settings;

            OptionsMenu = new OptionsMenu(this);

            this.SetCommand(x => x.OptionsMenuCommand).Subscribe(x => OptionsMenu.IsOpen = !OptionsMenu.IsOpen);
        }
コード例 #5
0
        public DashboardViewModel(IPlayShellViewModel screen) {
            HostScreen = screen;

            ReactiveCommand.CreateAsyncTask(x => {
                screen.Content.GoGames();
                return screen.Router.Navigate.ExecuteAsyncTask(screen.Content);
            }).SetNewCommand(this, x => x.GoGames);

            ReactiveCommand.CreateAsyncTask(x => {
                screen.Content.GoHome();
                return screen.Router.Navigate.ExecuteAsyncTask(screen.Content);
            }).SetNewCommand(this, x => x.GoDiscovery);
        }
コード例 #6
0
        public DashboardViewModel(IPlayShellViewModel screen)
        {
            HostScreen = screen;

            ReactiveCommand.CreateAsyncTask(x => {
                screen.Content.GoGames();
                return(screen.Router.Navigate.ExecuteAsyncTask(screen.Content));
            }).SetNewCommand(this, x => x.GoGames);

            ReactiveCommand.CreateAsyncTask(x => {
                screen.Content.GoHome();
                return(screen.Router.Navigate.ExecuteAsyncTask(screen.Content));
            }).SetNewCommand(this, x => x.GoDiscovery);
        }
コード例 #7
0
        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;
            });
        }