Пример #1
0
    public async Task <GameTypeSelectionResult> GetGameTypeAsync()
    {
        // Get the available types
        var types = Services.App.GamesManager.GameManagers[Game].Keys.ToArray();

        // If only one type, return that
        if (types.Length == 1)
        {
            return new GameTypeSelectionResult()
                   {
                       CanceledByUser = false,
                       SelectedType   = types.First()
                   }
        }
        ;

        // Create the view model
        var vm = new GameTypeSelectionViewModel()
        {
            Title = Resources.App_SelectGameTypeHeader
        };

        // Enumerate the available types
        foreach (var type in types)
        {
            if (type == GameType.Win32)
            {
                vm.AllowWin32 = true;
            }
            else if (type == GameType.Steam)
            {
                vm.AllowSteam = true;
            }
            else if (type == GameType.WinStore)
            {
                vm.AllowWinStore = true;
            }
            else if (type == GameType.DosBox)
            {
                vm.AllowDosBox = true;
            }
            else if (type == GameType.EducationalDosBox)
            {
                vm.AllowEducationalDosBox = true;
            }
            else
            {
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }

        // Create and show the dialog and return the result
        return(await Services.UI.SelectGameTypeAsync(vm));
    }
Пример #2
0
 public Task <GameTypeSelectionResult> SelectGameTypeAsync(GameTypeSelectionViewModel gameTypeSelectionViewModel) => ShowDialogAsync(() => new GameTypeSelectionDialog(gameTypeSelectionViewModel));