Misc QoL changes + Nuget updates

This commit is contained in:
difegue 2021-06-04 22:33:46 +02:00
parent 4d4f1f57e2
commit 87747debda
5 changed files with 123 additions and 49 deletions

View File

@ -1,38 +1,40 @@
<Application x:Class="Karen.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tb="http://www.hardcodet.net/taskbar"
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:local="clr-namespace:Karen"
ShutdownMode="OnExplicitShutdown">
<Application
x:Class="Karen.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Karen"
xmlns:tb="http://www.hardcodet.net/taskbar"
xmlns:ui="http://schemas.modernwpf.com/2019"
ShutdownMode="OnExplicitShutdown">
<Application.Resources>
<!--
Note that this application does not have a StartupUri declared, so no Window is automatically loaded.
Also, the ShutdownMode was set to explicit, so we have to close the application programmatically
-->
<!-- Light theme by default -->
<!-- Light theme by default -->
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ui:ThemeResources />
<ui:XamlControlsResources />
</ResourceDictionary.MergedDictionaries>
<tb:TaskbarIcon x:Key="NotifyIcon"
IconSource="/favicon.ico"
ToolTipText="LANraragi for Windows"
PopupActivation="All">
<tb:TaskbarIcon
x:Key="NotifyIcon"
IconSource="/favicon.ico"
PopupActivation="All"
ToolTipText="LANraragi for Windows">
<tb:TaskbarIcon.TrayPopup>
<!-- the control will be put into a popup with an explicit DataContext -->
<local:KarenPopup/>
<!-- the control will be put into a popup with an explicit DataContext -->
<local:KarenPopup />
</tb:TaskbarIcon.TrayPopup>
</tb:TaskbarIcon>
<local:EnumDescriptionConverter x:Key="EnumDescriptionConverter" />
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
</ResourceDictionary>

View File

@ -15,7 +15,7 @@ namespace Karen
public void ToastNotification(string text)
{
notifyIcon.ShowBalloonTip("LANraragi", text, notifyIcon.Icon);
notifyIcon.ShowBalloonTip("LANraragi", text, notifyIcon.Icon, true);
}
public void ShowConfigWindow()

View File

@ -171,16 +171,16 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Emoji.Wpf">
<Version>0.0.18-experimental</Version>
<Version>0.3.3</Version>
</PackageReference>
<PackageReference Include="Hardcodet.NotifyIcon.Wpf">
<Version>1.0.8</Version>
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="HideConsoleOnClose">
<Version>1.0.1</Version>
</PackageReference>
<PackageReference Include="ModernWpfUI">
<Version>0.9.1</Version>
<Version>0.9.4</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>

View File

@ -1,40 +1,109 @@
<UserControl x:Class="Karen.KarenPopup"
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:ui="http://schemas.modernwpf.com/2019"
xmlns:local="clr-namespace:Karen"
xmlns:emoji="clr-namespace:Emoji.Wpf;assembly=Emoji.Wpf"
Loaded="KarenPopup_Loaded"
mc:Ignorable="d"
BorderThickness="1"
Height="512" Width="250">
<UserControl
x:Class="Karen.KarenPopup"
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:emoji="clr-namespace:Emoji.Wpf;assembly=Emoji.Wpf"
xmlns:local="clr-namespace:Karen"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.modernwpf.com/2019"
Width="250"
Height="512"
BorderThickness="1"
Loaded="KarenPopup_Loaded"
mc:Ignorable="d">
<ui:SimpleStackPanel Orientation="Vertical" HorizontalAlignment="Center" >
<ui:SimpleStackPanel HorizontalAlignment="Center" Orientation="Vertical">
<Image Source="logo.png" Width="192" Height="192" Margin="0,0,0,-8" RenderOptions.BitmapScalingMode="HighQuality"/>
<Image
Width="192"
Height="192"
Margin="0,0,0,-8"
RenderOptions.BitmapScalingMode="HighQuality"
Source="logo.png" />
<emoji:TextBlock Height="Auto" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="-16,0,0,0"
FontSize="16" FontWeight="Bold" Foreground="{DynamicResource SystemControlPageTextBaseHighBrush}"
Text="{Binding DistroStatus, Converter={StaticResource EnumDescriptionConverter}}">
</emoji:TextBlock>
<emoji:TextBlock
Height="Auto"
Margin="-16,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="16"
FontWeight="Bold"
Foreground="{DynamicResource SystemControlPageTextBaseHighBrush}"
Text="{Binding DistroStatus, Converter={StaticResource EnumDescriptionConverter}}" />
<TextBlock TextWrapping="Wrap" Padding="10" FontSize="13" HorizontalAlignment="Center" Foreground="{DynamicResource SystemControlPageTextBaseHighBrush}">
<Run Text="{Binding Version, Mode=OneWay}"/>
<TextBlock
Padding="10"
HorizontalAlignment="Center"
FontSize="13"
Foreground="{DynamicResource SystemControlPageTextBaseHighBrush}"
TextWrapping="Wrap">
<Run Text="{Binding Version, Mode=OneWay}" />
</TextBlock>
<TextBlock TextWrapping="Wrap" Padding="10" FontSize="13" Visibility="{Binding IsNotInstalled, Converter={StaticResource BooleanToVisibilityConverter}}"
HorizontalAlignment="Center" Foreground="{DynamicResource SystemControlPageTextBaseHighBrush}">
<TextBlock
Padding="10"
HorizontalAlignment="Center"
FontSize="13"
Foreground="{DynamicResource SystemControlPageTextBaseHighBrush}"
TextWrapping="Wrap"
Visibility="{Binding IsNotInstalled, Converter={StaticResource BooleanToVisibilityConverter}}">
<Run>The WSL distro couldn't be detected on your system. Please re-run the installer.</Run>
</TextBlock>
<Button HorizontalAlignment="Center" Width="125" Height="30" Content="Start" Margin="10" Click="Start_Distro" Visibility="{Binding IsStopped, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Button HorizontalAlignment="Center" Width="125" Height="30" Content="Open App Folder" Margin="10" Click="Open_Distro" Visibility="{Binding IsStopped, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Button HorizontalAlignment="Center" Width="125" Height="30" Content="Stop" Margin="10" Click="Stop_Distro" Visibility="{Binding IsStarted, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Button HorizontalAlignment="Center" Width="125" Height="30" Content="Open Client" Margin="10" Click="Open_Webclient" Visibility="{Binding IsStarted, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Button HorizontalAlignment="Center" Width="125" Height="30" Content="Log Console" Margin="10" Click="Show_Console" Visibility="{Binding IsStarted, Converter={StaticResource BooleanToVisibilityConverter}}"/>
<Button HorizontalAlignment="Center" Width="125" Height="30" Content="Settings" Margin="10" Click="Show_Config"/>
<Button HorizontalAlignment="Center" Width="125" Height="30" Content="Quit" Margin="10" Click="Shutdown_App"/>
<Button
Width="125"
Height="30"
Margin="10"
HorizontalAlignment="Center"
Click="Start_Distro"
Content="Start"
Visibility="{Binding IsStopped, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Button
Width="125"
Height="30"
Margin="10"
HorizontalAlignment="Center"
Click="Open_Distro"
Content="Open App Folder"
Visibility="{Binding IsStopped, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Button
Width="125"
Height="30"
Margin="10"
HorizontalAlignment="Center"
Click="Stop_Distro"
Content="Stop"
Visibility="{Binding IsStarted, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Button
Width="125"
Height="30"
Margin="10"
HorizontalAlignment="Center"
Click="Open_Webclient"
Content="Open Client"
Visibility="{Binding IsStarted, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Button
Width="125"
Height="30"
Margin="10"
HorizontalAlignment="Center"
Click="Show_Console"
Content="Log Console"
Visibility="{Binding IsStarted, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Button
Width="125"
Height="30"
Margin="10"
HorizontalAlignment="Center"
Click="Show_Config"
Content="Settings" />
<Button
Width="125"
Height="30"
Margin="10"
HorizontalAlignment="Center"
Click="Shutdown_App"
Content="Quit" />
</ui:SimpleStackPanel>
</UserControl>

View File

@ -158,6 +158,9 @@ namespace Karen
{
((App)Application.Current).Distro.StartApp();
UpdateProperties();
// Prevent the popup from closing
((Popup)this.Parent).IsOpen = true;
}
private void Stop_Distro(object sender, RoutedEventArgs e)