mirror of
https://gitlab.com/2009scape/Saradomin-Launcher.git
synced 2026-08-01 14:19:14 -06:00
reorganize files a little bit, add notification box window.
This commit is contained in:
parent
cb3a55eeb7
commit
00bff708e6
23 changed files with 358 additions and 192 deletions
4
Saradomin.sln.DotSettings.user
Normal file
4
Saradomin.sln.DotSettings.user
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
|
||||
<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/CustomBuildToolPath/@EntryValue">/usr/share/dotnet/sdk/7.0.100/MSBuild.dll</s:String>
|
||||
<s:String x:Key="/Default/Environment/Hierarchy/Build/SolBuilderDuo/UseMsbuildSolutionBuilder/@EntryValue">No</s:String></wpf:ResourceDictionary>
|
||||
|
|
@ -4,7 +4,7 @@ using Avalonia.Markup.Xaml;
|
|||
using Glitonea;
|
||||
using Glitonea.Mvvm;
|
||||
using PropertyChanged;
|
||||
using Saradomin.Views.Windows;
|
||||
using Saradomin.View.Windows;
|
||||
|
||||
namespace Saradomin
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace Saradomin.Messaging
|
||||
namespace Saradomin.Infrastructure.Messaging
|
||||
{
|
||||
public class MainViewLoadedMessage
|
||||
{
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
namespace Saradomin.Infrastructure.Messaging
|
||||
{
|
||||
public class NotificationBoxStateChangedMessage
|
||||
{
|
||||
public bool WasOpened { get; }
|
||||
|
||||
public NotificationBoxStateChangedMessage(bool wasOpened)
|
||||
{
|
||||
WasOpened = wasOpened;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace Saradomin.Messaging
|
||||
namespace Saradomin.Infrastructure.Messaging
|
||||
{
|
||||
public class SettingsModifiedMessage
|
||||
{
|
||||
|
|
@ -5,7 +5,7 @@ using Avalonia;
|
|||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Saradomin.Utilities;
|
||||
|
||||
namespace Saradomin.Services
|
||||
namespace Saradomin.Infrastructure.Services
|
||||
{
|
||||
public class ClientLaunchService : IClientLaunchService
|
||||
{
|
||||
|
|
@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
|||
using Saradomin.Model.Settings.Launcher;
|
||||
using Saradomin.Utilities;
|
||||
|
||||
namespace Saradomin.Services
|
||||
namespace Saradomin.Infrastructure.Services
|
||||
{
|
||||
public class ClientUpdateService : IClientUpdateService
|
||||
{
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using System.Threading.Tasks;
|
||||
using Glitonea.Mvvm;
|
||||
|
||||
namespace Saradomin.Services
|
||||
namespace Saradomin.Infrastructure.Services
|
||||
{
|
||||
public interface IClientLaunchService : IService
|
||||
{
|
||||
|
|
@ -3,7 +3,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using Glitonea.Mvvm;
|
||||
|
||||
namespace Saradomin.Services
|
||||
namespace Saradomin.Infrastructure.Services
|
||||
{
|
||||
public interface IClientUpdateService : IService
|
||||
{
|
||||
|
|
@ -3,7 +3,7 @@ using System.Threading.Tasks;
|
|||
using Glitonea.Mvvm;
|
||||
using Saradomin.Model;
|
||||
|
||||
namespace Saradomin.Services
|
||||
namespace Saradomin.Infrastructure.Services
|
||||
{
|
||||
public interface IRemoteConfigService : IService
|
||||
{
|
||||
|
|
@ -2,7 +2,7 @@ using Glitonea.Mvvm;
|
|||
using Saradomin.Model.Settings.Client;
|
||||
using Saradomin.Model.Settings.Launcher;
|
||||
|
||||
namespace Saradomin.Services
|
||||
namespace Saradomin.Infrastructure.Services
|
||||
{
|
||||
public interface ISettingsService : IService
|
||||
{
|
||||
|
|
@ -6,7 +6,7 @@ using System.Text.Json;
|
|||
using System.Threading.Tasks;
|
||||
using Saradomin.Model;
|
||||
|
||||
namespace Saradomin.Services
|
||||
namespace Saradomin.Infrastructure.Services
|
||||
{
|
||||
public class RemoteConfigService : IRemoteConfigService
|
||||
{
|
||||
|
|
@ -4,7 +4,7 @@ using Saradomin.Model.Settings.Client;
|
|||
using Saradomin.Model.Settings.Launcher;
|
||||
using Saradomin.Utilities;
|
||||
|
||||
namespace Saradomin.Services
|
||||
namespace Saradomin.Infrastructure.Services
|
||||
{
|
||||
public class SettingsService : ISettingsService
|
||||
{
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
using System.ComponentModel;
|
||||
using Saradomin.Messaging;
|
||||
using Saradomin.Infrastructure.Messaging;
|
||||
|
||||
namespace Saradomin.Model.Settings
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,12 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Text.Json;
|
||||
using Avalonia;
|
||||
using Saradomin.Model;
|
||||
|
||||
namespace Saradomin
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,63 +4,67 @@
|
|||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Version>1.3.1</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetPlatform>x64</TargetPlatform>
|
||||
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
|
||||
|
||||
|
||||
<NoWarn>IL2026;CS0067</NoWarn>
|
||||
|
||||
|
||||
<ApplicationIcon>Resources\Icons\saradomin.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="0.10.15" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="0.10.15" />
|
||||
<PackageReference Include="Avalonia" Version="0.10.18" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="0.10.18" />
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.15" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.42" />
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.18" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.46" />
|
||||
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="4.0.0" PrivateAssets="all" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Glitonea\Glitonea.csproj" />
|
||||
<ProjectReference Include="..\Glitonea\Glitonea.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<AvaloniaResource Include="Resources\Fonts\runescape_uf.ttf" />
|
||||
<AvaloniaResource Include="Resources\Images\previewbg.png" />
|
||||
<AvaloniaResource Include="Resources\Images\club.png" />
|
||||
<AvaloniaResource Include="Resources\Fonts\runescape_plain.ttf" />
|
||||
<AvaloniaResource Include="Resources\Fonts\runescape_uf.ttf" />
|
||||
<AvaloniaResource Include="Resources\Images\previewbg.png" />
|
||||
<AvaloniaResource Include="Resources\Images\club.png" />
|
||||
<AvaloniaResource Include="Resources\Fonts\runescape_plain.ttf" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Views\Windows\MainWindow.axaml.cs">
|
||||
<DependentUpon>MainWindow.axaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\Controls\SettingsView.axaml.cs">
|
||||
<DependentUpon>MainWindow.axaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\Controls\MenuPreview.axaml.cs">
|
||||
<DependentUpon>MenuPreview.axaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="View\Controls\SlayerPreview.axaml.cs">
|
||||
<DependentUpon>SlayerPreview.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="View\Controls\AntiAliasingSelector.axaml.cs">
|
||||
<DependentUpon>AntiAliasingSelector.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Views\Windows\MainWindow.axaml.cs">
|
||||
<DependentUpon>MainWindow.axaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="View\Windows\NotificationBox.axaml.cs">
|
||||
<DependentUpon>NotificationBox.axaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\Controls\SettingsView.axaml.cs">
|
||||
<DependentUpon>MainWindow.axaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\Controls\MenuPreview.axaml.cs">
|
||||
<DependentUpon>MenuPreview.axaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="View\Controls\SlayerPreview.axaml.cs">
|
||||
<DependentUpon>SlayerPreview.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="View\Controls\AntiAliasingSelector.axaml.cs">
|
||||
<DependentUpon>AntiAliasingSelector.axaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<AvaloniaResource Include="Resources\Icons\saradomin.ico" />
|
||||
<EmbeddedResource Include="Resources\Lists\MusicTracks.json" />
|
||||
<AvaloniaResource Include="Resources\Icons\saradomin.ico" />
|
||||
<EmbeddedResource Include="Resources\Lists\MusicTracks.json" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ using Avalonia.Controls;
|
|||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Media;
|
||||
using PropertyChanged;
|
||||
using Saradomin.Messaging;
|
||||
|
||||
namespace Saradomin.View.Controls
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,140 +1,154 @@
|
|||
<glitonea:WindowEx xmlns="https://github.com/avaloniaui"
|
||||
<glitonea:WindowEx x:Class="Saradomin.View.Windows.MainWindow"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:Saradomin.View.Controls"
|
||||
xmlns:glitonea="clr-namespace:Glitonea;assembly=Glitonea"
|
||||
xmlns:mvvm="clr-namespace:Glitonea.Mvvm;assembly=Glitonea"
|
||||
xmlns:vm="clr-namespace:Saradomin.ViewModel.Windows"
|
||||
xmlns:controls="clr-namespace:Saradomin.View.Controls"
|
||||
Name="MainWindow"
|
||||
Title="{Binding Title}"
|
||||
Width="800"
|
||||
Height="550"
|
||||
SystemDecorations="None"
|
||||
x:Class="Saradomin.Views.Windows.MainWindow"
|
||||
Title="{Binding Title}"
|
||||
DataContext="{mvvm:DataContextSource vm:MainWindowViewModel}"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
CanResize="False"
|
||||
Background="{StaticResource WindowBackgroundBrush}"
|
||||
Name="MainWindow"
|
||||
Icon="avares://Saradomin/Resources/Icons/saradomin.ico">
|
||||
<Border BorderThickness="2"
|
||||
BorderBrush="{StaticResource DarkBorderBrush}">
|
||||
<Grid RowDefinitions="24,*,32">
|
||||
<Grid Grid.Row="0"
|
||||
Margin="0,-1,0,0"
|
||||
Background="{StaticResource DarkBackgroundBrush}"
|
||||
PointerPressed="TitleBar_MouseDown"
|
||||
ColumnDefinitions="Auto,*,Auto">
|
||||
CanResize="False"
|
||||
DataContext="{mvvm:DataContextSource vm:MainWindowViewModel}"
|
||||
Icon="avares://Saradomin/Resources/Icons/saradomin.ico"
|
||||
SystemDecorations="None"
|
||||
WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<Grid HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="Black"
|
||||
IsVisible="{Binding DimContent}"
|
||||
Opacity="0.7"
|
||||
ZIndex="99999" />
|
||||
<Border BorderBrush="{StaticResource DarkBorderBrush}"
|
||||
BorderThickness="2">
|
||||
<Grid RowDefinitions="24,*,32">
|
||||
<Grid Grid.Row="0"
|
||||
Margin="0,-1,0,0"
|
||||
Background="{StaticResource DarkBackgroundBrush}"
|
||||
ColumnDefinitions="Auto,*,Auto"
|
||||
PointerPressed="TitleBar_MouseDown">
|
||||
|
||||
<Button Grid.Column="0"
|
||||
Classes="CloseButton"
|
||||
Command="{Binding ExitApplication}"
|
||||
IsVisible="{Binding Launcher.PlaceCloseButtonOnLeft}"/>
|
||||
|
||||
<TextBlock Grid.Column="1"
|
||||
Grid.ColumnSpan="4"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding #MainWindow.Title}"
|
||||
TextAlignment="Center"
|
||||
FontSize="14"
|
||||
Foreground="{StaticResource AccentBrush}"
|
||||
FontFamily="Open Sans"
|
||||
FontWeight="Light" />
|
||||
<Button Grid.Column="0"
|
||||
Classes="CloseButton"
|
||||
Command="{Binding ExitApplication}"
|
||||
IsVisible="{Binding Launcher.PlaceCloseButtonOnLeft}" />
|
||||
|
||||
<Button Grid.Column="2"
|
||||
Classes="CloseButton"
|
||||
Command="{Binding ExitApplication}"
|
||||
IsVisible="{Binding !Launcher.PlaceCloseButtonOnLeft}"/>
|
||||
</Grid>
|
||||
<TextBlock Grid.Column="1"
|
||||
Grid.ColumnSpan="4"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="Open Sans"
|
||||
FontSize="14"
|
||||
FontWeight="Light"
|
||||
Foreground="{StaticResource AccentBrush}"
|
||||
Text="{Binding #MainWindow.Title}"
|
||||
TextAlignment="Center" />
|
||||
|
||||
<Grid Grid.Row="1"
|
||||
Grid.ZIndex="1"
|
||||
Margin="0,2,4,0"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Right"
|
||||
ColumnDefinitions="Auto,Auto,Auto,Auto">
|
||||
<Button Grid.Column="0"
|
||||
Classes="OutsideNavigator"
|
||||
Content="latest news"
|
||||
CornerRadius="8,0,0,8"
|
||||
Command="{Binding LaunchPage}"
|
||||
CommandParameter="news" />
|
||||
<Button Grid.Column="2"
|
||||
Classes="CloseButton"
|
||||
Command="{Binding ExitApplication}"
|
||||
IsVisible="{Binding !Launcher.PlaceCloseButtonOnLeft}" />
|
||||
</Grid>
|
||||
|
||||
<Button Grid.Column="1"
|
||||
Classes="OutsideNavigator"
|
||||
Content="found a bug?"
|
||||
Command="{Binding LaunchPage}"
|
||||
CommandParameter="issues" />
|
||||
<Grid Grid.Row="1"
|
||||
Margin="0,2,4,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
ColumnDefinitions="Auto,Auto,Auto,Auto,Auto"
|
||||
Grid.ZIndex="1">
|
||||
<Button Grid.Column="0"
|
||||
Classes="OutsideNavigator"
|
||||
Command="{Binding LaunchPage}"
|
||||
CommandParameter="news"
|
||||
Content="latest news"
|
||||
CornerRadius="8,0,0,8" />
|
||||
|
||||
<Button Grid.Column="2"
|
||||
Classes="OutsideNavigator"
|
||||
Content="hi-scores"
|
||||
Command="{Binding LaunchPage}"
|
||||
CommandParameter="hiscores" />
|
||||
<Button Grid.Column="1"
|
||||
Classes="OutsideNavigator"
|
||||
Command="{Binding LaunchPage}"
|
||||
CommandParameter="issues"
|
||||
Content="found a bug?" />
|
||||
|
||||
<Button Grid.Column="3"
|
||||
Classes="OutsideNavigator"
|
||||
Content="forums"
|
||||
CornerRadius="0,8,8,0"
|
||||
Command="{Binding LaunchPage}"
|
||||
CommandParameter="forums" />
|
||||
</Grid>
|
||||
<Button Grid.Column="2"
|
||||
Classes="OutsideNavigator"
|
||||
Command="{Binding LaunchPage}"
|
||||
CommandParameter="hiscores"
|
||||
Content="hi-scores" />
|
||||
|
||||
<TabControl Grid.Row="1"
|
||||
Grid.RowSpan="1"
|
||||
<Button Grid.Column="3"
|
||||
Classes="OutsideNavigator"
|
||||
Command="{Binding LaunchPage}"
|
||||
CommandParameter="discord"
|
||||
Content="discord" />
|
||||
|
||||
<Button Grid.Column="4"
|
||||
Classes="OutsideNavigator"
|
||||
Command="{Binding LaunchPage}"
|
||||
CommandParameter="forums"
|
||||
Content="forums"
|
||||
CornerRadius="0,8,8,0" />
|
||||
</Grid>
|
||||
|
||||
<TabControl Grid.Row="1"
|
||||
Grid.RowSpan="1"
|
||||
Background="Transparent"
|
||||
BorderBrush="{StaticResource DarkBorderBrush}"
|
||||
Classes="PageSelector">
|
||||
<TabItem Width="95"
|
||||
HorizontalContentAlignment="Center"
|
||||
CornerRadius="0,0,0,8"
|
||||
Header="what's new">
|
||||
<Border Margin="4,0,4,0"
|
||||
Background="{StaticResource MediumBackgroundBrush}"
|
||||
BorderBrush="{StaticResource SemiLightMediumBorderBrush}"
|
||||
BorderThickness="1,1,1,0"
|
||||
ClipToBounds="True"
|
||||
CornerRadius="6,6,0,0">
|
||||
<ScrollViewer HorizontalAlignment="Stretch"
|
||||
Classes="MainViewScrollViewer"
|
||||
ClipToBounds="True"
|
||||
Content="{Binding ContentContainer}"
|
||||
HorizontalScrollBarVisibility="Hidden"
|
||||
VerticalScrollBarVisibility="Visible" />
|
||||
</Border>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Width="95"
|
||||
HorizontalContentAlignment="Center"
|
||||
CornerRadius="0,0,8,0"
|
||||
Header="settings">
|
||||
<Border Margin="4,0,4,0"
|
||||
Background="{StaticResource MediumBackgroundBrush}"
|
||||
BorderBrush="{StaticResource SemiLightMediumBorderBrush}"
|
||||
BorderThickness="1,1,1,0"
|
||||
CornerRadius="6,6,0,0">
|
||||
<ScrollViewer Classes="MainViewScrollViewer"
|
||||
HorizontalScrollBarVisibility="Hidden"
|
||||
VerticalScrollBarVisibility="Visible">
|
||||
<controls:SettingsView VerticalAlignment="Stretch" />
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
<Border Grid.Row="2"
|
||||
Background="Transparent"
|
||||
Classes="PageSelector"
|
||||
BorderBrush="{StaticResource DarkBorderBrush}">
|
||||
<TabItem Header="what's new"
|
||||
CornerRadius="0,0,0,8"
|
||||
HorizontalContentAlignment="Center"
|
||||
Width="95">
|
||||
<Border CornerRadius="6,6,0,0"
|
||||
Margin="4,0,4,0"
|
||||
BorderBrush="{StaticResource SemiLightMediumBorderBrush}"
|
||||
BorderThickness="1,1,1,0"
|
||||
Background="{StaticResource MediumBackgroundBrush}"
|
||||
ClipToBounds="True">
|
||||
<ScrollViewer Classes="MainViewScrollViewer"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalScrollBarVisibility="Visible"
|
||||
HorizontalScrollBarVisibility="Hidden"
|
||||
ClipToBounds="True"
|
||||
Content="{Binding ContentContainer}" />
|
||||
</Border>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="settings"
|
||||
CornerRadius="0,0,8,0"
|
||||
HorizontalContentAlignment="Center"
|
||||
Width="95">
|
||||
<Border CornerRadius="6,6,0,0"
|
||||
Margin="4,0,4,0"
|
||||
BorderBrush="{StaticResource SemiLightMediumBorderBrush}"
|
||||
BorderThickness="1,1,1,0"
|
||||
Background="{StaticResource MediumBackgroundBrush}">
|
||||
<ScrollViewer Classes="MainViewScrollViewer"
|
||||
VerticalScrollBarVisibility="Visible"
|
||||
HorizontalScrollBarVisibility="Hidden">
|
||||
<controls:SettingsView VerticalAlignment="Stretch" />
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
<Border Grid.Row="2"
|
||||
Background="Transparent"
|
||||
BorderBrush="{StaticResource DarkMediumBorderBrush}"
|
||||
BorderThickness="0,1,0,0">
|
||||
<Button Classes="OutsideNavigator"
|
||||
Width="NaN"
|
||||
Height="NaN"
|
||||
Margin="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Command="{Binding ExecuteLaunchSequence}"
|
||||
Content="{Binding LaunchText}">
|
||||
</Button>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
BorderBrush="{StaticResource DarkMediumBorderBrush}"
|
||||
BorderThickness="0,1,0,0">
|
||||
<Button Width="NaN"
|
||||
Height="NaN"
|
||||
Margin="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Classes="OutsideNavigator"
|
||||
Command="{Binding ExecuteLaunchSequence}"
|
||||
Content="{Binding LaunchText}">
|
||||
</Button>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</glitonea:WindowEx>
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ using Avalonia.Controls;
|
|||
using Avalonia.Input;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using PropertyChanged;
|
||||
using Saradomin.Messaging;
|
||||
using Saradomin.Infrastructure.Messaging;
|
||||
|
||||
namespace Saradomin.Views.Windows
|
||||
namespace Saradomin.View.Windows
|
||||
{
|
||||
[DoNotNotify]
|
||||
public class MainWindow : Window
|
||||
|
|
|
|||
56
Saradomin/View/Windows/NotificationBox.axaml
Normal file
56
Saradomin/View/Windows/NotificationBox.axaml
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<glitonea:WindowEx x:Class="Saradomin.View.Windows.NotificationBox"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:glitonea="clr-namespace:Glitonea;assembly=Glitonea"
|
||||
xmlns:mvvm="clr-namespace:Glitonea.Mvvm;assembly=Glitonea"
|
||||
xmlns:windows="clr-namespace:Saradomin.ViewModel.Windows"
|
||||
Name="NotificationBox"
|
||||
Title="{Binding Title}"
|
||||
Height="120"
|
||||
MaxWidth="400"
|
||||
Background="{StaticResource WindowBackgroundBrush}"
|
||||
CanResize="False"
|
||||
DataContext="{Binding #NotificationBox}"
|
||||
ShowActivated="True"
|
||||
ShowInTaskbar="False"
|
||||
SizeToContent="WidthAndHeight"
|
||||
SystemDecorations="None"
|
||||
WindowStartupLocation="CenterOwner">
|
||||
<Border BorderBrush="{StaticResource AccentBrush}"
|
||||
BorderThickness="1">
|
||||
<Grid RowDefinitions="24,*,32">
|
||||
<Grid Grid.Row="0"
|
||||
Background="{StaticResource DarkBackgroundBrush}">
|
||||
<TextBlock HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="Open Sans"
|
||||
FontSize="14"
|
||||
FontWeight="Light"
|
||||
Foreground="{StaticResource AccentBrush}"
|
||||
Text="{Binding #NotificationBox.Title}"
|
||||
TextAlignment="Center">
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="1"
|
||||
Margin="8">
|
||||
<TextBlock Text="{Binding Message}"
|
||||
TextAlignment="Center"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
|
||||
<Border Grid.Row="2"
|
||||
Background="Transparent"
|
||||
BorderThickness="0,0,0,0">
|
||||
<Button Width="NaN"
|
||||
Height="NaN"
|
||||
Margin="4,0,4,4"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Classes="OutsideNavigator"
|
||||
Command="{Binding Close}"
|
||||
Content="OK" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</glitonea:WindowEx>
|
||||
77
Saradomin/View/Windows/NotificationBox.axaml.cs
Normal file
77
Saradomin/View/Windows/NotificationBox.axaml.cs
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using PropertyChanged;
|
||||
using Saradomin.Infrastructure.Messaging;
|
||||
|
||||
namespace Saradomin.View.Windows
|
||||
{
|
||||
[DoNotNotify]
|
||||
public class NotificationBox : Window
|
||||
{
|
||||
public static NotificationBox Current { get; private set; }
|
||||
|
||||
public static readonly StyledProperty<string> MessageProperty = new(
|
||||
nameof(Message),
|
||||
typeof(NotificationBox),
|
||||
new StyledPropertyMetadata<string>(
|
||||
"This is supposed to be a message.\n" +
|
||||
"Someone messed up, though, so have this placeholder instead."
|
||||
)
|
||||
);
|
||||
|
||||
public string Message
|
||||
{
|
||||
get => GetValue(MessageProperty);
|
||||
set => SetValue(MessageProperty, value);
|
||||
}
|
||||
|
||||
public NotificationBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private NotificationBox(string message)
|
||||
: this("Notification", message)
|
||||
{
|
||||
}
|
||||
|
||||
private NotificationBox(string title, string message)
|
||||
: this()
|
||||
{
|
||||
Title = title;
|
||||
Message = message;
|
||||
}
|
||||
|
||||
public static void DisplayNotification(string title, string message, Window owner)
|
||||
{
|
||||
if (Current != null)
|
||||
{
|
||||
Current.Activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
Current = new NotificationBox(title, message);
|
||||
Current.ShowDialog(owner);
|
||||
|
||||
App.Messenger.Send(new NotificationBoxStateChangedMessage(true));
|
||||
}
|
||||
}
|
||||
|
||||
public new void Close()
|
||||
{
|
||||
if (Current != null)
|
||||
{
|
||||
Current = null;
|
||||
base.Close();
|
||||
|
||||
App.Messenger.Send(new NotificationBoxStateChangedMessage(false));
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -10,10 +10,10 @@ using Avalonia.Controls;
|
|||
using Glitonea.Extensions;
|
||||
using Glitonea.Mvvm;
|
||||
using Glitonea.Utilities;
|
||||
using Saradomin.Messaging;
|
||||
using Saradomin.Infrastructure.Messaging;
|
||||
using Saradomin.Infrastructure.Services;
|
||||
using Saradomin.Model.Settings.Client;
|
||||
using Saradomin.Model.Settings.Launcher;
|
||||
using Saradomin.Services;
|
||||
using Saradomin.Utilities;
|
||||
|
||||
namespace Saradomin.ViewModel.Controls
|
||||
|
|
|
|||
|
|
@ -2,16 +2,15 @@ using System;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Metadata;
|
||||
using Glitonea.Mvvm;
|
||||
using HtmlAgilityPack;
|
||||
using Saradomin.Messaging;
|
||||
using Saradomin.Infrastructure.Messaging;
|
||||
using Saradomin.Infrastructure.Services;
|
||||
using Saradomin.Model.Settings.Launcher;
|
||||
using Saradomin.Services;
|
||||
using Saradomin.Utilities;
|
||||
|
||||
namespace Saradomin.ViewModel.Windows
|
||||
|
|
@ -29,10 +28,11 @@ namespace Saradomin.ViewModel.Windows
|
|||
private LauncherSettings Launcher { get; }
|
||||
|
||||
public string Title { get; set; } = "2009scape launcher";
|
||||
|
||||
|
||||
public bool CanLaunch { get; private set; } = true;
|
||||
public string LaunchText { get; private set; } = "Play!";
|
||||
|
||||
public bool DimContent { get; private set; }
|
||||
public StackPanel ContentContainer { get; private set; }
|
||||
|
||||
public MainWindowViewModel(IClientLaunchService launchService,
|
||||
|
|
@ -55,6 +55,7 @@ namespace Saradomin.ViewModel.Windows
|
|||
|
||||
App.Messenger.Register<MainViewLoadedMessage>(this, MainViewLoaded);
|
||||
App.Messenger.Register<SettingsModifiedMessage>(this, SettingsModified);
|
||||
App.Messenger.Register<NotificationBoxStateChangedMessage>(this, NotificatationBoxStateChanged);
|
||||
|
||||
if (!JavaExecutableValid)
|
||||
{
|
||||
|
|
@ -81,7 +82,7 @@ namespace Saradomin.ViewModel.Windows
|
|||
doc.Load(await response.Content.ReadAsStreamAsync());
|
||||
node = doc.DocumentNode.SelectSingleNode("//div[@class='msgcontents']");
|
||||
}
|
||||
catch (HttpRequestException ignored)
|
||||
catch (HttpRequestException)
|
||||
{
|
||||
doc.LoadHtml("<html><h3>Not Available<h3><br/><body>This content is unavailable, likely due to a lack of an internet connection.</body></html>");
|
||||
node = doc.DocumentNode;
|
||||
|
|
@ -109,6 +110,11 @@ namespace Saradomin.ViewModel.Windows
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void NotificatationBoxStateChanged(NotificationBoxStateChangedMessage msg)
|
||||
{
|
||||
DimContent = msg.WasOpened;
|
||||
}
|
||||
|
||||
public void LaunchPage(string parameter)
|
||||
{
|
||||
|
|
@ -117,7 +123,8 @@ namespace Saradomin.ViewModel.Windows
|
|||
"news" => "https://2009scape.org/services/m=news/archives/latest.html",
|
||||
"issues" => "https://gitlab.com/2009scape/2009scape/-/issues",
|
||||
"hiscores" => "https://2009scape.org/services/m=hiscore/hiscores.html?world=2",
|
||||
"forums" => "https://forum.2009scape.org/",
|
||||
"forums" => "https://forum.2009scape.org",
|
||||
"discord" => "https://discord.gg/43YPGND",
|
||||
_ => throw new ArgumentException($"{parameter} is not a valid page parameter.")
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue