Skip to content

Commit

Permalink
Release 0.9.9.9 (#548)
Browse files Browse the repository at this point in the history
Closes #547
Closes #546
Closes #536
  • Loading branch information
AlexMacocian authored Jan 27, 2024
1 parent 3ee58e2 commit a65f375
Show file tree
Hide file tree
Showing 29 changed files with 499 additions and 114 deletions.
16 changes: 0 additions & 16 deletions Daybreak.Installer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,6 @@ static void RenderProgressBar(int currentStep, int totalSteps, int barSize)
return;
}

Console.WriteLine("Deleting browser caches");
try
{
Directory.Delete("BrowserData", true);
}
catch(Exception)
{
}
try
{
Directory.Delete("Daybreak.exe.WebView2", true);
}
catch(Exception)
{
}

Console.WriteLine("Launching application");
var process = new Process
{
Expand Down
6 changes: 2 additions & 4 deletions Daybreak/Controls/Buttons/BackButton.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Daybreak.Controls.Buttons"
xmlns:glyphs="clr-namespace:Daybreak.Controls.Glyphs"
mc:Ignorable="d"
x:Name="_this"
Cursor="Hand"
Expand All @@ -14,10 +15,7 @@
Clicked="HighlightButton_Clicked">
<local:CircularButton.Content>
<Viewbox Stretch="Fill" Width="60" Height="60">
<Grid Width="30" Height="30" Margin="-2, 0, 0 ,0">
<Path Fill="{DynamicResource MahApps.Brushes.ThemeForeground}" VerticalAlignment="Top" HorizontalAlignment="Left"
Data="m18.87,9.41l-5.58,5.59l5.58,5.59a1,1 0 0 1 0,1.41l0,0a1,1 0 0 1 -1.41,0l-6.36,-6.36a0.91,0.91 0 0 1 0,-1.28l6.36,-6.36a1,1 0 0 1 1.41,0l0,0a1,1 0 0 1 0,1.41z"></Path>
</Grid>
<glyphs:ArrowGlyph />
</Viewbox>
</local:CircularButton.Content>
</local:CircularButton>
Expand Down
76 changes: 76 additions & 0 deletions Daybreak/Controls/DropDownButton.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<UserControl x:Class="Daybreak.Controls.DropDownButton"
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"
xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons"
xmlns:glyphs="clr-namespace:Daybreak.Controls.Glyphs"
xmlns:converters="clr-namespace:Daybreak.Converters"
mc:Ignorable="d"
x:Name="_this"
Tag="{Binding RelativeSource={RelativeSource Self}}"
MouseRightButtonDown="IgnoreRightMouseButton"
MouseRightButtonUp="IgnoreRightMouseButton"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<converters:BooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter" TriggerValue="True"/>
</UserControl.Resources>
<UserControl.ContextMenu>
<ContextMenu Placement="Bottom">
<ContextMenu.Template>
<ControlTemplate>
<local:DropDownButtonContextMenu
Items="{Binding PlacementTarget.Tag.Items, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
ItemTemplate="{Binding PlacementTarget.Tag.ItemTemplate, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
Background="{Binding PlacementTarget.Tag.Background, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
Width="{Binding PlacementTarget.Tag.ActualWidth, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
ItemClicked="DropDownButtonContextMenu_ItemClicked"/>
</ControlTemplate>
</ContextMenu.Template>
</ContextMenu>
</UserControl.ContextMenu>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<buttons:HighlightButton Grid.Column="0"
Foreground="{DynamicResource MahApps.Brushes.ThemeForeground}"
HighlightColor="{DynamicResource MahApps.Brushes.Accent}"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Clicked="MainButton_Clicked">
<buttons:HighlightButton.ButtonContent>
<ContentControl ContentTemplate="{Binding ItemTemplate, RelativeSource={RelativeSource AncestorType={x:Type local:DropDownButton}}}"
Content="{Binding SelectedItem, RelativeSource={RelativeSource AncestorType={x:Type local:DropDownButton}}}" />
</buttons:HighlightButton.ButtonContent>
</buttons:HighlightButton>
<buttons:HighlightButton Grid.Column="1"
Foreground="{DynamicResource MahApps.Brushes.ThemeForeground}"
HighlightColor="{DynamicResource MahApps.Brushes.Accent}"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
Clicked="ArrowButton_Clicked">
<buttons:HighlightButton.ButtonContent>
<glyphs:ArrowGlyph Foreground="{DynamicResource MahApps.Brushes.ThemeForeground}"
Height="30"
Width="30"
VerticalAlignment="Center"
HorizontalAlignment="Center"
RenderTransformOrigin="0.5 0.5">
<glyphs:ArrowGlyph.RenderTransform>
<RotateTransform Angle="270"/>
</glyphs:ArrowGlyph.RenderTransform>
</glyphs:ArrowGlyph>
</buttons:HighlightButton.ButtonContent>
</buttons:HighlightButton>
<Rectangle Opacity="0.2"
Fill="Black"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
Visibility="{Binding ElementName=_this, Path=ClickEnabled, Mode=OneWay, Converter={StaticResource InverseBooleanToVisibilityConverter}}"/>
</Grid>
</UserControl>
60 changes: 60 additions & 0 deletions Daybreak/Controls/DropDownButton.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using System;
using System.Collections;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Extensions;
using System.Windows.Input;

namespace Daybreak.Controls;
/// <summary>
/// Interaction logic for DropdownButton.xaml
/// </summary>
public partial class DropDownButton : UserControl
{
[GenerateDependencyProperty]
private DataTemplate itemTemplate = default!;

[GenerateDependencyProperty]
private object selectedItem = default!;

[GenerateDependencyProperty]
private IEnumerable items = default!;

[GenerateDependencyProperty(InitialValue = true)]
private bool clickEnabled = true;

public event EventHandler<object> Clicked = default!;
public event EventHandler<object> SelectionChanged = default!;

public DropDownButton()
{
this.InitializeComponent();
}

private void MainButton_Clicked(object sender, EventArgs e)
{
this.Clicked?.Invoke(this, this.SelectedItem);
}

private void ArrowButton_Clicked(object sender, EventArgs e)
{
var contextMenu = this.ContextMenu;
contextMenu.PlacementTarget = this;
contextMenu.IsOpen = true;
}

private void DropDownButtonContextMenu_ItemClicked(object _, object e)
{
this.SelectedItem = e;
this.ContextMenu.IsOpen = false;
this.SelectionChanged?.Invoke(this, e);
}

private void IgnoreRightMouseButton(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton is MouseButton.Right)
{
e.Handled = true;
}
}
}
29 changes: 29 additions & 0 deletions Daybreak/Controls/DropDownButtonContextMenu.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<UserControl x:Class="Daybreak.Controls.DropDownButtonContextMenu"
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"
xmlns:buttons="clr-namespace:Daybreak.Controls.Buttons"
mc:Ignorable="d"
x:Name="_this"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<ItemsControl ItemsSource="{Binding ElementName=_this, Path=Items, Mode=OneWay}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<buttons:HighlightButton HighlightColor="{DynamicResource MahApps.Brushes.Accent}"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
Tag="{Binding Mode=OneWay}"
Clicked="HighlightButton_Clicked">
<buttons:HighlightButton.ButtonContent>
<ContentControl DataContext="{Binding DataContext, RelativeSource={RelativeSource AncestorType={x:Type buttons:HighlightButton}}}"
ContentTemplate="{Binding ItemTemplate, RelativeSource={RelativeSource AncestorType={x:Type local:DropDownButtonContextMenu}}}"/>
</buttons:HighlightButton.ButtonContent>
</buttons:HighlightButton>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</UserControl>
32 changes: 32 additions & 0 deletions Daybreak/Controls/DropDownButtonContextMenu.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Daybreak.Controls.Buttons;
using System;
using System.Collections;
using System.Extensions;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Extensions;

namespace Daybreak.Controls;
/// <summary>
/// Interaction logic for DropDownButtonContextMenu.xaml
/// </summary>
public partial class DropDownButtonContextMenu : UserControl
{
[GenerateDependencyProperty]
private DataTemplate itemTemplate = default!;

[GenerateDependencyProperty]
private IEnumerable items = default!;

public event EventHandler<object> ItemClicked = default!;

public DropDownButtonContextMenu()
{
this.InitializeComponent();
}

private void HighlightButton_Clicked(object sender, EventArgs e)
{
this.ItemClicked?.Invoke(this, sender.Cast<HighlightButton>().DataContext);
}
}
15 changes: 15 additions & 0 deletions Daybreak/Controls/Glyphs/ArrowGlyph.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<UserControl x:Class="Daybreak.Controls.Glyphs.ArrowGlyph"
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.Glyphs"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Viewbox>
<Grid Width="30" Height="30" Margin="-2, 0, 0 ,0">
<Path Fill="{DynamicResource MahApps.Brushes.ThemeForeground}" VerticalAlignment="Top" HorizontalAlignment="Left"
Data="m18.87,9.41l-5.58,5.59l5.58,5.59a1,1 0 0 1 0,1.41l0,0a1,1 0 0 1 -1.41,0l-6.36,-6.36a0.91,0.91 0 0 1 0,-1.28l6.36,-6.36a1,1 0 0 1 1.41,0l0,0a1,1 0 0 1 0,1.41z"></Path>
</Grid>
</Viewbox>
</UserControl>
13 changes: 13 additions & 0 deletions Daybreak/Controls/Glyphs/ArrowGlyph.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Windows.Controls;

namespace Daybreak.Controls.Glyphs;
/// <summary>
/// Interaction logic for ArrowGlyph.xaml
/// </summary>
public partial class ArrowGlyph : UserControl
{
public ArrowGlyph()
{
this.InitializeComponent();
}
}
2 changes: 1 addition & 1 deletion Daybreak/Controls/LivingEntityContextMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private async void LivingEntityContextMenu_DataContextChanged(object sender, Sys
this.PrimaryProfessionVisible = false;
}

await this.guildwarsMemoryReader.EnsureInitialized(context.GuildWarsApplicationLaunchContext!.GuildWarsProcess, CancellationToken.None);
await this.guildwarsMemoryReader.EnsureInitialized(context.GuildWarsApplicationLaunchContext!.ProcessId, CancellationToken.None);
this.EntityName = await this.guildwarsMemoryReader.GetEntityName(context.LivingEntity!, CancellationToken.None).ConfigureAwait(true);
}

Expand Down
2 changes: 1 addition & 1 deletion Daybreak/Controls/PlayerContextMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private async void PlayerContextMenu_DataContextChanged(object sender, System.Wi
return;
}

await this.guildwarsMemoryReader.EnsureInitialized(context.GuildWarsApplicationLaunchContext!.GuildWarsProcess, CancellationToken.None);
await this.guildwarsMemoryReader.EnsureInitialized(context.GuildWarsApplicationLaunchContext!.ProcessId, CancellationToken.None);
this.PlayerName = await this.guildwarsMemoryReader.GetEntityName(context.Player!, CancellationToken.None).ConfigureAwait(true);
}

Expand Down
19 changes: 11 additions & 8 deletions Daybreak/Controls/Templates/LaunchButtonTemplate.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
xmlns:configs="clr-namespace:Daybreak.Models.LaunchConfigurations"
xmlns:converters="clr-namespace:Daybreak.Converters"
mc:Ignorable="d"
DataContextChanged="UserControl_DataContextChanged"
Loaded="UserControl_Loaded"
Unloaded="UserControl_Unloaded"
x:Name="_this"
Expand All @@ -25,18 +26,19 @@
FontSize="22"
Foreground="{StaticResource MahApps.Brushes.ThemeForeground}"
Visibility="{Binding ElementName=_this, Path=GameRunning, Mode=OneWay, Converter={StaticResource InverseBooleanToVisibilityConverter}}"/>
<TextBlock Text="{Binding Credentials.Username}"
<TextBlock Text="{Binding Configuration.Credentials.Username}"
FontSize="22"
Foreground="{StaticResource MahApps.Brushes.ThemeForeground}"/>
<TextBlock Text=" running"
FontSize="22"
Foreground="{StaticResource MahApps.Brushes.Accent}"
Visibility="{Binding ElementName=_this, Path=GameRunning, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}"/>
</WrapPanel>
<TextBlock Text="{Binding ExecutablePath}"
<TextBlock Text="{Binding Configuration.ExecutablePath}"
Foreground="{StaticResource MahApps.Brushes.ThemeForeground}"
FontSize="12"
TextWrapping="Wrap"/>
TextWrapping="Wrap"
HorizontalAlignment="Center"/>
</StackPanel>
<StackPanel
Visibility="{Binding ElementName=_this, Path=CanShowFocusView, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}">
Expand All @@ -45,14 +47,15 @@
<TextBlock Text="Attach "
FontSize="22"
Foreground="{StaticResource MahApps.Brushes.ThemeForeground}" />
<TextBlock Text="{Binding Credentials.Username}"
<TextBlock Text="{Binding Configuration.Credentials.Username}"
FontSize="22"
Foreground="{StaticResource MahApps.Brushes.ThemeForeground}"/>
</WrapPanel>
<TextBlock Text="{Binding ExecutablePath}"
Foreground="{StaticResource MahApps.Brushes.ThemeForeground}"
FontSize="12"
TextWrapping="Wrap"/>
<TextBlock Text="{Binding Configuration.ExecutablePath}"
Foreground="{StaticResource MahApps.Brushes.ThemeForeground}"
FontSize="12"
TextWrapping="Wrap"
HorizontalAlignment="Center"/>
</StackPanel>
</Grid>
</UserControl>
Loading

0 comments on commit a65f375

Please sign in to comment.