Skip to content

Commit

Permalink
Installation Wizard (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
RevoLand committed Aug 9, 2019
1 parent ec0ea6c commit b5ae109
Show file tree
Hide file tree
Showing 23 changed files with 419 additions and 61 deletions.
Binary file modified Binaries/Steam Library Manager.exe
Binary file not shown.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Duplicate Game Finder/Cleaner for Steam libraries ([#73](https://github.com/RevoLand/Steam-Library-Manager/issues/73))
- Ability to Enable/Disable Library Support (Steam, Origin, Uplay) - ([#63](https://github.com/RevoLand/Steam-Library-Manager/issues/63))
- Library loading indicator ([#63](https://github.com/RevoLand/Steam-Library-Manager/issues/63))
- Installation Wizard ([#63](https://github.com/RevoLand/Steam-Library-Manager/issues/63))

### Changed

Expand Down
6 changes: 3 additions & 3 deletions Source/Steam Library Manager/Definitions/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ public static class Steam

public static string VdfFilePath = System.IO.Path.Combine(Properties.Settings.Default.steamInstallationPath, "config", "config.vdf");

public static bool IsStateChanging;
public static bool IsStateChanging, Loaded;
}

public static class Origin
{
public static string ConfigFilePath = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData), "Origin", "local.xml");
public static List<KeyValuePair<string, string>> AppIds = new List<KeyValuePair<string, string>>();

public static bool IsStateChanging;
public static bool IsStateChanging, Loaded;
}

public static class Uplay
{
public static string ConfigFilePath = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), "Ubisoft Game Launcher", "settings.yml");

public static bool IsStateChanging;
public static bool IsStateChanging, Loaded;
}
}
}
16 changes: 16 additions & 0 deletions Source/Steam Library Manager/Forms/InstallationWizard/Final.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<UserControl x:Class="Steam_Library_Manager.Forms.InstallationWizard.Final"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="500">
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<iconPacks:PackIconMaterial Kind="CheckAll" Height="48" Width="48" Margin="5, 0" />
<TextBlock TextWrapping="Wrap" FontSize="28">Installation is completed!</TextBlock>
</StackPanel>
<Button Name="CloseButton" HorizontalAlignment="Stretch" Content="Close" Height="50" Margin="0,10" Style="{StaticResource AccentedSquareButtonStyle}" Click="CloseButton_OnClick" />
</StackPanel>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Diagnostics;
using System.Windows;

namespace Steam_Library_Manager.Forms.InstallationWizard
{
/// <summary>
/// Interaction logic for Final.xaml
/// </summary>
public partial class Final
{
public Final()
{
InitializeComponent();
}

private void CloseButton_OnClick(object sender, RoutedEventArgs e)
{
try
{
Window.GetWindow(this)?.Close();
}
catch (Exception)
{
Debug.WriteLine("Failed to get window for installation wizard?");
}
}
}
}
68 changes: 68 additions & 0 deletions Source/Steam Library Manager/Forms/InstallationWizard/Library.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<UserControl x:Class="Steam_Library_Manager.Forms.InstallationWizard.Library"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:SLM="clr-namespace:Steam_Library_Manager"
mc:Ignorable="d"
d:DesignHeight="500" d:DesignWidth="800">
<GroupBox Header="Library Settings">
<StackPanel Orientation="Vertical">
<GroupBox Header="Steam">
<WrapPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal" Height="50" Margin="0, 5, 0, 0">
<TextBox Width="300" Text="{SLM:SettingBinding steamInstallationPath}" IsReadOnly="True" mah:TextBoxHelper.Watermark="Steam Installation Path" mah:TextBoxHelper.UseFloatingWatermark="True" />
<Button Name="SteamInstallationPathSelector" Margin="5,0,0,0" Width="60" Content="{iconPacks:Material Kind=FolderOpen}" Click="SteamInstallationPathSelector_OnClick" />
</StackPanel>
<mah:ToggleSwitch ThumbIndicatorBrush="{DynamicResource AccentColorBrush}" Margin="0, 5" Header="Steam Library Support" IsChecked="{SLM:SettingBinding Steam_IsEnabled}" Style="{StaticResource MahApps.Metro.Styles.ToggleSwitch.Win10}">
<mah:ToggleSwitch.ToolTip>
<ToolTip>
<StackPanel>
<TextBlock FontWeight="Bold" Text="Steam Library Support" />
<TextBlock Text="Enables/Disables Steam Library functionality for SLM" />
</StackPanel>
</ToolTip>
</mah:ToggleSwitch.ToolTip>
</mah:ToggleSwitch>
</WrapPanel>
</GroupBox>
<GroupBox Header="Origin">
<mah:ToggleSwitch ThumbIndicatorBrush="{DynamicResource AccentColorBrush}" Margin="5" Header="Origin Library Support" IsChecked="{SLM:SettingBinding Origin_IsEnabled}" Style="{StaticResource MahApps.Metro.Styles.ToggleSwitch.Win10}">
<mah:ToggleSwitch.ToolTip>
<ToolTip>
<StackPanel>
<TextBlock FontWeight="Bold" Text="Origin Library Support" />
<TextBlock Text="Enables/Disables Origin Library functionality for SLM" />
</StackPanel>
</ToolTip>
</mah:ToggleSwitch.ToolTip>
</mah:ToggleSwitch>
</GroupBox>
<GroupBox Header="Uplay">
<WrapPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal" Height="50" Margin="0, 5, 0, 0">
<TextBox Width="300" Text="{SLM:SettingBinding UplayExePath}" IsReadOnly="True" mah:TextBoxHelper.Watermark="Uplay Executable Path" mah:TextBoxHelper.UseFloatingWatermark="True" />
<Button Name="UplayExecutablePathSelector" Margin="5,0,0,0" Width="60" Content="{iconPacks:Material Kind=FileFind}" Click="UplayExecutablePathSelector_OnClick" />
</StackPanel>
<StackPanel Orientation="Horizontal" Height="50" Margin="0, 5, 0, 0">
<TextBox Width="300" Text="{SLM:SettingBinding UplayDbPath}" IsReadOnly="True" mah:TextBoxHelper.Watermark="Uplay Database File Path" mah:TextBoxHelper.UseFloatingWatermark="True" />
<Button Name="UplayDbPathSelector" Margin="5,0,0,0" Width="60" Content="{iconPacks:Material Kind=FileFind}" Click="UplayDbPathSelector_OnClick" />
<Button Name="UplayDbPathClearButton" Margin="5,0,0,0" Width="60" Content="{iconPacks:Material Kind=Close}" Click="UplayDbPathClearButton_OnClick" />
</StackPanel>
<mah:ToggleSwitch ThumbIndicatorBrush="{DynamicResource AccentColorBrush}" Margin="5" Header="Uplay Library Support" IsChecked="{SLM:SettingBinding Uplay_IsEnabled}" Style="{StaticResource MahApps.Metro.Styles.ToggleSwitch.Win10}">
<mah:ToggleSwitch.ToolTip>
<ToolTip>
<StackPanel>
<TextBlock FontWeight="Bold" Text="Uplay Library Support" />
<TextBlock Text="Enables/Disables Uplay Library functionality for SLM" />
</StackPanel>
</ToolTip>
</mah:ToggleSwitch.ToolTip>
</mah:ToggleSwitch>
</WrapPanel>
</GroupBox>
</StackPanel>
</GroupBox>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
using Microsoft.Win32;
using System;
using System.IO;
using System.Windows;

namespace Steam_Library_Manager.Forms.InstallationWizard
{
/// <summary>
/// Interaction logic for Steam.xaml
/// </summary>
public partial class Library
{
private static readonly NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();

public Library()
{
InitializeComponent();
}

private void SteamInstallationPathSelector_OnClick(object sender, RoutedEventArgs e)
{
var steamPathSelector = new OpenFileDialog()
{
Filter = "Steam Executable (Steam.exe)|Steam.exe"
};

if (steamPathSelector.ShowDialog() != true) return;

if (Directory.Exists(Path.GetDirectoryName(steamPathSelector.FileName)))
Properties.Settings.Default.steamInstallationPath = Path.GetDirectoryName(steamPathSelector.FileName);

if (!string.IsNullOrEmpty(Properties.Settings.Default.steamInstallationPath))
{
Definitions.Global.Steam.VdfFilePath = Path.Combine(Properties.Settings.Default.steamInstallationPath, "config", "config.vdf");
}
}

private void UplayExecutablePathSelector_OnClick(object sender, RoutedEventArgs e)
{
try
{
using (var dialog = new System.Windows.Forms.OpenFileDialog())
{
dialog.Filter = "Uplay executable file|Uplay.exe|All executable files (*.exe)|*.exe";
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
Properties.Settings.Default.UplayExePath = dialog.FileName;
}
}
}
catch (Exception ex)
{
Logger.Error(ex);
}
}

private async void UplayDbPathSelector_OnClick(object sender, RoutedEventArgs e)
{
try
{
using (var dialog = new System.Windows.Forms.OpenFileDialog())
{
dialog.Filter = "Uplay Database File|configurations";
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
Properties.Settings.Default.UplayDbPath = dialog.FileName;

if (File.Exists(Properties.Settings.Default.UplayDbPath))
{
await Functions.Uplay.InitializeUplayDb();
}
}
}
}
catch (Exception ex)
{
Logger.Error(ex);
}
throw new NotImplementedException();
}

private async void UplayDbPathClearButton_OnClick(object sender, RoutedEventArgs e)
{
try
{
Properties.Settings.Default.UplayDbPath = string.Empty;

await Functions.Uplay.InitializeUplayDb();
}
catch (Exception ex)
{
Logger.Error(ex);
}
}
}
}
48 changes: 48 additions & 0 deletions Source/Steam Library Manager/Forms/InstallationWizard/Welcome.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<UserControl x:Class="Steam_Library_Manager.Forms.InstallationWizard.Welcome"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:localization="clr-namespace:Gu.Localization;assembly=Gu.Localization"
xmlns:l="clr-namespace:Gu.Wpf.Localization;assembly=Gu.Wpf.Localization"
xmlns:SLM="clr-namespace:Steam_Library_Manager"
xmlns:Enums="clr-namespace:Steam_Library_Manager.Definitions.Enums"
xmlns:p="clr-namespace:Steam_Library_Manager.Properties"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="500">
<GroupBox Header="{l:Static p:Resources.Forms_Settings_GeneralSettings}">
<WrapPanel>
<TextBlock TextWrapping="Wrap">This installation wizard will help you set basics of SLM for first time use. Please start with selecting a default language, theme base and accent.</TextBlock>
<TextBlock TextWrapping="Wrap">Alternatively, you can close this window to use SLM's default options.</TextBlock>
<Separator Width="20" Height="30" Background="Transparent" />
<ComboBox BorderBrush="{DynamicResource AccentColorBrush}" Margin="0, 0, 5, 0" mah:TextBoxHelper.Watermark="{l:Static p:Resources.Forms_Settings_ThemeBase}" mah:TextBoxHelper.UseFloatingWatermark="True" HorizontalAlignment="Left" Height="50"
VerticalContentAlignment="Center" VerticalAlignment="Top" Width="240"
SelectedItem="{Binding Setting_BaseTheme}" ItemsSource="{SLM:EnumBindingSource {x:Type Enums:BaseTheme}}">
</ComboBox>

<ComboBox BorderBrush="{DynamicResource AccentColorBrush}" mah:TextBoxHelper.Watermark="{l:Static p:Resources.Forms_Settings_ThemeAccent}" mah:TextBoxHelper.UseFloatingWatermark="True" HorizontalAlignment="Left" Height="50"
VerticalContentAlignment="Center" VerticalAlignment="Top" Width="240" SelectedItem="{Binding Setting_ThemeAccent}"
ItemsSource="{SLM:EnumBindingSource {x:Type Enums:ThemeAccents}}">
</ComboBox>

<ComboBox BorderBrush="{DynamicResource AccentColorBrush}" Margin="0, 5" mah:TextBoxHelper.Watermark="{l:Static p:Resources.Forms_Settings_Language}" mah:TextBoxHelper.UseFloatingWatermark="True"
VerticalContentAlignment="Center" VerticalAlignment="Top" Height="50" Width="240"
SelectedItem="{Binding Path=(localization:Translator.Culture)}" ItemsSource="{Binding Path=(localization:Translator.Cultures)}" SelectionChanged="Selector_OnSelectionChanged">
</ComboBox>
<!-- Check for Updates at Startup -->
<mah:ToggleSwitch ThumbIndicatorBrush="{DynamicResource AccentColorBrush}" Margin="5" Header="{l:Static p:Resources.Forms_Settings_CheckForUpdatesOnStartup}" OnLabel="Yes" OffLabel="No"
IsChecked="{SLM:SettingBinding CheckforUpdatesAtStartup}"
HorizontalAlignment="Left" VerticalAlignment="Top" Style="{StaticResource MahApps.Metro.Styles.ToggleSwitch.Win10}">
<mah:ToggleSwitch.ToolTip>
<ToolTip>
<StackPanel>
<TextBlock FontWeight="Bold" Text="Check for Updates at Startup" />
<TextBlock Text="Attempts for a new version control at startup." />
</StackPanel>
</ToolTip>
</mah:ToggleSwitch.ToolTip>
</mah:ToggleSwitch>
</WrapPanel>
</GroupBox>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Windows.Controls;

namespace Steam_Library_Manager.Forms.InstallationWizard
{
/// <summary>
/// Interaction logic for Welcome.xaml
/// </summary>
public partial class Welcome
{
public Welcome()
{
InitializeComponent();
}

private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
Properties.Settings.Default.Language = Gu.Localization.Translator.CurrentCulture.TwoLetterISOLanguageName;
}
}
}
26 changes: 26 additions & 0 deletions Source/Steam Library Manager/Forms/InstallationWizard/Wizard.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<mah:MetroWindow x:Class="Steam_Library_Manager.Forms.InstallationWizard.Wizard"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Steam_Library_Manager.Forms.InstallationWizard"
xmlns:controls="clr-namespace:MvvmWizard.Controls;assembly=MvvmWizard"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d"
MinHeight="650" MinWidth="500" Height="650" Width="500" Closing="Wizard_OnClosing"
WindowStyle="None" ShowMaxRestoreButton="False" ShowTitleBar="True" ShowMinButton="False" WindowStartupLocation="CenterScreen"
Title="Steam Library Manager: Installation Wizard" TitleCharacterCasing="Normal">
<controls:Wizard Name="WizardControl" SummaryVisibility="Visible" AllowNavigationOnSummaryItemClick="True" TransitionButtonsHorizontalAlignment="Center" SummaryHorizontalAlignment="Center" SummaryMargin="10,0">
<controls:WizardStep BackButtonVisibility="Collapsed">
<local:Welcome />
</controls:WizardStep>

<controls:WizardStep>
<local:Library />
</controls:WizardStep>

<controls:WizardStep SkipButtonVisibility="Collapsed" ForwardButtonVisibility="Collapsed">
<local:Final />
</controls:WizardStep>
</controls:Wizard>
</mah:MetroWindow>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.ComponentModel;

namespace Steam_Library_Manager.Forms.InstallationWizard
{
/// <summary>
/// Interaction logic for Wizard.xaml
/// </summary>
public partial class Wizard
{
public Wizard()
{
InitializeComponent();
}

private void Wizard_OnClosing(object sender, CancelEventArgs e)
{
Properties.Settings.Default.InstallationWizardShown = true;
}
}
}
2 changes: 1 addition & 1 deletion Source/Steam Library Manager/Forms/Main.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Title="Steam Library Manager" Icon="/Steam Library Manager;component/Resources/slm-icon.ico" Height="800" Width="985" MinHeight="800" MinWidth="985"
Loaded="MainForm_Loaded" Closing="MainForm_ClosingAsync"
ShowTitleBar="False" GlowBrush="Black" NonActiveGlowBrush="Black" BorderBrush="{DynamicResource AccentColorBrush}" BorderThickness="1"
RightWindowCommandsOverlayBehavior="Always" SaveWindowPosition="True">
RightWindowCommandsOverlayBehavior="Always" SaveWindowPosition="True" WindowTransitionsEnabled="False">
<controls:MetroWindow.RightWindowCommands>
<controls:WindowCommands>
<Button Content="{l:Static p:Resources.Forms_Main_Donate}" Click="RightWindowCommands_DonateButton_Click">
Expand Down
Loading

0 comments on commit b5ae109

Please sign in to comment.