-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Menu to manage guildwars executables.
- Loading branch information
Alexandru Macocian
committed
Apr 14, 2021
1 parent
88214ea
commit c169ca1
Showing
17 changed files
with
340 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}" | ||
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
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.Path = sender.As<TextBox>()?.Text; | ||
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; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
Oops, something went wrong.