Launching games

Launching games via parameter and implemented a basic list of games
UWPTest
Brian Lima 8 years ago
parent 1c52ba21ad
commit 5db1d597ee

@ -25,6 +25,11 @@ namespace UWPHook
} }
private ObservableCollection<Game> _games; private ObservableCollection<Game> _games;
public int length()
{
return this._games.Count;
}
public ObservableCollection<Game> games public ObservableCollection<Game> games
{ {

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -24,30 +25,37 @@ namespace UWPHook
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
if (Environment.GetCommandLineArgs() != null)
{
}
// games = new List<GameModel>();
// for (int i = 0; i < 10; i++)
// {
// games.Add(new GameModel { game_alias = "sajufhsaduifhuisdsdgbuigduisaguidsguisaguiasguidasg", game_path = "sajufhsaduifhuisdsdgbuigduisaguidsguisaguiasguidasgx" });
// }
} }
private void Window_Loaded(object sender, RoutedEventArgs e) private void Window_Loaded(object sender, RoutedEventArgs e)
{ {
games = new GameModel(); games = new GameModel();
listView.ItemsSource = games.games; listView.ItemsSource = games.games;
var argument = Environment.GetCommandLineArgs();
string argumentGame = "";
for (int i = 1; i < argument.Length; i++)
{
argumentGame += argument[i] + " ";
}
if (argument != null)
{
foreach (Game game in games.games)
{
if (game.game_alias.ToLower() == argumentGame.ToLower().Trim())
{
Process.Start(@"shell:AppsFolder\" + game.game_path);
}
}
}
} }
private void addButton_Click(object sender, RoutedEventArgs e) private void addButton_Click(object sender, RoutedEventArgs e)
{ {
games.Store(); games.Store();
games.Add(new Game{ game_alias = alias_textBox.Text, game_path = path_textBox.Text }); games.Add(new Game { game_alias = alias_textBox.Text, game_path = path_textBox.Text });
} }
} }
} }

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartArguments>forza</StartArguments> <StartArguments>forza horizon 3</StartArguments>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

Binary file not shown.

Binary file not shown.

@ -1 +1 @@
[{"game_alias":"teste","game_path":"teste"},{"game_alias":"teste","game_path":"teste"},{"game_alias":"teste","game_path":"teste"},{"game_alias":"teste","game_path":"teste"},{"game_alias":"teste","game_path":"teste"}] [{"game_alias":"Forza Apex","game_path":"Microsoft.ApexPG_8wekyb3d8bbwe!forzamotorsportapex"},{"game_alias":"Forza Horizon 3", "game_path":"Microsoft.OpusPG_8wekyb3d8bbwe!App"},{"game_alias":"Killer Instinct","game_path":"Microsoft.KillerInstinct-Win10_8wekyb3d8bbwe!KillerInstinct.App"},{"game_alias":"Minecraft","game_path":"Microsoft.MinecraftUWP_8wekyb3d8bbwe!App"}]

@ -1 +1 @@
[{"game_alias":"teste","game_path":"teste"},{"game_alias":"teste","game_path":"teste"},{"game_alias":"teste","game_path":"teste"},{"game_alias":"teste","game_path":"teste"},{"game_alias":"teste","game_path":"teste"}] [{"game_alias":"Forza Apex","game_path":"Microsoft.ApexPG_8wekyb3d8bbwe!forzamotorsportapex"},{"game_alias":"Forza Horizon 3", "game_path":"Microsoft.OpusPG_8wekyb3d8bbwe!App"},{"game_alias":"Killer Instinct","game_path":"Microsoft.KillerInstinct-Win10_8wekyb3d8bbwe!KillerInstinct.App"},{"game_alias":"Minecraft","game_path":"Microsoft.MinecraftUWP_8wekyb3d8bbwe!App"}]

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save