Exemple #1
0
        public IActionResult Index()
        {
            var viewModel = new GameLibraryViewModel
            {
                Username = "******",
                PcGames  = new[]
                {
                    new PcGame
                    {
                        Name     = "The Witcher 3",
                        Platform = PcPlatform.Windows
                    },
                    new PcGame
                    {
                        Name     = "Mass Effect 2",
                        Platform = PcPlatform.Windows
                    }
                },
                ConsoleGames = new[] {
                    new ConsoleGame
                    {
                        Name    = "God of War",
                        Console = Console.PlayStation
                    },
                    new ConsoleGame
                    {
                        Name    = "Sea of Thieves",
                        Console = Console.Xbox
                    }
                }
            };

            return(View(viewModel));
        }
Exemple #2
0
        public GameLibraryPage()
        {
            InitializeComponent();
            AdMediator_0A5E56.Id                = "AdMediator-Id-0F3177E7-6EEB-43B3-84B0-CDC87AC71902";
            AdMediator_0A5E56.AdSdkError       += OnAdSdkError;
            AdMediator_0A5E56.AdMediatorFilled += OnAdFilled;
            AdMediator_0A5E56.AdMediatorError  += OnAdMediatorError;
            AdMediator_0A5E56.AdSdkEvent       += OnAdSdkEvent;

            DataContext = new GameLibraryViewModel();
            NoGameTextBlock.SetBinding(VisibilityProperty, new Binding {
                Path = new PropertyPath("ShowNoGameMessage"), Converter = new ShowNoGameMessageToVisibilityConverter()
            });
            ProgressPanel.SetBinding(VisibilityProperty, new Binding {
                Path = new PropertyPath("IsScanning"), Converter = new IsScanningToVisibilityConverter()
            });
        }
        public IActionResult Library(string sortOrder)
        {
            this.ViewBag.TitleSortParam = string.IsNullOrEmpty(sortOrder) ? "title_desc" : string.Empty;

            var userId = this.User.GetId();

            var        orderIds = this.ordersService.GetOrderIds(userId);
            List <int> gameIds  = this.GetGameIds(orderIds);

            var games     = this.gamesService.GetGamesFromOrder <GameInLibraryViewModel>(gameIds).OrderBy(x => x.Title);
            var viewModel = new GameLibraryViewModel {
                Collection = games,
            };

            if (sortOrder == "title_desc")
            {
                viewModel.Collection = viewModel.Collection
                                       .OrderByDescending(x => x.Title).ToList();
            }

            return(this.View(viewModel));
        }