Implement Full screen launcher, bum .net version

SteamWorksNet
Brian Lima 6 years ago
parent bc6efcd7d9
commit 976576761d

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<configSections> <configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="UWPHook.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> <section name="UWPHook.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup> </sectionGroup>
</configSections> </configSections>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/>
</startup> </startup>
<userSettings> <userSettings>
<UWPHook.Properties.Settings> <UWPHook.Properties.Settings>
@ -14,7 +14,7 @@
<value>False</value> <value>False</value>
</setting> </setting>
<setting name="TargetLanguage" serializeAs="String"> <setting name="TargetLanguage" serializeAs="String">
<value /> <value/>
</setting> </setting>
<setting name="Seconds" serializeAs="String"> <setting name="Seconds" serializeAs="String">
<value>5</value> <value>5</value>
@ -24,4 +24,4 @@
</setting> </setting>
</UWPHook.Properties.Settings> </UWPHook.Properties.Settings>
</userSettings> </userSettings>
</configuration> </configuration>

@ -0,0 +1,43 @@
<Window x:Class="UWPHook.FullScreenLauncher"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:local="clr-namespace:UWPHook"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
Background="{DynamicResource MaterialDesignPaper}"
TextElement.FontWeight="Medium"
TextElement.FontSize="14"
FontFamily="Segoe UI Light"
mc:Ignorable="d"
WindowStyle="None"
WindowState="Maximized"
Title="UWPHook" Height="600" Width="800" Icon="/Resources/hook2.ico">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="29*"/>
<RowDefinition Height="147*"/>
<RowDefinition Height="65.6"/>
</Grid.RowDefinitions>
<materialDesign:ColorZone Padding="16" materialDesign:ShadowAssist.ShadowDepth="Depth2" Mode="PrimaryMid" Height="80" Margin="0,0,-0.4,0">
<Label x:Name="label1" Content="Welcome to UWPHook, the easier way to add UWP games and apps to Steam!" HorizontalAlignment="Left" Margin="172,-14,0,0" VerticalAlignment="Top" Foreground="#DDFFFFFF"/>
</materialDesign:ColorZone>
<Image x:Name="image" HorizontalAlignment="Left" Width="178" Height="80" VerticalAlignment="Top" Source="Resources/WhiteTransparent.png" Stretch="UniformToFill" ToolTip="Welcome to UWPHook, add your UWP apps and games to Steam!"/>
<ProgressBar
IsIndeterminate="True"
Style="{StaticResource MaterialDesignCircularProgressBar}"
Value="50" Height="Auto" Width="Auto" Grid.Row="1" Margin="347,205.8,346.6,116"/>
<TextBlock x:Name="textLaunch" Margin="10,72.8,9.6,0" Grid.Row="1" TextWrapping="Wrap" Text="" VerticalAlignment="Top" TextAlignment="Center" FontSize="24" Height="32"/>
<TextBlock HorizontalAlignment="Left" Margin="10,9,0,0" Grid.Row="2" TextWrapping="Wrap" Text="Made for you with &lt;3, code and coffee by Brian Lima @brianostorm, do you like my work? Support me by downloading my other projects or by paying me a coffee via paypal!" VerticalAlignment="Top" Width="633" Height="47" TextAlignment="Justify"/>
<materialDesign:Chip Content="Paypal donate"
IconBackground="{DynamicResource PrimaryHueDarkBrush}"
IconForeground="{DynamicResource PrimaryHueDarkForegroundBrush}"
Margin="0,12,9.6,18.6" Click="Chip2_Click" HorizontalAlignment="Right" Height="Auto" Grid.Row="2" Width="136">
<materialDesign:Chip.Icon>
<materialDesign:PackIcon Kind="Coffee"></materialDesign:PackIcon>
</materialDesign:Chip.Icon>
</materialDesign:Chip>
</Grid>
</Window>

@ -0,0 +1,62 @@
using MaterialDesignThemes.Wpf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace UWPHook
{
/// <summary>
/// Interaction logic for FullScreenLauncher.xaml
/// </summary>
public partial class FullScreenLauncher : Window
{
public PaletteHelper pallet;
public FullScreenLauncher()
{
InitializeComponent();
textLaunch.Text = GetLauncherText();
pallet = new PaletteHelper();
pallet.SetLightDark(true);
}
string GetLauncherText()
{
int n = DateTime.Now.Second;
if (n >= 0 && n <= 10)
{
return "Hold on, i'm making your stream full screen!";
}
else if (n > 10 && n <= 20)
{
return "Waiting Steam in-home Streamming to catch up";
}
else if (n > 20 && n <= 30)
{
return "Starting Stream in a few seconds!";
}
else if (n > 30 && n <= 40)
{
return "Let's get this game started!";
}
else if (n > 40 && n <= 50)
{
return "Don't forget to check for updates at github.com/brianlima";
}
else
{
return "Good game, enjoy!";
}
}
}
}

@ -6,6 +6,7 @@ using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using VDFParser; using VDFParser;
using VDFParser.Models; using VDFParser.Models;
@ -19,6 +20,7 @@ namespace UWPHook
{ {
AppEntryModel Apps; AppEntryModel Apps;
BackgroundWorker bwrLoad, bwrSave; BackgroundWorker bwrLoad, bwrSave;
Timer ticker;
public GamesWindow() public GamesWindow()
{ {
@ -31,23 +33,31 @@ namespace UWPHook
//When length is 1, the only argument is the path where the app is installed //When length is 1, the only argument is the path where the app is installed
if (Environment.GetCommandLineArgs().Length > 1) if (Environment.GetCommandLineArgs().Length > 1)
{ {
Launcher(); LauncherAsync();
} }
} }
} }
private void Launcher() /// <summary>
/// We have to wait a little untill Steam catches up, otherwise it will stream a black screen
/// </summary>
/// <returns></returns>
async Task LaunchDelay()
{ {
await Task.Delay(10000);
}
private async Task LauncherAsync()
{
FullScreenLauncher launcher = null;
//So, for some reason, Steam is now stopping in-home streaming if the launched app is minimized, so not hiding UWPHook's window is doing the trick for now //So, for some reason, Steam is now stopping in-home streaming if the launched app is minimized, so not hiding UWPHook's window is doing the trick for now
if (Properties.Settings.Default.StreamMode) if (Properties.Settings.Default.StreamMode)
{ {
this.Show(); this.Hide();
this.WindowStyle = WindowStyle.None; launcher = new FullScreenLauncher();
this.WindowState = WindowState.Maximized; launcher.Show();
this.Title = "UWPHook: Streaming a game";
this.label.Content = "UWPHook is streaming your game, fasten your seatbelts.";
Thread.Sleep(10000); await LaunchDelay();
} }
else else
{ {
@ -88,6 +98,11 @@ namespace UWPHook
ScriptManager.RunScript("Set - WinUILanguageOverride " + currentLanguage); ScriptManager.RunScript("Set - WinUILanguageOverride " + currentLanguage);
} }
if (launcher != null)
{
launcher.Close();
}
//The user has probably finished using the app, so let's close UWPHook to keep the experience clean //The user has probably finished using the app, so let's close UWPHook to keep the experience clean
this.Close(); this.Close();
} }

@ -19,7 +19,7 @@ namespace UWPHook.Properties {
// class via a tool like ResGen or Visual Studio. // class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen // To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project. // with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Resources { public class Resources {
@ -62,17 +62,19 @@ namespace UWPHook.Properties {
/// <summary> /// <summary>
/// Looks up a localized string similar to $installedapps = get-AppxPackage /// Looks up a localized string similar to $installedapps = get-AppxPackage
/// ///$invalidNames = &apos;*ms-resource*&apos;, &apos;*DisplayName*&apos;
///$aumidList = @() ///$aumidList = @()
///
///foreach ($app in $installedapps) ///foreach ($app in $installedapps)
///{ ///{
///    foreach ($id in (Get-AppxPackageManifest $app).package.applications.application.id) /// try {
///    { /// if(-not $app.IsFramework){
///        $aumidList += $app.name + &quot;|&quot; + $app.packagefamilyname + &quot;!&quot; + $id + &quot;;&quot; /// foreach ($id in (Get-AppxPackageManifest $app).package.applications.application.id)
///    } /// {
///} /// $appx = Get-AppxPackageManifest $app;
/// $name = $appx.Package.Properties.DisplayName;
/// ///
///$aumidList. /// if($name -like &apos;*DisplayName*&apos; -or $name -like &apos;*ms-resourc [rest of string was truncated]&quot;;.
/// </summary> /// </summary>
public static string GetAUMIDScript { public static string GetAUMIDScript {
get { get {

@ -12,7 +12,7 @@ namespace UWPHook.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0")]
public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UWPHook</RootNamespace> <RootNamespace>UWPHook</RootNamespace>
<AssemblyName>UWPHook</AssemblyName> <AssemblyName>UWPHook</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
@ -29,6 +29,7 @@
<IsWebBootstrapper>false</IsWebBootstrapper> <IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@ -96,6 +97,9 @@
</ApplicationDefinition> </ApplicationDefinition>
<Compile Include="AppEntry.cs" /> <Compile Include="AppEntry.cs" />
<Compile Include="AppEntryModel.cs" /> <Compile Include="AppEntryModel.cs" />
<Compile Include="FullScreenLauncher.xaml.cs">
<DependentUpon>FullScreenLauncher.xaml</DependentUpon>
</Compile>
<Compile Include="GamesWindow.xaml.cs"> <Compile Include="GamesWindow.xaml.cs">
<DependentUpon>GamesWindow.xaml</DependentUpon> <DependentUpon>GamesWindow.xaml</DependentUpon>
</Compile> </Compile>
@ -104,6 +108,9 @@
<Compile Include="SettingsWindow.xaml.cs"> <Compile Include="SettingsWindow.xaml.cs">
<DependentUpon>SettingsWindow.xaml</DependentUpon> <DependentUpon>SettingsWindow.xaml</DependentUpon>
</Compile> </Compile>
<Page Include="FullScreenLauncher.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="GamesWindow.xaml"> <Page Include="GamesWindow.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>

Loading…
Cancel
Save