Launching apps.

UWPTest
Brian Lima 8 years ago
parent 2aaafa4a48
commit 7869224748

@ -23,7 +23,15 @@ namespace UWPHook
{
var mgr = new ApplicationActivationManager();
uint processId;
mgr.ActivateApplication(uri, null, ActivateOptions.None, out processId);
try
{
mgr.ActivateApplication(uri, null, ActivateOptions.None, out processId);
}
catch (Exception e)
{
throw new Exception("Error while trying to launch your app." + Environment.NewLine + e.Message);
}
id = (int)processId;
}

@ -15,6 +15,7 @@ using VDFParser;
using VDFParser.Models;
using SharpSteam;
using System.IO;
using System.Threading;
namespace UWPHook
{
@ -30,7 +31,37 @@ namespace UWPHook
InitializeComponent();
Apps = new AppEntryModel();
listGames.ItemsSource = Apps.Entries;
this.Title = string.Join(";", Environment.GetCommandLineArgs());
//If null or 1, the app was launched normally
if (Environment.GetCommandLineArgs() != null)
{
//When length is 1, the only argument is the path where the app is installed
if (Environment.GetCommandLineArgs().Length > 1)
{
Launcher();
}
}
}
private void Launcher()
{
this.Title = "UWPHook: Playing a game";
//Hide the window so the app is launched seamless
this.Hide();
try
{
//The only other parameter Steam will send is the app AUMID
AppManager.LaunchUWPApp(Environment.GetCommandLineArgs()[1]);
while (AppManager.IsRunning())
{
Thread.Sleep(5000);
}
}
catch (Exception e)
{
this.Show();
MessageBox.Show(e.Message, "UWPHook", MessageBoxButton.OK, MessageBoxImage.Warning);
}
}
private void ExportButton_Click(object sender, RoutedEventArgs e)
@ -80,6 +111,7 @@ namespace UWPHook
foreach (var app in installedApps)
{
//Remove end lines from the String and split both values
var valor = app.Replace("\r\n", "").Split('|');
if (!String.IsNullOrEmpty(valor[0]))
{

@ -67,7 +67,6 @@ namespace UWPHook
}
catch (Exception ex)
{
throw new Exception("Error while trying to launch your game" + Environment.NewLine + ex.Message);
}
break;
}

@ -0,0 +1,28 @@
namespace UWPHook.Properties {
// This class allows you to handle specific events on the settings class:
// The SettingChanging event is raised before a setting's value is changed.
// The PropertyChanged event is raised after a setting's value is changed.
// The SettingsLoaded event is raised after the setting values are loaded.
// The SettingsSaving event is raised before the setting values are saved.
internal sealed partial class Settings {
public Settings() {
// // To add event handlers for saving and changing settings, uncomment the lines below:
//
// this.SettingChanging += this.SettingChangingEventHandler;
//
// this.SettingsSaving += this.SettingsSavingEventHandler;
//
}
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
// Add code to handle the SettingChangingEvent event here.
}
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
// Add code to handle the SettingsSaving event here.
}
}
}

@ -99,6 +99,7 @@
<DependentUpon>GamesWindow.xaml</DependentUpon>
</Compile>
<Compile Include="ScriptManager.cs" />
<Compile Include="Settings.cs" />
<Page Include="GamesWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

Loading…
Cancel
Save