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