Compare commits

...
7 Commits
Author SHA1 Message Date
Alexandru Macocian 0683504330 Minor gui fixes.
Set default webpages in application configuration.
Option to auto-launch gwtoolbox.
2021-04-15 09:57:19 +02:00
Alexandru Macocian 98bd1b2de6 Periodically check for updates.
Reorder settings in the settings category view.
2021-04-14 15:15:56 +02:00
Alexandru Macocian c169ca1684 Menu to manage guildwars executables. 2021-04-14 15:01:43 +02:00
Alexandru Macocian 88214ea166 Darken views with text to improve readability.
Better define the reason why guildwars failed to launch.
Auto set to default when adding first account.
Auto set another default when removing the default account.
2021-04-14 14:12:38 +02:00
Alexandru Macocian 4bdcd1a811 Changed version control to check all subversions. 2021-04-14 13:50:15 +02:00
Alexandru Macocian fa4f665a3e Fixed a bug with updating account details. 2021-04-13 21:28:49 +02:00
Alexandru Macocian e59e022c0a Updated to 0.5.0 2021-04-13 21:13:38 +02:00
30 changed files with 570 additions and 128 deletions
@@ -6,16 +6,18 @@ namespace Daybreak.Configuration
{
public sealed class ApplicationConfiguration
{
[JsonProperty("GamePath")]
public string GamePath { get; set; }
[JsonProperty("ToolboxPath")]
public string ToolboxPath { get; set; }
[JsonProperty("ToolboxAutoLaunch")]
public bool ToolboxAutoLaunch { get; set; }
[JsonProperty("LeftBrowserDefault")]
public string LeftBrowserDefault { get; set; }
public string LeftBrowserDefault { get; set; } = "https://gwpvx.fandom.com/wiki/PvX_wiki";
[JsonProperty("RightBrowserDefault")]
public string RightBrowserDefault { get; set; }
public string RightBrowserDefault { get; set; } = "https://wiki.guildwars.com/wiki/Quick_access_links";
[JsonProperty("GuildwarsPaths")]
public List<GuildwarsPath> GuildwarsPaths { get; set; } = new();
[JsonProperty("ProtectedLoginCredentials")]
public List<ProtectedLoginCredentials> ProtectedLoginCredentials { get; set; }
public List<ProtectedLoginCredentials> ProtectedLoginCredentials { get; set; } = new();
[JsonProperty("AddressBarReadonly")]
public bool AddressBarReadonly { get; set; } = true;
[JsonProperty("ExperimentalFeatures")]
@@ -1,7 +1,12 @@
namespace Daybreak.Configuration
using Newtonsoft.Json;
namespace Daybreak.Configuration
{
public sealed class ExperimentalFeatures
{
[JsonProperty("MultiLaunchSupport")]
public bool MultiLaunchSupport { get; set; }
[JsonProperty("ToolboxAutoLaunchDelay")]
public int ToolboxAutoLaunchDelay { get; set; } = 5000;
}
}
@@ -1,4 +1,4 @@
using Daybreak.Services.ApplicationDetection;
using Daybreak.Services.ApplicationLauncher;
using Daybreak.Services.ApplicationLifetime;
using Daybreak.Services.Bloogum;
using Daybreak.Services.Configuration;
@@ -26,7 +26,7 @@ namespace Daybreak.Configuration
serviceProducer.RegisterSingleton<ILogger, Logger>();
serviceProducer.RegisterSingleton<ApplicationLifetimeManager>();
serviceProducer.RegisterSingleton<ViewManager>();
serviceProducer.RegisterSingleton<IApplicationDetector, ApplicationDetector>();
serviceProducer.RegisterSingleton<IApplicationLauncher, ApplicationLauncher>();
serviceProducer.RegisterSingleton<IScreenshotProvider, ScreenshotProvider>();
serviceProducer.RegisterSingleton<IConfigurationManager, ConfigurationManager>();
serviceProducer.RegisterSingleton<IBloogumClient, BloogumClient>();
@@ -52,6 +52,7 @@ namespace Daybreak.Configuration
viewProducer.RegisterView<SettingsCategoryView>();
viewProducer.RegisterView<AccountsView>();
viewProducer.RegisterView<ExperimentalSettingsView>();
viewProducer.RegisterView<ExecutablesView>();
}
}
}
+2 -2
View File
@@ -31,13 +31,13 @@
<TextBlock FontSize="16" Text="Username:" Foreground="White" Margin="5" Grid.Row="0" HorizontalAlignment="Right"></TextBlock>
<TextBlock FontSize="16" Text="Password:" Foreground="White" Margin="5" Grid.Row="1" HorizontalAlignment="Right"></TextBlock>
<TextBlock FontSize="16" Text="Character name:" Foreground="White" Margin="5" Grid.Row="2" HorizontalAlignment="Right"></TextBlock>
<TextBox Text="{Binding ElementName=_this, Path=Username, Mode=TwoWay}" Foreground="White" Background="Transparent"
<TextBox Text="{Binding ElementName=_this, Path=Username, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Foreground="White" Background="Transparent"
BorderThickness="1" HorizontalAlignment="Stretch" Grid.Row="0" Grid.Column="1"
FontSize="16" TextChanged="UsernameTextbox_TextChanged" Margin="5"></TextBox>
<PasswordBox x:Name="PasswordBox" Foreground="White" Background="Transparent"
BorderThickness="1" HorizontalAlignment="Stretch" Grid.Row="1" Grid.Column="1"
FontSize="16" PasswordChanged="Passwordbox_PasswordChanged" Margin="5"></PasswordBox>
<TextBox Text="{Binding ElementName=_this, Path=CharacterName, Mode=TwoWay}" Foreground="White" Background="Transparent"
<TextBox Text="{Binding ElementName=_this, Path=CharacterName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Foreground="White" Background="Transparent"
BorderThickness="1" HorizontalAlignment="Stretch" Grid.Row="2" Grid.Column="1"
FontSize="16" TextChanged="CharacterNameTextbox_TextChanged" Margin="5"></TextBox>
</Grid>
+3 -2
View File
@@ -66,17 +66,18 @@ namespace Daybreak.Controls
private void UsernameTextbox_TextChanged(object sender, EventArgs e)
{
this.Username = sender.As<TextBox>()?.Text;
this.DataContext.As<LoginCredentials>().Username = this.Username;
}
private void CharacterNameTextbox_TextChanged(object sender, EventArgs e)
{
this.CharacterName = sender.As<TextBox>()?.Text;
this.DataContext.As<LoginCredentials>().CharacterName = this.CharacterName;
}
private void Passwordbox_PasswordChanged(object sender, EventArgs e)
{
this.Password = sender.As<PasswordBox>()?.Password;
this.DataContext.As<LoginCredentials>().Password = this.Password;
}
private void StarGlyph_Clicked(object sender, EventArgs e)
+14
View File
@@ -0,0 +1,14 @@
<UserControl x:Class="Daybreak.Controls.FileGlyph"
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:Daybreak.Controls"
mc:Ignorable="d"
x:Name="_this"
d:DesignHeight="450" d:DesignWidth="800">
<Viewbox>
<Path Fill="{Binding ElementName=_this, Path=Foreground, Mode=OneWay}"
Data="m52,0l-40,0c-6.627,0 -12,5.373 -12,12l0,72c0,6.627 5.373,12 12,12l55.875,0c6.627,0 12.125,-5.373 12.125,-12l0,-56c-4,-4 -22,-22 -28,-28zm0,11.178l16.709,16.822l-16.709,0l0,-16.822zm15.875,76.822l-55.875,0c-2.206,0 -4,-1.794 -4,-4l0,-72c0,-2.206 1.794,-4 4,-4l32,0l0,20l0,8l8,0l20,0l0,48c0,2.168 -1.889,4 -4.125,4z"></Path>
</Viewbox>
</UserControl>
+15
View File
@@ -0,0 +1,15 @@
using System.Windows.Controls;
namespace Daybreak.Controls
{
/// <summary>
/// Interaction logic for FileGlyph.xaml
/// </summary>
public partial class FileGlyph : UserControl
{
public FileGlyph()
{
InitializeComponent();
}
}
}
+11 -8
View File
@@ -8,14 +8,17 @@
x:Name="_this"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Rectangle x:Name="BackgroundEllipse" Fill="{Binding ElementName=_this, Path=Foreground, Mode=OneWay}" Visibility="Visible" Opacity="0.1" />
<Viewbox>
<StackPanel Orientation="Horizontal">
<Ellipse Fill="{Binding ElementName=_this, Path=Foreground, Mode=OneWay}" Height="1" Width="1"></Ellipse>
<Ellipse Fill="{Binding ElementName=_this, Path=Foreground, Mode=OneWay}" Height="1" Width="1"></Ellipse>
<Ellipse Fill="{Binding ElementName=_this, Path=Foreground, Mode=OneWay}" Height="1" Width="1"></Ellipse>
</StackPanel>
<Ellipse x:Name="BackgroundEllipse" Fill="{Binding ElementName=_this, Path=Foreground, Mode=OneWay}" Visibility="Visible" Opacity="0.1" />
<Viewbox Stretch="Fill">
<Grid>
<Ellipse Height="4" Width="4" StrokeThickness="0.2" Stroke="{Binding ElementName=_this, Path=Foreground, Mode=OneWay}"></Ellipse>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Ellipse Fill="{Binding ElementName=_this, Path=Foreground, Mode=OneWay}" Height="1" Width="1"></Ellipse>
<Ellipse Fill="{Binding ElementName=_this, Path=Foreground, Mode=OneWay}" Height="1" Width="1"></Ellipse>
<Ellipse Fill="{Binding ElementName=_this, Path=Foreground, Mode=OneWay}" Height="1" Width="1"></Ellipse>
</StackPanel>
</Grid>
</Viewbox>
<Rectangle Fill="Transparent" MouseEnter="Ellipse_MouseEnter" MouseLeave="Ellipse_MouseLeave" MouseLeftButtonDown="Ellipse_MouseLeftButtonDown"></Rectangle>
<Ellipse Fill="Transparent" MouseEnter="Ellipse_MouseEnter" MouseLeave="Ellipse_MouseLeave" MouseLeftButtonDown="Ellipse_MouseLeftButtonDown"></Ellipse>
</Grid>
</UserControl>
@@ -0,0 +1,43 @@
<UserControl x:Class="Daybreak.Controls.GuildwarsPathTemplate"
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:converters="clr-namespace:Daybreak.Converters"
xmlns:local="clr-namespace:Daybreak.Controls"
mc:Ignorable="d"
x:Name="_this"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<ResourceDictionary>
<converters:InverseBooleanConverter x:Key="InverseBooleanConverter"></converters:InverseBooleanConverter>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock FontSize="22" Text="Path:" Foreground="White" Margin="5" Grid.Row="0" HorizontalAlignment="Right"></TextBlock>
<TextBox Foreground="White" Background="Transparent" Text="{Binding ElementName=_this, Path=Path, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
BorderThickness="1" HorizontalAlignment="Stretch" Grid.Row="0" Grid.Column="1"
FontSize="22" TextChanged="TextBox_TextChanged" Margin="5"></TextBox>
</Grid>
<WrapPanel Grid.Column="1">
<local:FilePickerGlyph Width="30" Height="30" Foreground="White" VerticalAlignment="Top" Margin="5"
Clicked="FilePickerGlyph_Clicked"></local:FilePickerGlyph>
<local:BinButton Grid.Column="2" Height="30" Width="30" Foreground="White" VerticalAlignment="Top" Margin="5"
Clicked="BinButton_Clicked"></local:BinButton>
<local:StarGlyph Grid.Column="2" Height="30" Width="30" Foreground="White" VerticalAlignment="Top" Margin="5"
Clicked="StarGlyph_Clicked" IsEnabled="{Binding ElementName=_this, Path=IsDefault, Mode=OneWay, Converter={StaticResource InverseBooleanConverter}}"></local:StarGlyph>
</WrapPanel>
</Grid>
</UserControl>
@@ -0,0 +1,79 @@
using Daybreak.Models;
using Microsoft.Win32;
using System;
using System.Extensions;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Extensions;
namespace Daybreak.Controls
{
/// <summary>
/// Interaction logic for GuildwarsPathTemplate.xaml
/// </summary>
public partial class GuildwarsPathTemplate : UserControl
{
public static readonly DependencyProperty PathProperty = DependencyPropertyExtensions.Register<GuildwarsPathTemplate, string>(nameof(Path));
public static readonly DependencyProperty IsDefaultProperty = DependencyPropertyExtensions.Register<GuildwarsPathTemplate, bool>(nameof(IsDefault));
public event EventHandler RemoveClicked;
public event EventHandler DefaultClicked;
public string Path
{
get => this.GetTypedValue<string>(PathProperty);
set => this.SetValue(PathProperty, value);
}
public bool IsDefault
{
get => this.GetTypedValue<bool>(IsDefaultProperty);
set => this.SetValue(IsDefaultProperty, value);
}
public GuildwarsPathTemplate()
{
this.InitializeComponent();
this.DataContextChanged += GuildwarsPathTemplate_DataContextChanged;
}
private void GuildwarsPathTemplate_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if (e.NewValue is GuildwarsPath guildwarsPath)
{
this.IsDefault = guildwarsPath.Default;
this.Path = guildwarsPath.Path;
}
}
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
{
this.DataContext.As<GuildwarsPath>().Path = this.Path;
}
private void StarGlyph_Clicked(object sender, EventArgs e)
{
this.DefaultClicked?.Invoke(this, e);
}
private void BinButton_Clicked(object sender, EventArgs e)
{
this.RemoveClicked?.Invoke(this, e);
}
private void FilePickerGlyph_Clicked(object sender, EventArgs e)
{
var filePicker = new OpenFileDialog()
{
CheckFileExists = true,
CheckPathExists = true,
DefaultExt = "exe",
Multiselect = false
};
if (filePicker.ShowDialog() is true)
{
this.Path = filePicker.FileName;
this.DataContext.As<GuildwarsPath>().Path = filePicker.FileName;
}
}
}
}
+1 -1
View File
@@ -9,7 +9,7 @@
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
<LangVersion>preview</LangVersion>
<ApplicationIcon>Daybreak.ico</ApplicationIcon>
<Version>0.4.1</Version>
<Version>0.6.2</Version>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
@@ -0,0 +1,24 @@
using System;
using System.Runtime.Serialization;
namespace Daybreak.Exceptions
{
public sealed class CredentialsNotFoundException : Exception
{
public CredentialsNotFoundException()
{
}
public CredentialsNotFoundException(string message) : base(message)
{
}
public CredentialsNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
public CredentialsNotFoundException(string message, Exception innerException) : base(message, innerException)
{
}
}
}
@@ -0,0 +1,24 @@
using System;
using System.Runtime.Serialization;
namespace Daybreak.Exceptions
{
public sealed class ExecutableNotFoundException : Exception
{
public ExecutableNotFoundException()
{
}
public ExecutableNotFoundException(string message) : base(message)
{
}
public ExecutableNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
public ExecutableNotFoundException(string message, Exception innerException) : base(message, innerException)
{
}
}
}
+12
View File
@@ -159,9 +159,21 @@ namespace Daybreak.Launch
else
{
this.viewManager.ShowView<MainView>();
this.PeriodicallyCheckForUpdates();
}
}
private void PeriodicallyCheckForUpdates()
{
TaskExtensions.RunPeriodicAsync(async () =>
{
if (await this.applicationUpdater.UpdateAvailable())
{
this.Dispatcher.Invoke(() => this.viewManager.ShowView<AskUpdateView>());
}
}, TimeSpan.FromMinutes(15), TimeSpan.FromMinutes(15), CancellationToken.None);
}
private static Color GetAverageColor(BitmapSource bitmap)
{
var format = bitmap.Format;
+12
View File
@@ -0,0 +1,12 @@
using Newtonsoft.Json;
namespace Daybreak.Models
{
public sealed class GuildwarsPath
{
[JsonProperty("path")]
public string Path { get; set; }
[JsonProperty("default")]
public bool Default { get; set; }
}
}
@@ -1,10 +0,0 @@
namespace Daybreak.Services.ApplicationDetection
{
public interface IApplicationDetector
{
bool IsGuildwarsRunning { get; }
bool IsToolboxRunning { get; }
void LaunchGuildwars();
void LaunchGuildwarsToolbox();
}
}
@@ -1,24 +1,22 @@
using Daybreak.Models;
using Daybreak.Exceptions;
using Daybreak.Services.Configuration;
using Daybreak.Services.Credentials;
using Daybreak.Services.Logging;
using Daybreak.Services.Mutex;
using Daybreak.Utils;
using Microsoft.Win32;
using Pepa.Wpf.Utilities;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Extensions;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Threading.Tasks;
namespace Daybreak.Services.ApplicationDetection
namespace Daybreak.Services.ApplicationLauncher
{
public class ApplicationDetector : IApplicationDetector
public class ApplicationLauncher : IApplicationLauncher
{
private const string ToolboxProcessName = "GWToolbox";
private const string ProcessName = "gw";
@@ -32,7 +30,7 @@ namespace Daybreak.Services.ApplicationDetection
public bool IsGuildwarsRunning => this.GuildwarsProcessDetected();
public bool IsToolboxRunning => GuildwarsToolboxProcessDetected();
public ApplicationDetector(
public ApplicationLauncher(
IConfigurationManager configurationManager,
ICredentialManager credentialManager,
IMutexHandler mutexHandler,
@@ -44,7 +42,7 @@ namespace Daybreak.Services.ApplicationDetection
this.configurationManager = configurationManager.ThrowIfNull(nameof(configurationManager));
}
public async void LaunchGuildwars()
public async Task LaunchGuildwars()
{
var configuration = this.configurationManager.GetConfiguration();
var auth = await this.credentialManager.GetDefaultCredentials().ConfigureAwait(false);
@@ -60,31 +58,39 @@ namespace Daybreak.Services.ApplicationDetection
},
onNone: () =>
{
throw new InvalidOperationException($"No credentials available");
throw new CredentialsNotFoundException($"No credentials available");
});
}
public void LaunchGuildwarsToolbox()
public Task LaunchGuildwarsToolbox()
{
var configuration = this.configurationManager.GetConfiguration();
var executable = configuration.ToolboxPath;
if (File.Exists(executable) is false)
return Task.Run(() =>
{
throw new InvalidOperationException($"Guildwars executable doesn't exist at {executable}");
}
var configuration = this.configurationManager.GetConfiguration();
var executable = configuration.ToolboxPath;
if (File.Exists(executable) is false)
{
throw new ExecutableNotFoundException($"Guildwars executable doesn't exist at {executable}");
}
if (Process.Start(executable) is null)
{
throw new InvalidOperationException($"Unable to launch {executable}");
}
if (Process.Start(executable) is null)
{
throw new InvalidOperationException($"Unable to launch {executable}");
}
});
}
private void LaunchGuildwarsProcess(string email, Models.SecureString password, string character)
{
var executable = this.configurationManager.GetConfiguration().GamePath;
if (File.Exists(executable) is false)
var executable = this.configurationManager.GetConfiguration().GuildwarsPaths.Where(path => path.Default).FirstOrDefault();
if (executable is null)
{
throw new InvalidOperationException($"Guildwars executable doesn't exist at {executable}");
throw new ExecutableNotFoundException($"No executable selected");
}
if (File.Exists(executable.Path) is false)
{
throw new ExecutableNotFoundException($"Guildwars executable doesn't exist at {executable}");
}
var args = new List<string>()
@@ -100,7 +106,7 @@ namespace Daybreak.Services.ApplicationDetection
args.Add(character);
}
if (Process.Start(executable, args) is null)
if (Process.Start(executable.Path, args) is null)
{
throw new InvalidOperationException($"Unable to launch {executable}");
}
@@ -112,8 +118,13 @@ namespace Daybreak.Services.ApplicationDetection
{
try
{
using var stream = File.OpenWrite(this.configurationManager.GetConfiguration().GamePath);
return false;
var path = this.configurationManager.GetConfiguration().GuildwarsPaths.Where(path => path.Default).FirstOrDefault();
if (path is null)
{
return false;
}
return Process.GetProcessesByName(ProcessName).Where(process => string.Equals(path.Path, process.MainModule.FileName, StringComparison.Ordinal)).Any();
}
catch
{
@@ -135,7 +146,13 @@ namespace Daybreak.Services.ApplicationDetection
private void SetRegistryGuildwarsPath()
{
var gamePath = this.configurationManager.GetConfiguration().GamePath;
var path = this.configurationManager.GetConfiguration().GuildwarsPaths.Where(path => path.Default).FirstOrDefault();
if (path is null)
{
throw new ExecutableNotFoundException("No executable currently selected");
}
var gamePath = path.Path;
try
{
var registryKey = GetGuildwarsRegistryKey(true);
@@ -0,0 +1,12 @@
using System.Threading.Tasks;
namespace Daybreak.Services.ApplicationLauncher
{
public interface IApplicationLauncher
{
bool IsGuildwarsRunning { get; }
bool IsToolboxRunning { get; }
Task LaunchGuildwars();
Task LaunchGuildwarsToolbox();
}
}
@@ -93,7 +93,7 @@ namespace Daybreak.Services.Updater
public async Task<bool> UpdateAvailable()
{
var version = string.Join('.', this.CurrentVersion.Split('.').Take(3));
var version = string.Join('.', this.CurrentVersion.Split('.'));
var maybeLatestVersion = await this.GetLatestVersion();
return maybeLatestVersion.Switch(
onSome: latestVersion => string.Compare(version, latestVersion, true) < 0,
+2 -1
View File
@@ -8,7 +8,8 @@
xmlns:controls="clr-namespace:Daybreak.Controls"
x:Name="_this"
d:DesignHeight="450" d:DesignWidth="800">
<Grid Background="#20202020">
<Grid Background="#A0202020">
<TextBlock HorizontalAlignment="Center" Text="Accounts settings" FontSize="22" Foreground="White"></TextBlock>
<controls:BackButton Foreground="White" Height="30" Width="30" Grid.Column="0" HorizontalAlignment="Left" Margin="5"
Clicked="BackButton_Clicked" VerticalAlignment="Top"></controls:BackButton>
<controls:AddButton Foreground="White" Height="30" Width="30" Grid.Column="0" HorizontalAlignment="Right" Margin="5, 5, 45, 5"
+17 -3
View File
@@ -44,7 +44,12 @@ namespace Daybreak.Views
private void AddButton_Clicked(object sender, EventArgs e)
{
this.Accounts.Add(new LoginCredentials());
var newCredentials = new LoginCredentials();
this.Accounts.Add(newCredentials);
if (this.Accounts.Count == 1)
{
this.SetAccountAsDefault(newCredentials);
}
}
private async void SaveButton_Clicked(object sender, EventArgs e)
@@ -57,16 +62,25 @@ namespace Daybreak.Views
{
var creds = sender.As<AccountTemplate>()?.DataContext?.As<LoginCredentials>();
this.Accounts.Remove(creds);
if (this.Accounts.Count > 0 && creds.Default is true)
{
this.SetAccountAsDefault(this.Accounts.First());
}
}
private void AccountTemplate_DefaultClicked(object sender, EventArgs e)
{
var creds = sender.As<AccountTemplate>()?.DataContext?.As<LoginCredentials>();
foreach(var cred in this.Accounts)
this.SetAccountAsDefault(creds);
}
private void SetAccountAsDefault(LoginCredentials loginCredentials)
{
foreach (var cred in this.Accounts)
{
cred.Default = false;
}
creds.Default = true;
loginCredentials.Default = true;
var view = CollectionViewSource.GetDefaultView(this.Accounts);
view.Refresh();
}
+36
View File
@@ -0,0 +1,36 @@
<UserControl x:Class="Daybreak.Views.ExecutablesView"
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:Daybreak.Views"
mc:Ignorable="d"
xmlns:controls="clr-namespace:Daybreak.Controls"
x:Name="_this"
d:DesignHeight="450" d:DesignWidth="800">
<Grid Background="#A0202020">
<TextBlock HorizontalAlignment="Center" Text="Executables settings" FontSize="22" Foreground="White"></TextBlock>
<controls:BackButton Foreground="White" Height="30" Width="30" Grid.Column="0" HorizontalAlignment="Left" Margin="5"
Clicked="BackButton_Clicked" VerticalAlignment="Top"></controls:BackButton>
<controls:AddButton Foreground="White" Height="30" Width="30" Grid.Column="0" HorizontalAlignment="Right" Margin="5, 5, 45, 5"
Clicked="AddButton_Clicked" VerticalAlignment="Top"></controls:AddButton>
<controls:SaveButton Foreground="White" Height="30" Width="30" Grid.Column="0" HorizontalAlignment="Right" Margin="5"
Clicked="SaveButton_Clicked" VerticalAlignment="Top"></controls:SaveButton>
<ListView ItemsSource="{Binding ElementName=_this, Path=Paths, Mode=OneWay}" Background="Transparent" Margin="0, 40, 0, 0">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate>
<controls:GuildwarsPathTemplate
Path="{Binding Path, Mode=TwoWay}"
IsDefault="{Binding Default, Mode=TwoWay}"
DefaultClicked="GuildwarsPathTemplate_DefaultClicked"
RemoveClicked="GuildwarsPathTemplate_RemoveClicked"></controls:GuildwarsPathTemplate>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</UserControl>
+89
View File
@@ -0,0 +1,89 @@
using Daybreak.Controls;
using Daybreak.Models;
using Daybreak.Services.Configuration;
using Daybreak.Services.ViewManagement;
using Microsoft.Win32;
using System;
using System.Collections.ObjectModel;
using System.Extensions;
using System.Linq;
using System.Windows.Controls;
using System.Windows.Data;
namespace Daybreak.Views
{
/// <summary>
/// Interaction logic for ExecutablesView.xaml
/// </summary>
public partial class ExecutablesView : UserControl
{
private readonly IConfigurationManager configurationManager;
private readonly IViewManager viewManager;
public ObservableCollection<GuildwarsPath> Paths { get; } = new();
public ExecutablesView(
IConfigurationManager configurationManager,
IViewManager viewManager)
{
this.configurationManager = configurationManager.ThrowIfNull(nameof(configurationManager));
this.viewManager = viewManager.ThrowIfNull(nameof(viewManager));
this.InitializeComponent();
this.GetPaths();
}
private void GetPaths()
{
this.Paths.AddRange(this.configurationManager.GetConfiguration().GuildwarsPaths);
}
private void BackButton_Clicked(object sender, EventArgs e)
{
this.viewManager.ShowView<SettingsCategoryView>();
}
private void AddButton_Clicked(object sender, EventArgs e)
{
var newPath = new GuildwarsPath();
this.Paths.Add(newPath);
if (this.Paths.Count == 1)
{
this.SetPathAsDefault(newPath);
}
}
private void SaveButton_Clicked(object sender, EventArgs e)
{
var config = this.configurationManager.GetConfiguration();
config.GuildwarsPaths = this.Paths.ToList();
this.configurationManager.SaveConfiguration(config);
this.viewManager.ShowView<SettingsCategoryView>();
}
private void GuildwarsPathTemplate_DefaultClicked(object sender, EventArgs e)
{
var path = sender.As<GuildwarsPathTemplate>()?.DataContext?.As<GuildwarsPath>();
this.SetPathAsDefault(path);
}
private void GuildwarsPathTemplate_RemoveClicked(object sender, EventArgs e)
{
var path = sender.As<GuildwarsPathTemplate>()?.DataContext?.As<GuildwarsPath>();
this.Paths.Remove(path);
if (this.Paths.Count > 0 && path.Default is true)
{
this.SetPathAsDefault(this.Paths.First());
}
}
private void SetPathAsDefault(GuildwarsPath gwPath)
{
foreach (var path in this.Paths)
{
path.Default = false;
}
gwPath.Default = true;
var view = CollectionViewSource.GetDefaultView(this.Paths);
view.Refresh();
}
}
}
+21 -8
View File
@@ -66,7 +66,7 @@
</Style>
</ResourceDictionary>
</UserControl.Resources>
<Grid Background="#20202020">
<Grid Background="#A0202020">
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
@@ -75,16 +75,29 @@
Clicked="BackButton_Clicked" VerticalAlignment="Top" HorizontalAlignment="Left"></controls:BackButton>
<controls:SaveButton Foreground="White" Height="30" Width="30" Grid.Column="0" Margin="5"
Clicked="SaveButton_Clicked" VerticalAlignment="Top" HorizontalAlignment="Right"></controls:SaveButton>
<TextBlock FontSize="22" Foreground="White" HorizontalAlignment="Center" TextWrapping="Wrap"
Text="Warning! Functionality under development! These settings might have unintended consequences, including breaking the GuildWars TOS."
Margin="50, 0, 50, 0"></TextBlock>
<StackPanel Margin="50, 0, 50, 0" HorizontalAlignment="Center">
<TextBlock FontSize="22" Foreground="White" TextWrapping="Wrap"
Text="Experimental settings" HorizontalAlignment="Center"></TextBlock>
<TextBlock FontSize="16" Foreground="White" TextWrapping="Wrap"
Text="Warning! Functionality under development! These settings might have unintended consequences, including breaking the GuildWars TOS."></TextBlock>
</StackPanel>
<Rectangle Fill="White" Height="1" VerticalAlignment="Bottom"></Rectangle>
<Grid Grid.Row="1" HorizontalAlignment="Center" Margin="0, 15, 0, 0">
<WrapPanel>
<TextBlock Text="Multi-launch support" Foreground="White" FontSize="22" VerticalAlignment="Center" Margin="0, 0, 15, 0"></TextBlock>
<Grid Grid.Row="1" HorizontalAlignment="Stretch" Margin="0, 15, 0, 0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock Text="Multi-launch support" Foreground="White" FontSize="22" VerticalAlignment="Center" Margin="0, 0, 15, 0" Height="30"></TextBlock>
<TextBlock Text="GWToolbox startup delay (in ms)" Foreground="White" FontSize="22" VerticalAlignment="Center" Margin="0, 0, 15, 0" Height="30"></TextBlock>
</StackPanel>
<StackPanel Grid.Column="1">
<ToggleButton IsChecked="{Binding ElementName=_this, Path=MultiLaunch, Mode=TwoWay}" Style="{StaticResource AnimatedSwitch}"
Height="30" Width="60"></ToggleButton>
</WrapPanel>
<TextBox Background="Transparent" Foreground="White" FontSize="16" Height="30"
PreviewTextInput="TextBox_AllowNumbersOnly" Text="{Binding ElementName=_this, Path=GWToolboxLaunchDelay, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
CommandManager.PreviewCanExecute="TextBox_DisallowPaste"></TextBox>
</StackPanel>
</Grid>
</Grid>
</UserControl>
@@ -2,9 +2,11 @@
using Daybreak.Services.ViewManagement;
using System;
using System.Extensions;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Extensions;
using System.Windows.Input;
namespace Daybreak.Views
{
@@ -13,7 +15,10 @@ namespace Daybreak.Views
/// </summary>
public partial class ExperimentalSettingsView : UserControl
{
public static readonly DependencyProperty MultiLaunchProperty = DependencyPropertyExtensions.Register<ExperimentalSettingsView, bool>(nameof(MultiLaunch));
public static readonly DependencyProperty MultiLaunchProperty =
DependencyPropertyExtensions.Register<ExperimentalSettingsView, bool>(nameof(MultiLaunch));
public static readonly DependencyProperty GWToolboxLaunchDelayProperty =
DependencyPropertyExtensions.Register<ExperimentalSettingsView, string>(nameof(GWToolboxLaunchDelay));
private readonly IViewManager viewManager;
private readonly IConfigurationManager configurationManager;
@@ -23,6 +28,11 @@ namespace Daybreak.Views
get => this.GetTypedValue<bool>(MultiLaunchProperty);
set => this.SetValue(MultiLaunchProperty, value);
}
public string GWToolboxLaunchDelay
{
get => this.GetTypedValue<string>(GWToolboxLaunchDelayProperty);
set => this.SetValue(GWToolboxLaunchDelayProperty, value);
}
public ExperimentalSettingsView(
IViewManager viewManager,
@@ -38,12 +48,18 @@ namespace Daybreak.Views
{
var config = this.configurationManager.GetConfiguration();
this.MultiLaunch = config.ExperimentalFeatures.MultiLaunchSupport;
this.GWToolboxLaunchDelay = config.ExperimentalFeatures.ToolboxAutoLaunchDelay.ToString();
}
private void SaveExperimentalSettings()
{
var config = this.configurationManager.GetConfiguration();
config.ExperimentalFeatures.MultiLaunchSupport = this.MultiLaunch;
if (int.TryParse(this.GWToolboxLaunchDelay, out var gwToolboxLaunchDelay))
{
config.ExperimentalFeatures.ToolboxAutoLaunchDelay = gwToolboxLaunchDelay;
}
this.configurationManager.SaveConfiguration(config);
}
@@ -57,5 +73,19 @@ namespace Daybreak.Views
{
this.viewManager.ShowView<SettingsCategoryView>();
}
private void TextBox_AllowNumbersOnly(object sender, TextCompositionEventArgs e)
{
e.Handled = e.Text.Select(c => char.IsDigit(c)).All(result => result is true) is false;
}
private void TextBox_DisallowPaste(object sender, CanExecuteRoutedEventArgs e)
{
if (e.Command == ApplicationCommands.ContextMenu || e.Command == ApplicationCommands.Paste)
{
e.CanExecute = false;
e.Handled = true;
}
}
}
}
+19 -7
View File
@@ -1,10 +1,12 @@
using Daybreak.Controls;
using Daybreak.Services.ApplicationDetection;
using Daybreak.Exceptions;
using Daybreak.Services.ApplicationLauncher;
using Daybreak.Services.Configuration;
using Daybreak.Services.ViewManagement;
using System;
using System.Extensions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Extensions;
@@ -29,7 +31,7 @@ namespace Daybreak.Views
public static readonly DependencyProperty LeftBrowserFavoriteAddressProperty =
DependencyPropertyExtensions.Register<MainView, string>(nameof(LeftBrowserFavoriteAddress));
private readonly IApplicationDetector applicationDetector;
private readonly IApplicationLauncher applicationDetector;
private readonly IViewManager viewManager;
private readonly IConfigurationManager configurationManager;
private readonly CancellationTokenSource cancellationTokenSource = new();
@@ -69,7 +71,7 @@ namespace Daybreak.Views
}
public MainView(
IApplicationDetector applicationDetector,
IApplicationLauncher applicationDetector,
IViewManager viewManager,
IConfigurationManager configurationManager)
{
@@ -110,15 +112,25 @@ namespace Daybreak.Views
this.cancellationTokenSource.Cancel();
}
private void LaunchButton_Clicked(object sender, EventArgs e)
private async void LaunchButton_Clicked(object sender, EventArgs e)
{
try
{
this.applicationDetector.LaunchGuildwars();
await this.applicationDetector.LaunchGuildwars();
if (this.configurationManager.GetConfiguration().ToolboxAutoLaunch is true)
{
var delay = this.configurationManager.GetConfiguration().ExperimentalFeatures.ToolboxAutoLaunchDelay;
await Task.Delay(delay);
await this.applicationDetector.LaunchGuildwarsToolbox();
}
}
catch
catch (CredentialsNotFoundException)
{
this.viewManager.ShowView<SettingsView>();
this.viewManager.ShowView<AccountsView>();
}
catch (ExecutableNotFoundException)
{
this.viewManager.ShowView<ExecutablesView>();
}
}
+10 -4
View File
@@ -7,24 +7,30 @@
xmlns:controls="clr-namespace:Daybreak.Controls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid Background="#20202020">
<Grid Background="#A0202020">
<controls:BackButton Foreground="White" Height="30" Width="30" Grid.Column="0" Margin="5"
Clicked="BackButton_Clicked" VerticalAlignment="Top" HorizontalAlignment="Left"></controls:BackButton>
<WrapPanel Orientation="Vertical" VerticalAlignment="Bottom">
<WrapPanel Orientation="Horizontal">
<controls:TileButton Grid.Row="5" Title="Account settings" Foreground="White" BorderBrush="White" BorderThickness="2"
<controls:TileButton Title="Account settings" Foreground="White" BorderBrush="White" BorderThickness="2"
HighlightColor="White" Clicked="AccountButton_Clicked" Width="150" Height="150">
<controls:TileButton.InnerContent>
<controls:AvatarGlyph></controls:AvatarGlyph>
</controls:TileButton.InnerContent>
</controls:TileButton>
<controls:TileButton Grid.Row="5" Grid.Column="1" Title="Launcher settings" Foreground="White" BorderBrush="White" BorderThickness="2"
<controls:TileButton Title="Guildwars settings" Foreground="White" BorderBrush="White" BorderThickness="2"
HighlightColor="White" Clicked="FileButton_Clicked" Height="150" Width="150">
<controls:TileButton.InnerContent>
<controls:FileGlyph></controls:FileGlyph>
</controls:TileButton.InnerContent>
</controls:TileButton>
<controls:TileButton Title="Launcher settings" Foreground="White" BorderBrush="White" BorderThickness="2"
HighlightColor="White" Clicked="LauncherButton_Clicked" Width="150" Height="150">
<controls:TileButton.InnerContent>
<controls:GoldenArrowGlyph></controls:GoldenArrowGlyph>
</controls:TileButton.InnerContent>
</controls:TileButton>
<controls:TileButton Grid.Row="5" Grid.Column="2" Title="Experimental settings" Foreground="White" BorderBrush="White" BorderThickness="2"
<controls:TileButton Title="Experimental settings" Foreground="White" BorderBrush="White" BorderThickness="2"
HighlightColor="White" Clicked="ExperimentalButton_Clicked" Height="150" Width="150">
<controls:TileButton.InnerContent>
<controls:ExperimentGlyph></controls:ExperimentGlyph>
@@ -33,6 +33,11 @@ namespace Daybreak.Views
this.viewManager.ShowView<ExperimentalSettingsView>();
}
private void FileButton_Clicked(object sender, System.EventArgs e)
{
this.viewManager.ShowView<ExecutablesView>();
}
private void BackButton_Clicked(object sender, System.EventArgs e)
{
this.viewManager.ShowView<MainView>();
+21 -24
View File
@@ -66,51 +66,48 @@
</Style>
</ResourceDictionary>
</UserControl.Resources>
<Grid Background="#80202020">
<Grid Background="#A0202020">
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="Launcher settings" FontSize="22" Foreground="White" HorizontalAlignment="Center" Grid.ColumnSpan="2"></TextBlock>
<controls:BackButton Foreground="White" Height="30" Width="30" Grid.Column="0" HorizontalAlignment="Left" Margin="5"
Clicked="BackButton_Clicked"></controls:BackButton>
<controls:SaveButton Foreground="White" Height="30" Width="30" Grid.Column="1" HorizontalAlignment="Right" Margin="5"
Clicked="SaveButton_Clicked"></controls:SaveButton>
<TextBlock Text="Game path: " FontSize="22" Foreground="White" Grid.Row="1"></TextBlock>
<TextBox Grid.Column="1" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" Grid.Row="1"
FontSize="22" Margin="0, 0, 30, 0" Background="Transparent" Foreground="White"
Text="{Binding ElementName=_this, Path=GamePath, Mode=TwoWay}"></TextBox>
<controls:FilePickerGlyph Grid.Row="1" Grid.Column="1" Height="30" Width="30" HorizontalAlignment="Right"
Foreground="White" BorderBrush="Gray" BorderThickness="1"
Clicked="GameFilePickerGlyph_Clicked"></controls:FilePickerGlyph>
<TextBlock Text="Toolbox path: " FontSize="22" Foreground="White" Grid.Row="2"></TextBlock>
<TextBox Grid.Column="1" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" Grid.Row="2"
<StackPanel Orientation="Vertical" Grid.Row="1">
<TextBlock Text="GWToolbox path: " FontSize="22" Foreground="White"></TextBlock>
<TextBlock Text="GWToolbox auto-launch: " FontSize="22" Foreground="White"></TextBlock>
<TextBlock Text="Address bar readonly: " FontSize="22" Foreground="White"/>
<TextBlock Text="Left browser homepage: " FontSize="22" Foreground="White"></TextBlock>
<TextBlock Text="Right browser homepage: " FontSize="22" Foreground="White"></TextBlock>
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Row="1" Grid.Column="1">
<Grid>
<TextBox HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"
FontSize="22" Margin="0, 0, 30, 0" Background="Transparent" Foreground="White"
Text="{Binding ElementName=_this, Path=ToolboxPath, Mode=TwoWay}"></TextBox>
<controls:FilePickerGlyph Grid.Row="2" Grid.Column="1" Height="30" Width="30" HorizontalAlignment="Right"
Foreground="White" BorderBrush="Gray" BorderThickness="1"
<controls:FilePickerGlyph Height="30" Width="30" HorizontalAlignment="Right"
Foreground="White" BorderBrush="Gray" BorderThickness="0"
Clicked="ToolboxFilePickerGlyph_Clicked"></controls:FilePickerGlyph>
<TextBlock Text="Address bar readonly: " FontSize="22" Foreground="White" Grid.Row="3"/>
<ToggleButton Grid.Column="1" HorizontalAlignment="Center" HorizontalContentAlignment="Stretch" Grid.Row="3" Style="{StaticResource AnimatedSwitch}" Height="30" Width="40"
</Grid>
<ToggleButton HorizontalAlignment="Center" HorizontalContentAlignment="Stretch" Style="{StaticResource AnimatedSwitch}" Height="30" Width="40"
FontSize="22" Background="Transparent" Foreground="White" IsChecked="{Binding ElementName=_this, Path=ToolboxAutoLaunch, Mode=TwoWay}"></ToggleButton>
<ToggleButton HorizontalAlignment="Center" HorizontalContentAlignment="Stretch" Style="{StaticResource AnimatedSwitch}" Height="30" Width="40"
FontSize="22" Background="Transparent" Foreground="White" IsChecked="{Binding ElementName=_this, Path=AddressBarReadonly, Mode=TwoWay}"></ToggleButton>
<TextBlock Text="Left browser homepage: " FontSize="22" Foreground="White" Grid.Row="4"></TextBlock>
<TextBox Grid.Column="1" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" Grid.Row="4"
<TextBox HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"
FontSize="22" Background="Transparent" Foreground="White"
Text="{Binding ElementName=_this, Path=LeftBrowserUrl, Mode=TwoWay}"
TextChanged="LeftBrowserUrl_TextChanged"></TextBox>
<TextBlock Text="Right browser homepage: " FontSize="22" Foreground="White" Grid.Row="5"></TextBlock>
<TextBox Grid.Column="1" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" Grid.Row="5"
<TextBox HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"
FontSize="22" Background="Transparent" Foreground="White"
Text="{Binding ElementName=_this, Path=RightBrowserUrl, Mode=TwoWay}"
TextChanged="RightBrowserUrl_TextChanged"></TextBox>
</StackPanel>
</Grid>
</UserControl>
+7 -22
View File
@@ -14,8 +14,6 @@ namespace Daybreak.Views
/// </summary>
public partial class SettingsView : UserControl
{
public static readonly DependencyProperty GamePathProperty =
DependencyPropertyExtensions.Register<SettingsView, string>(nameof(GamePath));
public static readonly DependencyProperty ToolboxPathProperty =
DependencyPropertyExtensions.Register<SettingsView, string>(nameof(ToolboxPath));
public static readonly DependencyProperty AddressBarReadonlyProperty =
@@ -24,14 +22,16 @@ namespace Daybreak.Views
DependencyPropertyExtensions.Register<SettingsView, string>(nameof(LeftBrowserUrl));
public static readonly DependencyProperty RightBrowserUrlProperty =
DependencyPropertyExtensions.Register<SettingsView, string>(nameof(RightBrowserUrl));
public static readonly DependencyProperty ToolboxAutoLaunchProperty =
DependencyPropertyExtensions.Register<SettingsView, bool>(nameof(ToolboxAutoLaunch));
private readonly IConfigurationManager configurationManager;
private readonly IViewManager viewManager;
public string GamePath
public bool ToolboxAutoLaunch
{
get => this.GetTypedValue<string>(GamePathProperty);
set => this.SetValue(GamePathProperty, value);
get => this.GetTypedValue<bool>(ToolboxAutoLaunchProperty);
set => this.SetValue(ToolboxAutoLaunchProperty, value);
}
public string ToolboxPath
{
@@ -68,39 +68,24 @@ namespace Daybreak.Views
{
var config = this.configurationManager.GetConfiguration();
this.AddressBarReadonly = config.AddressBarReadonly;
this.GamePath = config.GamePath;
this.ToolboxPath = config.ToolboxPath;
this.LeftBrowserUrl = config.LeftBrowserDefault;
this.RightBrowserUrl = config.RightBrowserDefault;
this.ToolboxAutoLaunch = config.ToolboxAutoLaunch;
}
private void SaveButton_Clicked(object sender, EventArgs e)
{
var currentConfig = this.configurationManager.GetConfiguration();
currentConfig.GamePath = this.GamePath;
currentConfig.ToolboxPath = this.ToolboxPath;
currentConfig.AddressBarReadonly = this.AddressBarReadonly;
currentConfig.LeftBrowserDefault = this.LeftBrowserUrl;
currentConfig.RightBrowserDefault = this.RightBrowserUrl;
currentConfig.ToolboxAutoLaunch = this.ToolboxAutoLaunch;
this.configurationManager.SaveConfiguration(currentConfig);
this.viewManager.ShowView<SettingsCategoryView>();
}
private void GameFilePickerGlyph_Clicked(object sender, EventArgs e)
{
var filePicker = new OpenFileDialog()
{
CheckFileExists = true,
CheckPathExists = true,
DefaultExt = "exe",
Multiselect = false
};
if (filePicker.ShowDialog() is true)
{
this.GamePath = filePicker.FileName;
}
}
private void ToolboxFilePickerGlyph_Clicked(object sender, EventArgs e)
{
var filePicker = new OpenFileDialog()