migration to avalonia almost complete
This commit is contained in:
parent
27746cbddd
commit
9e0f9ad1a6
@ -1,11 +1,8 @@
|
|||||||
<Application xmlns="https://github.com/avaloniaui"
|
<Application x:Class="launcher_client_avalonia.GUI.App"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns="https://github.com/avaloniaui"
|
||||||
x:Class="launcher_client_avalonia.GUI.App">
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<Application.Styles>
|
|
||||||
<FluentTheme Mode="Dark"/>
|
|
||||||
</Application.Styles>
|
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
<SolidColorBrush x:Key="MyBackgroundColor" Color="#232328"/>
|
<SolidColorBrush x:Key="MyBackgroundColor" Color="#232328" />
|
||||||
<SolidColorBrush x:Key="MyDarkTr"
|
<SolidColorBrush x:Key="MyDarkTr"
|
||||||
Opacity="0.8"
|
Opacity="0.8"
|
||||||
Color="#141419" />
|
Color="#141419" />
|
||||||
@ -15,4 +12,13 @@
|
|||||||
<SolidColorBrush x:Key="MyRed" Color="#E5160A" />
|
<SolidColorBrush x:Key="MyRed" Color="#E5160A" />
|
||||||
<SolidColorBrush x:Key="MySelectionColor" Color="#B7800A" />
|
<SolidColorBrush x:Key="MySelectionColor" Color="#B7800A" />
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
|
|
||||||
|
<Application.Styles>
|
||||||
|
<FluentTheme Mode="Dark" />
|
||||||
|
|
||||||
|
<Style x:Name="MyTextBoxStyle" Selector="TextBox.MyTextBoxStyle"/>
|
||||||
|
<Style x:Name="MyLabelStyle" Selector="Label.MyLabelStyle"/>
|
||||||
|
<Style x:Name="MyButtonStyle" Selector="Button.MyButtonStyle"/>
|
||||||
|
|
||||||
|
</Application.Styles>
|
||||||
</Application>
|
</Application>
|
||||||
|
|||||||
@ -1,24 +1,24 @@
|
|||||||
using Avalonia;
|
global using Avalonia;
|
||||||
using Avalonia.Controls.ApplicationLifetimes;
|
global using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
global using Avalonia.Media;
|
||||||
|
global using Avalonia.Media.Imaging;
|
||||||
|
global using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
namespace launcher_client_avalonia
|
namespace launcher_client_avalonia
|
||||||
{
|
{
|
||||||
public partial class App : Application
|
public partial class App : Application
|
||||||
{
|
{
|
||||||
|
public static SolidColorBrush MyDark, MySoftDark, MyWhite, MyGreen, MyOrange, MySelectionColor;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
AvaloniaXamlLoader.Load(this);
|
AvaloniaXamlLoader.Load(this);
|
||||||
}
|
MyDark = (SolidColorBrush)Resources["MyDarkTr"];
|
||||||
|
MySoftDark = (SolidColorBrush)Resources["MyGray"];
|
||||||
public override void OnFrameworkInitializationCompleted()
|
MyWhite = (SolidColorBrush)Resources["MyWhite"];
|
||||||
{
|
MyGreen = (SolidColorBrush)Resources["MyGreen"];
|
||||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
MyOrange = (SolidColorBrush)Resources["MySelectionColor"];
|
||||||
{
|
MySelectionColor = (SolidColorBrush)Resources["MySelectionColor"];
|
||||||
desktop.MainWindow = new MainWindow();
|
|
||||||
}
|
|
||||||
|
|
||||||
base.OnFrameworkInitializationCompleted();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8,92 +8,61 @@
|
|||||||
MinWidth="800"
|
MinWidth="800"
|
||||||
MinHeight="500"
|
MinHeight="500"
|
||||||
Background="{DynamicResource MyBackgroundColor}">
|
Background="{DynamicResource MyBackgroundColor}">
|
||||||
<Grid>
|
<Grid ColumnDefinitions="5,*,5" RowDefinitions="5,40,5,*,5">
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="5" />
|
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition Width="5" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="5" />
|
|
||||||
<RowDefinition Height="40" />
|
|
||||||
<RowDefinition Height="5" />
|
|
||||||
<RowDefinition />
|
|
||||||
<RowDefinition Height="5" />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Image x:Name="BackgroundImage"
|
<Image x:Name="BackgroundImage"
|
||||||
Grid.RowSpan="5"
|
Grid.RowSpan="5"
|
||||||
Grid.ColumnSpan="3"
|
Grid.ColumnSpan="3"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Stretch="UniformToFill" />
|
Stretch="UniformToFill" />
|
||||||
|
|
||||||
<Grid Grid.Row="1" Grid.Column="1">
|
<Grid x:Name="TopPanelGrid"
|
||||||
<Grid.ColumnDefinitions>
|
Grid.Row="1"
|
||||||
<ColumnDefinition />
|
Grid.Column="1"
|
||||||
<ColumnDefinition Width="5" />
|
ColumnDefinitions="*,5,*,5,*,5,*">
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition Width="5" />
|
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition Width="5" />
|
|
||||||
<ColumnDefinition />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<local:TabButton x:Name="LibraryButton"
|
<local:TabButton x:Name="LibraryButton"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Content="Library"
|
Content="Library"
|
||||||
FontSize="18"
|
FontSize="18"
|
||||||
Style="{DynamicResource MyButtonStyle}" />
|
Classes="MyButtonStyle" />
|
||||||
<local:TabButton x:Name="DownloadsButton"
|
<local:TabButton x:Name="DownloadsButton"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
Content="Downloads"
|
Content="Downloads"
|
||||||
FontSize="18"
|
FontSize="18"
|
||||||
Style="{DynamicResource MyButtonStyle}" />
|
Classes="MyButtonStyle" />
|
||||||
<local:TabButton x:Name="LogButton"
|
<local:TabButton x:Name="LogButton"
|
||||||
Grid.Column="4"
|
Grid.Column="4"
|
||||||
Content="Log"
|
Content="Log"
|
||||||
FontSize="18"
|
FontSize="18"
|
||||||
Style="{DynamicResource MyButtonStyle}" />
|
Classes="MyButtonStyle" />
|
||||||
<local:TabButton x:Name="SettingsButton"
|
<local:TabButton x:Name="SettingsButton"
|
||||||
Grid.Column="6"
|
Grid.Column="6"
|
||||||
Content="Settings"
|
Content="Settings"
|
||||||
FontSize="18"
|
FontSize="18"
|
||||||
Style="{DynamicResource MyButtonStyle}" />
|
Classes="MyButtonStyle" />
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid x:Name="LibraryGrid"
|
<Grid x:Name="LibraryGrid"
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Visibility="Visible">
|
ColumnDefinitions="220,5,*,5,220"
|
||||||
<Grid.ColumnDefinitions>
|
IsVisible="true">
|
||||||
<ColumnDefinition Width="220" />
|
|
||||||
<ColumnDefinition Width="5" />
|
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition Width="5" />
|
|
||||||
<ColumnDefinition Width="220" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<ScrollViewer Grid.Column="0"
|
<ScrollViewer Grid.Column="0"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
Template="{DynamicResource myScrollViewer}"
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||||
VerticalScrollBarVisibility="Auto">
|
Template="{DynamicResource myScrollViewer}">
|
||||||
<StackPanel x:Name="ProgramsPanel" />
|
<StackPanel x:Name="ProgramsPanel" />
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
<Grid x:Name="ProgramGrid" Grid.Column="2">
|
<Grid x:Name="ProgramGrid"
|
||||||
<Grid.RowDefinitions>
|
Grid.Column="2"
|
||||||
<RowDefinition Height="35" />
|
RowDefinitions="35,5,35,5,70,5,*">
|
||||||
<RowDefinition Height="5" />
|
|
||||||
<RowDefinition Height="35" />
|
|
||||||
<RowDefinition Height="5" />
|
|
||||||
<RowDefinition Height="70" />
|
|
||||||
<RowDefinition Height="5" />
|
|
||||||
<RowDefinition Height="*" />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Label x:Name="NameLabel"
|
<Label x:Name="NameLabel"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Content="name"
|
Content="name"
|
||||||
FontSize="19"
|
FontSize="19"
|
||||||
FontWeight="Bold"
|
FontWeight="Bold"
|
||||||
Style="{DynamicResource MyLabelStyle}" />
|
Classes="MyLabelStyle" />
|
||||||
<StackPanel Grid.Row="2"
|
<StackPanel Grid.Row="2"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
ClipToBounds="True"
|
ClipToBounds="True"
|
||||||
@ -103,53 +72,44 @@
|
|||||||
Margin="2,0"
|
Margin="2,0"
|
||||||
Background="{DynamicResource MyRed}"
|
Background="{DynamicResource MyRed}"
|
||||||
Content="Remove"
|
Content="Remove"
|
||||||
Style="{DynamicResource MyButtonStyle}" />
|
Classes="MyButtonStyle" />
|
||||||
<Button x:Name="InstallButton"
|
<Button x:Name="InstallButton"
|
||||||
Width="100"
|
Width="100"
|
||||||
Margin="2,0"
|
Margin="2,0"
|
||||||
Content="Install"
|
Content="Install"
|
||||||
Style="{DynamicResource MyButtonStyle}" />
|
Classes="MyButtonStyle" />
|
||||||
<Button x:Name="UpdateButton"
|
<Button x:Name="UpdateButton"
|
||||||
Width="100"
|
Width="100"
|
||||||
Margin="2,0"
|
Margin="2,0"
|
||||||
Content="Update"
|
Content="Update"
|
||||||
Style="{DynamicResource MyButtonStyle}" />
|
Classes="MyButtonStyle" />
|
||||||
<Button x:Name="LaunchButton"
|
<Button x:Name="LaunchButton"
|
||||||
Width="100"
|
Width="100"
|
||||||
Margin="2,0"
|
Margin="2,0"
|
||||||
Background="{DynamicResource MyGreen}"
|
Background="{DynamicResource MyGreen}"
|
||||||
Content="Launch"
|
Content="Launch"
|
||||||
Style="{DynamicResource MyButtonStyle}" />
|
Classes="MyButtonStyle" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<TextBox x:Name="DescriptionBox"
|
<TextBox x:Name="DescriptionBox"
|
||||||
Grid.Row="4"
|
Grid.Row="4"
|
||||||
Style="{DynamicResource MyTextBoxStyle}"
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||||
VerticalScrollBarVisibility="Auto" />
|
Classes="MyTextBoxStyle" />
|
||||||
<TextBox x:Name="ProgramLogBox"
|
<TextBox x:Name="ProgramLogBox"
|
||||||
Grid.Row="6"
|
Grid.Row="6"
|
||||||
Style="{DynamicResource MyTextBoxStyle}"
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||||
VerticalScrollBarVisibility="Auto" />
|
Classes="MyTextBoxStyle" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid Grid.Row="0" Grid.Column="4">
|
<Grid Grid.Row="0"
|
||||||
<Grid.RowDefinitions>
|
Grid.Column="4"
|
||||||
<RowDefinition Height="95" />
|
RowDefinitions="95,*">
|
||||||
<RowDefinition />
|
<Grid Grid.Row="0"
|
||||||
</Grid.RowDefinitions>
|
ColumnDefinitions="*,*"
|
||||||
<Grid Grid.Row="0">
|
RowDefinitions="30,30,30">
|
||||||
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="30" />
|
|
||||||
<RowDefinition Height="30" />
|
|
||||||
<RowDefinition Height="30" />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Label Grid.Row="0"
|
<Label Grid.Row="0"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Content="version:"
|
Content="version:"
|
||||||
Style="{DynamicResource MyLabelStyle}" />
|
Classes="MyLabelStyle" />
|
||||||
<ComboBox Grid.Row="0"
|
<ComboBox Grid.Row="0"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Background="{DynamicResource MyDarkTr}"
|
Background="{DynamicResource MyDarkTr}"
|
||||||
@ -157,27 +117,27 @@
|
|||||||
<ComboBoxItem IsSelected="True">
|
<ComboBoxItem IsSelected="True">
|
||||||
<Label Background="Transparent"
|
<Label Background="Transparent"
|
||||||
Content="v1"
|
Content="v1"
|
||||||
Style="{DynamicResource MyLabelStyle}" />
|
Classes="MyLabelStyle" />
|
||||||
</ComboBoxItem>
|
</ComboBoxItem>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<Label Grid.Row="1"
|
<Label Grid.Row="1"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Content="directory:"
|
Content="directory:"
|
||||||
Style="{DynamicResource MyLabelStyle}" />
|
Classes="MyLabelStyle" />
|
||||||
<Label Name="ProgramDirectoryLabel"
|
<Label Name="ProgramDirectoryLabel"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Content="0"
|
Content="0"
|
||||||
Style="{DynamicResource MyLabelStyle}" />
|
Classes="MyLabelStyle" />
|
||||||
<Label Grid.Row="2"
|
<Label Grid.Row="2"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Content="size:"
|
Content="size:"
|
||||||
Style="{DynamicResource MyLabelStyle}" />
|
Classes="MyLabelStyle" />
|
||||||
<Label Name="ProgramSizeLabel"
|
<Label Name="ProgramSizeLabel"
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Content="0"
|
Content="0"
|
||||||
Style="{DynamicResource MyLabelStyle}" />
|
Classes="MyLabelStyle" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<ScrollViewer Name="ProgramSettingsViever"
|
<ScrollViewer Name="ProgramSettingsViever"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
@ -192,32 +152,29 @@
|
|||||||
<Grid x:Name="DownloadsGrid"
|
<Grid x:Name="DownloadsGrid"
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Visibility="Hidden" />
|
IsVisible="false" />
|
||||||
|
|
||||||
<Grid x:Name="LogGrid"
|
<Grid x:Name="LogGrid"
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Visibility="Hidden">
|
IsVisible="false"
|
||||||
<Grid.RowDefinitions>
|
RowDefinitions="30,*">
|
||||||
<RowDefinition Height="30" />
|
|
||||||
<RowDefinition />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Label x:Name="LogfileLabel"
|
<Label x:Name="LogfileLabel"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Content="logfile"
|
Content="logfile"
|
||||||
FontStyle="Italic"
|
FontStyle="Italic"
|
||||||
Style="{DynamicResource MyLabelStyle}" />
|
Classes="MyLabelStyle" />
|
||||||
<TextBox x:Name="LogBox"
|
<TextBox x:Name="LogBox"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Style="{DynamicResource MyTextBoxStyle}"
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||||
VerticalScrollBarVisibility="Auto" />
|
Classes="MyTextBoxStyle" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid x:Name="SettingsGrid"
|
<Grid x:Name="SettingsGrid"
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Visibility="Hidden" />
|
IsVisible="false" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
@ -1,4 +1,7 @@
|
|||||||
namespace launcher_client_avalonia.GUI;
|
using Avalonia.Interactivity;
|
||||||
|
using Avalonia.Threading;
|
||||||
|
|
||||||
|
namespace launcher_client_avalonia.GUI;
|
||||||
|
|
||||||
public partial class LauncherWindow : Window
|
public partial class LauncherWindow : Window
|
||||||
{
|
{
|
||||||
@ -10,10 +13,10 @@ public partial class LauncherWindow : Window
|
|||||||
LogBox.Text = Logger.Buffer;
|
LogBox.Text = Logger.Buffer;
|
||||||
Logger.MessageSent += LogHandler;
|
Logger.MessageSent += LogHandler;
|
||||||
LogfileLabel.Content = Logger.Logfile.Remove(0,Logger.Logfile.LastIndexOf(Путь.Разд)+1);
|
LogfileLabel.Content = Logger.Logfile.Remove(0,Logger.Logfile.LastIndexOf(Путь.Разд)+1);
|
||||||
LogfileLabel.MouseLeftButtonDown += (s,e)=>
|
LogfileLabel.PointerPressed += (_,_)=>
|
||||||
Process.Start("explorer.exe", Logger.Logfile.Remove(Logger.Logfile.LastIndexOf(Путь.Разд)));
|
Process.Start("explorer.exe", Logger.Logfile.Remove(Logger.Logfile.LastIndexOf(Путь.Разд)));
|
||||||
LogfileLabel.MouseEnter += (s,e)=>LogfileLabel.Foreground=App.MySelectionColor;
|
LogfileLabel.PointerEnter += (_,_)=>LogfileLabel.Foreground=App.MySelectionColor;
|
||||||
LogfileLabel.MouseLeave += (s,e)=>LogfileLabel.Foreground=App.MyWhite;
|
LogfileLabel.PointerLeave += (_,_)=>LogfileLabel.Foreground=App.MyWhite;
|
||||||
LibraryButton.TabGrid = LibraryGrid;
|
LibraryButton.TabGrid = LibraryGrid;
|
||||||
DownloadsButton.TabGrid = DownloadsGrid;
|
DownloadsButton.TabGrid = DownloadsGrid;
|
||||||
LogButton.TabGrid = LogGrid;
|
LogButton.TabGrid = LogGrid;
|
||||||
@ -22,7 +25,7 @@ public partial class LauncherWindow : Window
|
|||||||
DownloadsButton.Click += SelectTab;
|
DownloadsButton.Click += SelectTab;
|
||||||
LogButton.Click += SelectTab;
|
LogButton.Click += SelectTab;
|
||||||
SettingsButton.Click += SelectTab;
|
SettingsButton.Click += SelectTab;
|
||||||
ProgramGrid.Visibility = Visibility.Hidden;
|
ProgramGrid.IsVisible = false;
|
||||||
SelectTab(LibraryButton, null);
|
SelectTab(LibraryButton, null);
|
||||||
FillProgramsPanel();
|
FillProgramsPanel();
|
||||||
Logger.Log("launcher started");
|
Logger.Log("launcher started");
|
||||||
@ -31,7 +34,7 @@ public partial class LauncherWindow : Window
|
|||||||
{ LogError("LAUNCHER WINDOW INIT",ex); }
|
{ LogError("LAUNCHER WINDOW INIT",ex); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogHandler(string m) => Dispatcher.Invoke(()=>LogBox.Text += m);
|
void LogHandler(string m) => Dispatcher.UIThread.InvokeAsync(()=>LogBox.Text += m);
|
||||||
|
|
||||||
|
|
||||||
private TabButton CurrentTab;
|
private TabButton CurrentTab;
|
||||||
@ -40,11 +43,11 @@ public partial class LauncherWindow : Window
|
|||||||
if(CurrentTab!=null)
|
if(CurrentTab!=null)
|
||||||
{
|
{
|
||||||
CurrentTab.Background = App.MyDark;
|
CurrentTab.Background = App.MyDark;
|
||||||
CurrentTab.TabGrid.Visibility = Visibility.Collapsed;
|
CurrentTab.TabGrid.IsVisible = false;
|
||||||
}
|
}
|
||||||
var selected = (TabButton)sender;
|
var selected = (TabButton)sender;
|
||||||
selected.Background = App.MySelectionColor;
|
selected.Background = App.MySelectionColor;
|
||||||
selected.TabGrid.Visibility = Visibility.Visible;
|
selected.TabGrid.IsVisible = true;
|
||||||
CurrentTab = selected;
|
CurrentTab = selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,19 +79,17 @@ public partial class LauncherWindow : Window
|
|||||||
if (DisplayingProgram != null)
|
if (DisplayingProgram != null)
|
||||||
{
|
{
|
||||||
DisplayingProgram.ProgramLabel.Foreground = App.MyWhite;
|
DisplayingProgram.ProgramLabel.Foreground = App.MyWhite;
|
||||||
DisplayingProgram.ProgramLabel.FontWeight = FontWeights.Normal;
|
DisplayingProgram.ProgramLabel.FontWeight = FontWeight.Normal;
|
||||||
}
|
}
|
||||||
else ProgramGrid.Visibility = Visibility.Visible;
|
else ProgramGrid.IsVisible = true;
|
||||||
|
|
||||||
selectedProg.ProgramLabel.Foreground = App.MySelectionColor;
|
selectedProg.ProgramLabel.Foreground = App.MySelectionColor;
|
||||||
selectedProg.ProgramLabel.FontWeight = FontWeights.Bold;
|
selectedProg.ProgramLabel.FontWeight = FontWeight.Bold;
|
||||||
|
|
||||||
NameLabel.Content = selectedProg.Name;
|
NameLabel.Content = selectedProg.Name;
|
||||||
DescriptionBox.Text = selectedProg.Description;
|
DescriptionBox.Text = selectedProg.Description;
|
||||||
BackgroundImage.Source =
|
BackgroundImage.Source = new Bitmap(
|
||||||
new BitmapImage(new Uri(
|
$"{Directory.GetCurrent()}{Путь.Разд}backgrounds{Путь.Разд}{selectedProg.BackgroundFile}");
|
||||||
$"{Directory.GetCurrent()}{Путь.Разд}backgrounds{Путь.Разд}{selectedProg.BackgroundFile}",
|
|
||||||
UriKind.Absolute));
|
|
||||||
ProgramSettingsViever.Content = selectedProg.SettingsPanel;
|
ProgramSettingsViever.Content = selectedProg.SettingsPanel;
|
||||||
DisplayingProgram = selectedProg;
|
DisplayingProgram = selectedProg;
|
||||||
}
|
}
|
||||||
@ -1,9 +1,9 @@
|
|||||||
<Window xmlns="https://github.com/avaloniaui"
|
<Window x:Class="launcher_client_avalonia.GUI.MessageBox"
|
||||||
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
Title="MessageBox"
|
||||||
x:Class="launcher_client_avalonia.GUI.MessageBox"
|
d:DesignHeight="450"
|
||||||
Title="MessageBox">
|
d:DesignWidth="800"
|
||||||
|
mc:Ignorable="d" />
|
||||||
</Window>
|
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
using Avalonia.Markup.Xaml;
|
namespace launcher_client_avalonia.GUI;
|
||||||
|
|
||||||
namespace launcher_client_avalonia.GUI;
|
|
||||||
|
|
||||||
public partial class MessageBox : Window
|
public partial class MessageBox : Window
|
||||||
{
|
{
|
||||||
@ -12,7 +10,7 @@ public partial class MessageBox : Window
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Show(string text)
|
public static void Show(string title, string text)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,8 +6,8 @@ public partial class ProgramLabel : UserControl
|
|||||||
{
|
{
|
||||||
AvaloniaXamlLoader.Load(this);
|
AvaloniaXamlLoader.Load(this);
|
||||||
NameLabel.Content = label;
|
NameLabel.Content = label;
|
||||||
IconImage.Source = new BitmapImage(new Uri(
|
|
||||||
$"{Directory.GetCurrent()}{Путь.Разд}icons{Путь.Разд}{icon}",
|
IconImage.Source = new Bitmap(
|
||||||
UriKind.Absolute));
|
$"{Directory.GetCurrent()}{Путь.Разд}icons{Путь.Разд}{icon}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
23
launcher-client-avalonia/GUI/ProgramSettingsPanelItem.axaml
Normal file
23
launcher-client-avalonia/GUI/ProgramSettingsPanelItem.axaml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<UserControl x:Class="launcher_client_avalonia.GUI.ProgramSettingsPanelItem"
|
||||||
|
xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:launcher_client_avalonia.GUI"
|
||||||
|
Background="Transparent">
|
||||||
|
<Grid ColumnDefinitions="*,*">
|
||||||
|
<Label Name="KeyLabel"
|
||||||
|
Grid.Column="0"
|
||||||
|
Content="{Binding $parent[local:ProgramSettingsPanelItem].SettingKey}"
|
||||||
|
FontFamily="default"
|
||||||
|
FontSize="16"
|
||||||
|
Classes="MyLabelStyle"
|
||||||
|
ToolTip.Tip="{Binding $self.Content}">
|
||||||
|
</Label>
|
||||||
|
<TextBox Name="ValueBox"
|
||||||
|
Grid.Column="1"
|
||||||
|
IsReadOnly="False"
|
||||||
|
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||||
|
ScrollViewer.VerticalScrollBarVisibility="Disabled"
|
||||||
|
Classes="MyTextBoxStyle"
|
||||||
|
Text="{Binding $parent[local:ProgramSettingsPanelItem].SettingValue}" />
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@ -11,13 +11,12 @@ public partial class ProgramSettingsPanelItem : UserControl
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
SetValue(SettingKeyProp, value);
|
SetValue(SettingKeyProp, value);
|
||||||
|
/*KeyLabel.ToolTip = new ToolTip
|
||||||
KeyLabel.ToolTip = new ToolTip
|
|
||||||
{
|
{
|
||||||
Content = value,
|
Content = value,
|
||||||
Foreground = App.MyWhite,
|
Foreground = App.MyWhite,
|
||||||
Background = App.MySoftDark
|
Background = App.MySoftDark
|
||||||
};
|
};*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,6 +35,7 @@ public partial class ProgramSettingsPanelItem : UserControl
|
|||||||
AvaloniaXamlLoader.Load(this);
|
AvaloniaXamlLoader.Load(this);
|
||||||
SettingKey = key;
|
SettingKey = key;
|
||||||
SettingValue = value;
|
SettingValue = value;
|
||||||
ValueBox.TextChanged += (_,_)=> UpdatedEvent?.Invoke(this);
|
//TODO invoke UpdatedEvent only when focus changed
|
||||||
|
ValueBox.TextInput += (_,_)=> UpdatedEvent?.Invoke(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,23 +0,0 @@
|
|||||||
<UserControl x:Class="launcher_client_avalonia.GUI.ProgramSettingsPanelItem"
|
|
||||||
xmlns="https://github.com/avaloniaui"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:local="clr-namespace:launcher_client_avalonia.GUI"
|
|
||||||
Background="Transparent">
|
|
||||||
<Grid>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Label Name="KeyLabel" Grid.Column="0"
|
|
||||||
Content="{Binding SettingKey, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ProgramSettingsPanelItem}}"
|
|
||||||
Style="{DynamicResource MyLabelStyle}"
|
|
||||||
FontFamily="default"
|
|
||||||
FontSize="16"/>
|
|
||||||
<TextBox Name="ValueBox" Grid.Column="1"
|
|
||||||
HorizontalScrollBarVisibility="Auto"
|
|
||||||
Style="{DynamicResource MyTextBoxStyle}"
|
|
||||||
VerticalScrollBarVisibility="Disabled"
|
|
||||||
IsReadOnly="False"
|
|
||||||
Text="{Binding SettingValue, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ProgramSettingsPanelItem}}"/>
|
|
||||||
</Grid>
|
|
||||||
</UserControl>
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
namespace launcher_client_avalonia.GUI;
|
namespace launcher_client_avalonia.GUI;
|
||||||
|
|
||||||
public class TabButton : Button
|
public partial class TabButton : Button
|
||||||
{
|
{
|
||||||
public static readonly StyledProperty<Grid> TabGridProp = AvaloniaProperty.Register<TabButton, Grid>("TabGrid");
|
public static readonly StyledProperty<Grid> TabGridProp = AvaloniaProperty.Register<TabButton, Grid>("TabGrid");
|
||||||
public Grid TabGrid
|
public Grid TabGrid
|
||||||
|
|||||||
@ -3,11 +3,7 @@ global using System.Diagnostics;
|
|||||||
global using System.Net;
|
global using System.Net;
|
||||||
global using System.Text;
|
global using System.Text;
|
||||||
global using System.Collections.Generic;
|
global using System.Collections.Generic;
|
||||||
global using System.Threading;
|
|
||||||
global using System.Linq;
|
global using System.Linq;
|
||||||
global using Avalonia;
|
|
||||||
global using Avalonia.Controls;
|
|
||||||
global using Avalonia.Media;
|
|
||||||
global using DTLib;
|
global using DTLib;
|
||||||
global using DTLib.Dtsod;
|
global using DTLib.Dtsod;
|
||||||
global using DTLib.Filesystem;
|
global using DTLib.Filesystem;
|
||||||
@ -20,7 +16,6 @@ namespace launcher_client_avalonia;
|
|||||||
|
|
||||||
public static class Launcher
|
public static class Launcher
|
||||||
{
|
{
|
||||||
public static SolidColorBrush MyDark, MySoftDark, MyWhite, MyGreen, MyOrange, MySelectionColor;
|
|
||||||
public static LauncherConfig Config;
|
public static LauncherConfig Config;
|
||||||
public static readonly LauncherLogger Logger = new();
|
public static readonly LauncherLogger Logger = new();
|
||||||
public static LauncherWindow CurrentLauncherWindow;
|
public static LauncherWindow CurrentLauncherWindow;
|
||||||
@ -29,20 +24,14 @@ public static class Launcher
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var resources = Application.Current.Resources;
|
|
||||||
MyDark = (SolidColorBrush)resources["MyDarkTr"];
|
|
||||||
MySoftDark = (SolidColorBrush)resources["MyGray"];
|
|
||||||
MyWhite = (SolidColorBrush)resources["MyWhite"];
|
|
||||||
MyGreen = (SolidColorBrush)resources["MyGreen"];
|
|
||||||
MyOrange = (SolidColorBrush)resources["MySelectionColor"];
|
|
||||||
MySelectionColor = (SolidColorBrush)resources["MySelectionColor"];
|
|
||||||
|
|
||||||
Logger.Enable();
|
Logger.Enable();
|
||||||
|
|
||||||
AppBuilder.Configure<App>()
|
AppBuilder.Configure<App>()
|
||||||
.UsePlatformDetect()
|
.UsePlatformDetect()
|
||||||
.LogToTrace()
|
.LogToTrace()
|
||||||
.StartWithClassicDesktopLifetime(args);
|
.StartWithClassicDesktopLifetime(args);
|
||||||
|
CurrentLauncherWindow = new LauncherWindow();
|
||||||
|
CurrentLauncherWindow.Show();
|
||||||
|
|
||||||
Config = new LauncherConfig();
|
Config = new LauncherConfig();
|
||||||
Directory.Create("descriptors");
|
Directory.Create("descriptors");
|
||||||
@ -52,8 +41,6 @@ public static class Launcher
|
|||||||
Directory.Create("settings");
|
Directory.Create("settings");
|
||||||
File.WriteAllText($"descriptors{Путь.Разд}default.descriptor.template",
|
File.WriteAllText($"descriptors{Путь.Разд}default.descriptor.template",
|
||||||
ReadResource("launcher_client_avalonia.Resources.default.descriptor.template"));
|
ReadResource("launcher_client_avalonia.Resources.default.descriptor.template"));
|
||||||
CurrentLauncherWindow = new LauncherWindow();
|
|
||||||
CurrentLauncherWindow.Show();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -73,8 +60,8 @@ public static class Launcher
|
|||||||
|
|
||||||
public static void LogError(string context, Exception ex)
|
public static void LogError(string context, Exception ex)
|
||||||
{
|
{
|
||||||
string errmsg = $"{context} ERROR:\n{ex}";
|
string errmsg = $"{ex.Message}\n{ex.StackTrace}";
|
||||||
MessageBox.Show(errmsg);
|
MessageBox.Show($"{context} ERROR", errmsg);
|
||||||
Logger.Log(errmsg);
|
Logger.Log(errmsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,9 +0,0 @@
|
|||||||
<Window xmlns="https://github.com/avaloniaui"
|
|
||||||
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"
|
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
|
||||||
x:Class="launcher_client_avalonia.MainWindow"
|
|
||||||
Title="launcher_client_avalonia">
|
|
||||||
Welcome to Avalonia!
|
|
||||||
</Window>
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
using Avalonia.Controls;
|
|
||||||
|
|
||||||
namespace launcher_client_avalonia
|
|
||||||
{
|
|
||||||
public partial class MainWindow : Window
|
|
||||||
{
|
|
||||||
public MainWindow()
|
|
||||||
{
|
|
||||||
AvaloniaXamlLoader.Load(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,5 +1,4 @@
|
|||||||
using System.Windows.Controls;
|
using launcher_client_avalonia.GUI;
|
||||||
using launcher_client_avalonia.GUI;
|
|
||||||
|
|
||||||
namespace launcher_client_avalonia;
|
namespace launcher_client_avalonia;
|
||||||
|
|
||||||
@ -37,7 +36,7 @@ public class Program
|
|||||||
LaunchArgs = startcommand.Remove(0,startcommand.IndexOf(' '));
|
LaunchArgs = startcommand.Remove(0,startcommand.IndexOf(' '));
|
||||||
|
|
||||||
ProgramLabel = new ProgramLabel(Name, IconFile);
|
ProgramLabel = new ProgramLabel(Name, IconFile);
|
||||||
ProgramLabel.MouseLeftButtonDown += (_, _) => ProgramSelectedEvent?.Invoke(this);
|
ProgramLabel.PointerPressed += (_, _) => ProgramSelectedEvent?.Invoke(this);
|
||||||
|
|
||||||
SettingsFile = $"settings{Путь.Разд}{Directory}.settings";
|
SettingsFile = $"settings{Путь.Разд}{Directory}.settings";
|
||||||
Settings = File.Exists(SettingsFile)
|
Settings = File.Exists(SettingsFile)
|
||||||
|
|||||||
@ -37,20 +37,6 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Page Include="GUI\LauncherWindow.xaml">
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
<XamlRuntime>Wpf</XamlRuntime>
|
|
||||||
</Page>
|
|
||||||
<Page Include="GUI\ProgramLabel.xaml">
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
<XamlRuntime>Wpf</XamlRuntime>
|
|
||||||
</Page>
|
|
||||||
<Page Include="GUI\ProgramSettingsPanelItem.xaml">
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
<XamlRuntime>Wpf</XamlRuntime>
|
|
||||||
</Page>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<Target Name="PostBuild-Release" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Release'">
|
<Target Name="PostBuild-Release" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Release'">
|
||||||
<Exec Command="cp -f bin/Release/runtimes/linux-x64/native/* bin/Release/" />
|
<Exec Command="cp -f bin/Release/runtimes/linux-x64/native/* bin/Release/" />
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user