trying to fix avalonia
This commit is contained in:
8
launcher-client-wpf/AssemblyInfo.cs
Normal file
8
launcher-client-wpf/AssemblyInfo.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
[assembly:ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
265
launcher-client-wpf/GUI/App.xaml
Normal file
265
launcher-client-wpf/GUI/App.xaml
Normal file
@@ -0,0 +1,265 @@
|
||||
<Application x:Class="Launcher.Client.WPF.GUI.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Application.Resources>
|
||||
<SolidColorBrush x:Key="MyBackgroundColor" Color="#232328"/>
|
||||
<SolidColorBrush x:Key="MyDarkTr"
|
||||
Opacity="0.8"
|
||||
Color="#141419" />
|
||||
<SolidColorBrush x:Key="MyGray" Color="#46464B" />
|
||||
<SolidColorBrush x:Key="MyWhite" Color="#F0F0F0" />
|
||||
<SolidColorBrush x:Key="MyGreen" Color="#28C311" />
|
||||
<SolidColorBrush x:Key="MyRed" Color="#E5160A" />
|
||||
<SolidColorBrush x:Key="MySelectionColor" Color="#B7800A" />
|
||||
|
||||
|
||||
<ControlTemplate x:Key="myScrollBar" TargetType="{x:Type ScrollBar}">
|
||||
<Grid x:Name="Bg" SnapsToDevicePixels="True">
|
||||
<Border Background="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
BorderBrush="{DynamicResource MyDarkTr}"
|
||||
BorderThickness="0" />
|
||||
<Track x:Name="PART_Track"
|
||||
IsDirectionReversed="True"
|
||||
IsEnabled="{TemplateBinding IsMouseOver}">
|
||||
<Track.Thumb>
|
||||
<Thumb>
|
||||
<Thumb.Style>
|
||||
<Style TargetType="{x:Type Thumb}">
|
||||
<Setter Property="OverridesDefaultStyle" Value="True" />
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Thumb}">
|
||||
<Border x:Name="rectangle"
|
||||
Width="6"
|
||||
Height="{TemplateBinding Height}"
|
||||
Background="{DynamicResource MyGray}"
|
||||
SnapsToDevicePixels="True" />
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="rectangle" Property="Background" Value="{DynamicResource MyGray}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsDragging" Value="True">
|
||||
<Setter TargetName="rectangle" Property="Background" Value="{DynamicResource MySelectionColor}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Thumb.Style>
|
||||
</Thumb>
|
||||
</Track.Thumb>
|
||||
</Track>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTemplate x:Key="myScrollViewer" TargetType="{x:Type ScrollViewer}">
|
||||
<Grid x:Name="Grid">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Rectangle x:Name="Corner"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
|
||||
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
CanContentScroll="{TemplateBinding CanContentScroll}"
|
||||
CanHorizontallyScroll="False"
|
||||
CanVerticallyScroll="False"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
||||
<ScrollBar x:Name="PART_VerticalScrollBar"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
AutomationProperties.AutomationId="VerticalScrollBar"
|
||||
Background="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Cursor="Arrow"
|
||||
Maximum="{TemplateBinding ScrollableHeight}"
|
||||
Minimum="0"
|
||||
Template="{DynamicResource myScrollBar}"
|
||||
ViewportSize="{TemplateBinding ViewportHeight}"
|
||||
Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
|
||||
Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
<ScrollBar x:Name="PART_HorizontalScrollBar"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
AutomationProperties.AutomationId="HorizontalScrollBar"
|
||||
Background="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Cursor="Arrow"
|
||||
Maximum="{TemplateBinding ScrollableWidth}"
|
||||
Minimum="0"
|
||||
Orientation="Horizontal"
|
||||
Template="{DynamicResource myScrollBar}"
|
||||
ViewportSize="{TemplateBinding ViewportWidth}"
|
||||
Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
|
||||
Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
|
||||
<Style x:Key="MyTextBoxStyle" TargetType="TextBox">
|
||||
<Setter Property="IsReadOnly" Value="True" />
|
||||
<Setter Property="Background" Value="{DynamicResource MyDarkTr}" />
|
||||
<Setter Property="FontSize" Value="16" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource MyWhite}" />
|
||||
<Setter Property="SelectionBrush" Value="{DynamicResource MySelectionColor}" />
|
||||
<Setter Property="Template" Value="{DynamicResource myTextBox}" />
|
||||
<Setter Property="TextWrapping" Value="Wrap" />
|
||||
</Style>
|
||||
<ControlTemplate x:Key="myTextBox" TargetType="{x:Type TextBoxBase}">
|
||||
<Border Name="Border"
|
||||
Padding="0"
|
||||
Background="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
BorderBrush="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
BorderThickness="2">
|
||||
<ScrollViewer x:Name="PART_ContentHost"
|
||||
Margin="0"
|
||||
Template="{DynamicResource myScrollViewer}" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="Border" Property="Background" Value="Black" />
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="White" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<Style x:Key="MyButtonStyle" TargetType="Button">
|
||||
<Setter Property="Template" Value="{DynamicResource MyButton}" />
|
||||
<Setter Property="Background" Value="{DynamicResource MyDarkTr}" />
|
||||
<Setter Property="BorderThickness" Value="3" />
|
||||
<Setter Property="FontFamily" Value="Unispace" />
|
||||
<Setter Property="FontSize" Value="16" />
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource MyWhite}" />
|
||||
</Style>
|
||||
|
||||
<ControlTemplate x:Key="MyButton" TargetType="Button">
|
||||
<Border x:Name="Border"
|
||||
Background="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
BorderBrush="{Binding Foreground, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
BorderThickness="{Binding BorderThickness, RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<Grid>
|
||||
<Border x:Name="Border_fade"
|
||||
Background="{DynamicResource MyWhite}"
|
||||
Opacity="0.2"
|
||||
Visibility="Hidden" />
|
||||
<Border x:Name="Border_fade2"
|
||||
Background="{DynamicResource MyGray}"
|
||||
Opacity="0.4"
|
||||
Visibility="Hidden" />
|
||||
<ContentPresenter Margin="2"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
RecognizesAccessKey="True" />
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter TargetName="Border_fade" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="true">
|
||||
<Setter TargetName="Border_fade" Property="Visibility" Value="Hidden" />
|
||||
<Setter TargetName="Border_fade2" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<Style x:Key="MyLabelStyle" TargetType="Label">
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
<Setter Property="Background" Value="{DynamicResource MyDarkTr}" />
|
||||
<Setter Property="FontFamily" Value="Unispace" />
|
||||
<Setter Property="FontStyle" Value="Normal" />
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource MyWhite}" />
|
||||
<!-->disables some shit which removes underscores from Content<!-->
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Label}">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
RecognizesAccessKey="False" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<ControlTemplate x:Key="MyComboBox" TargetType="ComboBox">
|
||||
<Grid>
|
||||
<ToggleButton Focusable="false" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<ToggleButton.Template>
|
||||
<ControlTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="5*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border x:Name="Border"
|
||||
Grid.ColumnSpan="2"
|
||||
Background="{DynamicResource MyDarkTr}" />
|
||||
<Border Grid.Column="0"
|
||||
Margin="1"
|
||||
Background="{DynamicResource MyDarkTr}" />
|
||||
<Path x:Name="Arrow"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Data="M 0 0 L 4 4 L 8 0 Z"
|
||||
Fill="{DynamicResource MySelectionColor}" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="ToggleButton.IsMouseOver" Value="true">
|
||||
<Setter TargetName="Border" Property="Background" Value="{DynamicResource MySelectionColor}" />
|
||||
</Trigger>
|
||||
<Trigger Property="ToggleButton.IsChecked" Value="true">
|
||||
<Setter TargetName="Border" Property="Background" Value="{DynamicResource MySelectionColor}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</ToggleButton.Template>
|
||||
</ToggleButton>
|
||||
<ContentPresenter Name="ContentSite"
|
||||
Margin="3"
|
||||
Content="{TemplateBinding SelectionBoxItem}"
|
||||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
||||
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
|
||||
IsHitTestVisible="False" />
|
||||
<TextBox x:Name="PART_EditableTextBox"
|
||||
IsReadOnly="{TemplateBinding IsReadOnly}"
|
||||
Visibility="Hidden" />
|
||||
<Popup Name="Popup"
|
||||
AllowsTransparency="True"
|
||||
Focusable="False"
|
||||
IsOpen="{TemplateBinding IsDropDownOpen}"
|
||||
Placement="Bottom"
|
||||
PopupAnimation="Slide">
|
||||
<Grid Name="DropDown"
|
||||
MinWidth="{TemplateBinding ActualWidth}"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||
SnapsToDevicePixels="True">
|
||||
<Border x:Name="DropDownBorder" Background="{DynamicResource MyDarkTr}" />
|
||||
<ScrollViewer SnapsToDevicePixels="True">
|
||||
<StackPanel IsItemsHost="True" />
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Popup>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
27
launcher-client-wpf/GUI/App.xaml.cs
Normal file
27
launcher-client-wpf/GUI/App.xaml.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Launcher.Client.WPF.GUI;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
public static SolidColorBrush MyDark,MySoftDark, MyWhite, MyGreen, MyOrange, MySelectionColor;
|
||||
|
||||
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
base.OnStartup(e);
|
||||
MyDark = (SolidColorBrush)Resources["MyDarkTr"];
|
||||
MySoftDark = (SolidColorBrush)Resources["MyGray"];
|
||||
MyWhite = (SolidColorBrush)Resources["MyWhite"];
|
||||
MyGreen = (SolidColorBrush)Resources["MyGreen"];
|
||||
MyOrange = (SolidColorBrush)Resources["MySelectionColor"];
|
||||
MySelectionColor = (SolidColorBrush)Resources["MySelectionColor"];
|
||||
_Main(e.Args);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{ LogError("STARTUP",ex); }
|
||||
}
|
||||
}
|
||||
|
||||
226
launcher-client-wpf/GUI/LauncherWindow.xaml
Normal file
226
launcher-client-wpf/GUI/LauncherWindow.xaml
Normal file
@@ -0,0 +1,226 @@
|
||||
<Window x:Class="Launcher.Client.WPF.GUI.LauncherWindow"
|
||||
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:local="clr-namespace:Launcher.Client.WPF.GUI"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="Launcher"
|
||||
Width="800"
|
||||
Height="500"
|
||||
MinWidth="800"
|
||||
MinHeight="500"
|
||||
Background="{DynamicResource MyBackgroundColor}"
|
||||
mc:Ignorable="d">
|
||||
<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>
|
||||
<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>
|
||||
<local:TabButton x:Name="LibraryButton"
|
||||
Grid.Column="0"
|
||||
Content="Library"
|
||||
FontSize="18"
|
||||
Style="{DynamicResource MyButtonStyle}" />
|
||||
<local:TabButton x:Name="DownloadsButton"
|
||||
Grid.Column="2"
|
||||
Content="Downloads"
|
||||
FontSize="18"
|
||||
Style="{DynamicResource MyButtonStyle}" />
|
||||
<local:TabButton x:Name="LogButton"
|
||||
Grid.Column="4"
|
||||
Content="Log"
|
||||
FontSize="18"
|
||||
Style="{DynamicResource MyButtonStyle}" />
|
||||
<local:TabButton x:Name="SettingsButton"
|
||||
Grid.Column="6"
|
||||
Content="Settings"
|
||||
FontSize="18"
|
||||
Style="{DynamicResource 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>
|
||||
<ScrollViewer Grid.Column="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Template="{DynamicResource myScrollViewer}"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<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>
|
||||
<Label x:Name="NameLabel"
|
||||
Grid.Row="0"
|
||||
Content="name"
|
||||
FontSize="19"
|
||||
FontWeight="Bold"
|
||||
Style="{DynamicResource MyLabelStyle}" />
|
||||
<StackPanel Grid.Row="2"
|
||||
HorizontalAlignment="Right"
|
||||
ClipToBounds="True"
|
||||
Orientation="Horizontal">
|
||||
<Button x:Name="RemoveButton"
|
||||
Width="100"
|
||||
Margin="2,0"
|
||||
Background="{DynamicResource MyRed}"
|
||||
Content="Remove"
|
||||
Style="{DynamicResource MyButtonStyle}" />
|
||||
<Button x:Name="InstallButton"
|
||||
Width="100"
|
||||
Margin="2,0"
|
||||
Content="Install"
|
||||
Style="{DynamicResource MyButtonStyle}" />
|
||||
<Button x:Name="UpdateButton"
|
||||
Width="100"
|
||||
Margin="2,0"
|
||||
Content="Update"
|
||||
Style="{DynamicResource MyButtonStyle}" />
|
||||
<Button x:Name="LaunchButton"
|
||||
Width="100"
|
||||
Margin="2,0"
|
||||
Background="{DynamicResource MyGreen}"
|
||||
Content="Launch"
|
||||
Style="{DynamicResource MyButtonStyle}" />
|
||||
</StackPanel>
|
||||
<TextBox x:Name="DescriptionBox"
|
||||
Grid.Row="4"
|
||||
Style="{DynamicResource MyTextBoxStyle}"
|
||||
VerticalScrollBarVisibility="Auto" />
|
||||
<TextBox x:Name="ProgramLogBox"
|
||||
Grid.Row="6"
|
||||
Style="{DynamicResource MyTextBoxStyle}"
|
||||
VerticalScrollBarVisibility="Auto" />
|
||||
</Grid>
|
||||
<Grid Grid.Row="0" Grid.Column="4">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="95" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0">
|
||||
|
||||
<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}" />
|
||||
<ComboBox Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Background="{DynamicResource MyDarkTr}"
|
||||
Template="{DynamicResource MyComboBox}">
|
||||
<ComboBoxItem IsSelected="True">
|
||||
<Label Background="Transparent"
|
||||
Content="v1"
|
||||
Style="{DynamicResource MyLabelStyle}" />
|
||||
</ComboBoxItem>
|
||||
</ComboBox>
|
||||
<Label Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Content="directory:"
|
||||
Style="{DynamicResource MyLabelStyle}" />
|
||||
<Label Name="ProgramDirectoryLabel"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Content="0"
|
||||
Style="{DynamicResource MyLabelStyle}" />
|
||||
<Label Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Content="size:"
|
||||
Style="{DynamicResource MyLabelStyle}" />
|
||||
<Label Name="ProgramSizeLabel"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Content="0"
|
||||
Style="{DynamicResource MyLabelStyle}" />
|
||||
</Grid>
|
||||
<ScrollViewer Name="ProgramSettingsViever"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
VerticalContentAlignment="Top"
|
||||
Template="{DynamicResource myScrollViewer}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
|
||||
<Grid x:Name="DownloadsGrid"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Visibility="Hidden" />
|
||||
|
||||
<Grid x:Name="LogGrid"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Visibility="Hidden">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Label x:Name="LogfileLabel"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Content="logfile"
|
||||
FontStyle="Italic"
|
||||
Style="{DynamicResource MyLabelStyle}" />
|
||||
<TextBox x:Name="LogBox"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Style="{DynamicResource MyTextBoxStyle}"
|
||||
VerticalScrollBarVisibility="Auto" />
|
||||
</Grid>
|
||||
|
||||
<Grid x:Name="SettingsGrid"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Visibility="Hidden" />
|
||||
</Grid>
|
||||
</Window>
|
||||
100
launcher-client-wpf/GUI/LauncherWindow.xaml.cs
Normal file
100
launcher-client-wpf/GUI/LauncherWindow.xaml.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace Launcher.Client.WPF.GUI;
|
||||
|
||||
public partial class LauncherWindow : Window
|
||||
{
|
||||
public LauncherWindow()
|
||||
{
|
||||
try
|
||||
{
|
||||
InitializeComponent();
|
||||
LogBox.Text = Logger.Buffer;
|
||||
Logger.MessageSent += LogHandler;
|
||||
LogfileLabel.Content = Logger.LogfileName.Remove(0,Logger.LogfileName.LastIndexOf(Путь.Разд)+1);
|
||||
LogfileLabel.MouseLeftButtonDown += (_,_)=>
|
||||
Process.Start("explorer.exe", LauncherLogger.LogfileDir);
|
||||
LogfileLabel.MouseEnter += (_,_)=>LogfileLabel.Foreground=App.MySelectionColor;
|
||||
LogfileLabel.MouseLeave += (_,_)=>LogfileLabel.Foreground=App.MyWhite;
|
||||
LibraryButton.TabGrid = LibraryGrid;
|
||||
DownloadsButton.TabGrid = DownloadsGrid;
|
||||
LogButton.TabGrid = LogGrid;
|
||||
SettingsButton.TabGrid = SettingsGrid;
|
||||
LibraryButton.Click += SelectTab;
|
||||
DownloadsButton.Click += SelectTab;
|
||||
LogButton.Click += SelectTab;
|
||||
SettingsButton.Click += SelectTab;
|
||||
ProgramGrid.Visibility = Visibility.Hidden;
|
||||
SelectTab(LibraryButton, null);
|
||||
FillProgramsPanel();
|
||||
Logger.Log("launcher started");
|
||||
}
|
||||
catch(Exception ex)
|
||||
{ LogError("LAUNCHER WINDOW INIT",ex); }
|
||||
}
|
||||
|
||||
void LogHandler(string m) => Dispatcher.Invoke(()=>LogBox.Text += m);
|
||||
|
||||
|
||||
private TabButton CurrentTab;
|
||||
void SelectTab(object sender, RoutedEventArgs _)
|
||||
{
|
||||
if(CurrentTab!=null)
|
||||
{
|
||||
CurrentTab.Background = App.MyDark;
|
||||
CurrentTab.TabGrid.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
var selected = (TabButton)sender;
|
||||
selected.Background = App.MySelectionColor;
|
||||
selected.TabGrid.Visibility = Visibility.Visible;
|
||||
CurrentTab = selected;
|
||||
}
|
||||
|
||||
public Program[] Programs;
|
||||
|
||||
private void FillProgramsPanel()
|
||||
{
|
||||
Logger.Log("reading descriptors...");
|
||||
string[] descriptors = Directory.GetFiles("descriptors");
|
||||
Programs = new Program[descriptors.Length];
|
||||
for (ushort i = 0; i < descriptors.Length; i++)
|
||||
{
|
||||
string descriptor = descriptors[i];
|
||||
if(descriptor.EndsWith(".descriptor"))
|
||||
{
|
||||
Logger.Log('\t'+descriptor);
|
||||
Programs[i] = new Program(descriptors[i]);
|
||||
ProgramsPanel.Children.Add(Programs[i].ProgramLabel);
|
||||
Programs[i].ProgramSelectedEvent += SelectProgram;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Program DisplayingProgram;
|
||||
public void SelectProgram(Program selectedProg)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (DisplayingProgram != null)
|
||||
{
|
||||
DisplayingProgram.ProgramLabel.Foreground = App.MyWhite;
|
||||
DisplayingProgram.ProgramLabel.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
else ProgramGrid.Visibility = Visibility.Visible;
|
||||
|
||||
selectedProg.ProgramLabel.Foreground = App.MySelectionColor;
|
||||
selectedProg.ProgramLabel.FontWeight = FontWeights.Bold;
|
||||
|
||||
NameLabel.Content = selectedProg.Name;
|
||||
DescriptionBox.Text = selectedProg.Description;
|
||||
BackgroundImage.Source =
|
||||
new BitmapImage(new Uri(
|
||||
$"{Directory.GetCurrent()}{Путь.Разд}backgrounds{Путь.Разд}{selectedProg.BackgroundFile}",
|
||||
UriKind.Absolute));
|
||||
ProgramSettingsViever.Content = selectedProg.SettingsPanel;
|
||||
DisplayingProgram = selectedProg;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{ LogError("SelectProgram()",ex); }
|
||||
}
|
||||
}
|
||||
33
launcher-client-wpf/GUI/ProgramLabel.xaml
Normal file
33
launcher-client-wpf/GUI/ProgramLabel.xaml
Normal file
@@ -0,0 +1,33 @@
|
||||
<UserControl x:Class="Launcher.Client.WPF.GUI.ProgramLabel"
|
||||
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:local="clr-namespace:Launcher.Client.WPF.GUI"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Height="50"
|
||||
Background="{DynamicResource MyDarkTr}"
|
||||
BorderBrush="{Binding Foreground, RelativeSource={RelativeSource Self}}"
|
||||
BorderThickness="3"
|
||||
Foreground="{DynamicResource MyWhite}"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{Binding Height, RelativeSource={RelativeSource FindAncestor, AncestorType=local:ProgramLabel}}" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Image x:Name="IconImage"
|
||||
Grid.Column="0"
|
||||
Margin="3,3,3,3"
|
||||
Stretch="Fill" />
|
||||
|
||||
<Label Name="NameLabel"
|
||||
Grid.Column="1"
|
||||
VerticalContentAlignment="Center"
|
||||
Content="label"
|
||||
FontFamily="Unispace"
|
||||
FontSize="15"
|
||||
FontWeight="Normal"
|
||||
Foreground="{Binding Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ProgramLabel}}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
16
launcher-client-wpf/GUI/ProgramLabel.xaml.cs
Normal file
16
launcher-client-wpf/GUI/ProgramLabel.xaml.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace Launcher.Client.WPF.GUI;
|
||||
|
||||
public partial class ProgramLabel : UserControl
|
||||
{
|
||||
public ProgramLabel(string label, string icon)
|
||||
{
|
||||
InitializeComponent();
|
||||
NameLabel.Content = label;
|
||||
IconImage.Source = new BitmapImage(new Uri(
|
||||
$"{Directory.GetCurrent()}{Путь.Разд}icons{Путь.Разд}{icon}",
|
||||
UriKind.Absolute));
|
||||
}
|
||||
}
|
||||
28
launcher-client-wpf/GUI/ProgramSettingsPanelItem.xaml
Normal file
28
launcher-client-wpf/GUI/ProgramSettingsPanelItem.xaml
Normal file
@@ -0,0 +1,28 @@
|
||||
<UserControl x:Class="Launcher.Client.WPF.GUI.ProgramSettingsPanelItem"
|
||||
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:local="clr-namespace:Launcher.Client.WPF.GUI"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignWidth="100"
|
||||
d:DesignHeight="30"
|
||||
mc:Ignorable="d"
|
||||
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>
|
||||
45
launcher-client-wpf/GUI/ProgramSettingsPanelItem.xaml.cs
Normal file
45
launcher-client-wpf/GUI/ProgramSettingsPanelItem.xaml.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Launcher.Client.WPF.GUI;
|
||||
|
||||
public partial class ProgramSettingsPanelItem : UserControl
|
||||
{
|
||||
public static readonly DependencyProperty SettingKeyProp = DependencyProperty.Register(
|
||||
"SettingKey",
|
||||
typeof(string),
|
||||
typeof(ProgramSettingsPanelItem));
|
||||
public string SettingKey
|
||||
{
|
||||
get => (string)GetValue(SettingKeyProp);
|
||||
set
|
||||
{
|
||||
SetValue(SettingKeyProp, value);
|
||||
KeyLabel.ToolTip = new ToolTip
|
||||
{
|
||||
Content = value,
|
||||
Foreground = App.MyWhite,
|
||||
Background = App.MySoftDark
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SettingValueProp = DependencyProperty.Register(
|
||||
"SettingValue",
|
||||
typeof(string),
|
||||
typeof(ProgramSettingsPanelItem));
|
||||
public string SettingValue
|
||||
{
|
||||
get => (string)GetValue(SettingValueProp);
|
||||
set => SetValue(SettingValueProp, value);
|
||||
}
|
||||
|
||||
public event Action<ProgramSettingsPanelItem> UpdatedEvent;
|
||||
|
||||
public ProgramSettingsPanelItem(string key, string value)
|
||||
{
|
||||
InitializeComponent();
|
||||
SettingKey = key;
|
||||
SettingValue = value;
|
||||
ValueBox.TextChanged += (_,_)=> UpdatedEvent?.Invoke(this);
|
||||
}
|
||||
}
|
||||
16
launcher-client-wpf/GUI/TabButton.cs
Normal file
16
launcher-client-wpf/GUI/TabButton.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Launcher.Client.WPF.GUI;
|
||||
|
||||
public class TabButton : Button
|
||||
{
|
||||
public static readonly DependencyProperty TabGridProp = DependencyProperty.Register(
|
||||
"TabGrid",
|
||||
typeof(Grid),
|
||||
typeof(TabButton));
|
||||
public Grid TabGrid
|
||||
{
|
||||
get => (Grid)GetValue(TabGridProp);
|
||||
set => SetValue(TabGridProp, value);
|
||||
}
|
||||
}
|
||||
65
launcher-client-wpf/LauncherConfig.cs
Normal file
65
launcher-client-wpf/LauncherConfig.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
namespace Launcher.Client.WPF;
|
||||
|
||||
public class LauncherConfig
|
||||
{
|
||||
|
||||
public record struct Server(IPEndPoint EndPoint, string Domain)
|
||||
{
|
||||
public Server(string domain, int port) : this
|
||||
(new IPEndPoint(Dns.GetHostAddresses(domain)[0], port), domain)
|
||||
{ }
|
||||
public Server(IPAddress address, int port) : this
|
||||
(new IPEndPoint(address, port), "")
|
||||
{ }
|
||||
}
|
||||
|
||||
public const int Version=1;
|
||||
public Server[] ServerAddresses;
|
||||
|
||||
const string configFile = "launcher.dtsod";
|
||||
public LauncherConfig()
|
||||
{
|
||||
// читает дефолтный конфиг из ресурсов
|
||||
DtsodV23 updatedConfig;
|
||||
DtsodV23 updatedDefault = new(EmbeddedResources.ReadText("Launcher.Client.WPF.Resources.launcher.dtsod"));
|
||||
// проверка и обновление конфига
|
||||
if (File.Exists(configFile))
|
||||
{
|
||||
DtsodV23 oldConfig = new(File.ReadAllText(configFile));
|
||||
updatedConfig = DtsodConverter.UpdateByDefault(oldConfig, updatedDefault);
|
||||
}
|
||||
else updatedConfig = updatedDefault;
|
||||
|
||||
// парсит парсит полученный дтсод в LauncherConfig
|
||||
List<object> serversD = updatedConfig["server"];
|
||||
ServerAddresses = new Server[serversD.Count];
|
||||
ushort i = 0;
|
||||
foreach (DtsodV23 serverD in serversD)
|
||||
{
|
||||
int port = serverD["port"];
|
||||
// server must have <domain> or <ip> property
|
||||
ServerAddresses[i++] = serverD.TryGetValue("domain", out dynamic dom)
|
||||
? new Server(dom, port)
|
||||
: new Server(IPAddress.Parse(serverD["ip"]), port);
|
||||
}
|
||||
|
||||
WriteToFile();
|
||||
}
|
||||
|
||||
// записывает обновлённый конфиг в файл
|
||||
public void WriteToFile()
|
||||
{
|
||||
StringBuilder b = new();
|
||||
b.Append("version: ").Append(Version).Append(";\n");
|
||||
foreach (var server in ServerAddresses)
|
||||
{
|
||||
b.Append("$server: {\n\t");
|
||||
if (server.Domain == "")
|
||||
b.Append("ip: \"").Append(server.EndPoint.Address);
|
||||
else b.Append("domain: \"").Append(server.Domain);
|
||||
b.Append("\";\n\tport: ")
|
||||
.Append(server.EndPoint.Port)
|
||||
.Append(";\n};\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
31
launcher-client-wpf/LauncherLogger.cs
Normal file
31
launcher-client-wpf/LauncherLogger.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using DTLib.Loggers;
|
||||
|
||||
namespace Launcher.Client.WPF;
|
||||
|
||||
public class LauncherLogger : ConsoleLogger
|
||||
{
|
||||
public const string LogfileDir = "launcher-logs";
|
||||
public LauncherLogger() : base(LogfileDir,"launcher-client-wpf")
|
||||
{ }
|
||||
|
||||
private readonly StringBuilder _buffer = new();
|
||||
public string Buffer
|
||||
{
|
||||
get { lock (_buffer) return _buffer.ToString(); }
|
||||
}
|
||||
|
||||
public event Action<string> MessageSent;
|
||||
|
||||
public override void Log(params string[] msg)
|
||||
{
|
||||
base.Log(msg);
|
||||
StringBuilder strb = new();
|
||||
if (msg.Length == 1) strb.Append(msg[0]);
|
||||
else for (int i = 1; i < msg.Length; i += 2)
|
||||
strb.Append(msg[i]);
|
||||
strb.Append('\n');
|
||||
string msgConnected = strb.ToString();
|
||||
MessageSent?.Invoke(msgConnected);
|
||||
lock (_buffer) _buffer.Append(msgConnected);
|
||||
}
|
||||
}
|
||||
43
launcher-client-wpf/LauncherMain.cs
Normal file
43
launcher-client-wpf/LauncherMain.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
global using DTLib;
|
||||
global using DTLib.Dtsod;
|
||||
global using DTLib.Filesystem;
|
||||
global using DTLib.Extensions;
|
||||
global using System;
|
||||
global using System.Diagnostics;
|
||||
global using System.Net;
|
||||
global using System.Text;
|
||||
global using System.Collections.Generic;
|
||||
global using System.Linq;
|
||||
global using System.Windows;
|
||||
global using static Launcher.Client.WPF.LauncherMain;
|
||||
using Launcher.Client.WPF.GUI;
|
||||
|
||||
namespace Launcher.Client.WPF;
|
||||
|
||||
public static class LauncherMain
|
||||
{
|
||||
public static LauncherConfig Config;
|
||||
public static readonly LauncherLogger Logger = new();
|
||||
public static LauncherWindow CurrentLauncherWindow;
|
||||
|
||||
public static void _Main(string[] args)
|
||||
{
|
||||
Config = new LauncherConfig();
|
||||
Directory.Create("descriptors");
|
||||
Directory.Create("icons");
|
||||
Directory.Create("backgrounds");
|
||||
Directory.Create("installed");
|
||||
Directory.Create("settings");
|
||||
File.WriteAllText($"descriptors{Путь.Разд}default.descriptor.template",
|
||||
EmbeddedResources.ReadText("Launcher.Client.WPF.Resources.default.descriptor.template"));
|
||||
CurrentLauncherWindow = new LauncherWindow();
|
||||
CurrentLauncherWindow.Show();
|
||||
}
|
||||
|
||||
public static void LogError(string context, Exception ex)
|
||||
{
|
||||
string errmsg = $"{context} ERROR:\n{ex}";
|
||||
MessageBox.Show(errmsg);
|
||||
Logger.Log(errmsg);
|
||||
}
|
||||
}
|
||||
86
launcher-client-wpf/Program.cs
Normal file
86
launcher-client-wpf/Program.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using System.Windows.Controls;
|
||||
using Launcher.Client.WPF.GUI;
|
||||
|
||||
namespace Launcher.Client.WPF;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public readonly string Name;
|
||||
public readonly string Directory;
|
||||
public readonly string Description;
|
||||
public readonly string IconFile;
|
||||
public readonly string BackgroundFile;
|
||||
public readonly string LaunchFile;
|
||||
public readonly string LaunchArgs;
|
||||
|
||||
public readonly ProgramLabel ProgramLabel;
|
||||
|
||||
public readonly string SettingsFile;
|
||||
public readonly DtsodV23 Settings;
|
||||
|
||||
public readonly StackPanel SettingsPanel;
|
||||
|
||||
private Process ProgramProcess;
|
||||
|
||||
public event Action<Program> ProgramSelectedEvent;
|
||||
|
||||
public Program(string descriptorFile)
|
||||
{
|
||||
DtsodV23 descriptor= new(File.ReadAllText(descriptorFile));
|
||||
Name = descriptor["name"];
|
||||
Directory = descriptor["directory"];
|
||||
Description = descriptor["description"];
|
||||
IconFile = descriptor["icon"];
|
||||
BackgroundFile = descriptor["background"];
|
||||
string startcommand = descriptor["launchcommand"];
|
||||
LaunchFile = startcommand.Remove(startcommand.IndexOf(' '));
|
||||
LaunchArgs = startcommand.Remove(0,startcommand.IndexOf(' '));
|
||||
|
||||
ProgramLabel = new ProgramLabel(Name, IconFile);
|
||||
ProgramLabel.MouseLeftButtonDown += (_, _) => ProgramSelectedEvent?.Invoke(this);
|
||||
|
||||
SettingsFile = $"settings{Путь.Разд}{Directory}.settings";
|
||||
Settings = File.Exists(SettingsFile)
|
||||
? DtsodConverter.UpdateByDefault(
|
||||
new DtsodV23(File.ReadAllText(SettingsFile)),
|
||||
descriptor["default_settings"])
|
||||
: descriptor["default_settings"];
|
||||
File.WriteAllText(SettingsFile, Settings.ToString());
|
||||
SettingsPanel = new StackPanel();
|
||||
foreach (var setting in Settings)
|
||||
{
|
||||
ProgramSettingsPanelItem settingUi = new(setting.Key, setting.Value);
|
||||
settingUi.UpdatedEvent += UpdateSetting;
|
||||
SettingsPanel.Children.Add(settingUi);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateSetting(ProgramSettingsPanelItem uiElem)
|
||||
{
|
||||
Settings[uiElem.SettingKey] = uiElem.SettingValue;
|
||||
File.WriteAllText(SettingsFile, Settings.ToString());
|
||||
}
|
||||
|
||||
public void Launch()
|
||||
{
|
||||
if(ProgramProcess.HasExited)
|
||||
throw new Exception($"can't start program <{Name}>, because it hadn't stopped yet");
|
||||
ProgramProcess = Process.Start(LaunchFile, LaunchArgs);
|
||||
if (ProgramProcess is null)
|
||||
throw new Exception($"program <{Name}> started, but ProgramProcess is null");
|
||||
CurrentLauncherWindow.LaunchButton.Content = "Stop";
|
||||
ProgramProcess.Exited += ProgramExitedHandler;
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
if (!ProgramProcess.HasExited)
|
||||
throw new Exception($"can't stop program <{Name}>, because it had stopped already");
|
||||
ProgramProcess.Kill(true);
|
||||
}
|
||||
|
||||
void ProgramExitedHandler(object sender, EventArgs eargs)
|
||||
{
|
||||
CurrentLauncherWindow.LaunchButton.Content = "Start";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
name: ""; #label, which displays in launcher
|
||||
directory: ""; #name of program' directory on server and client
|
||||
description: ""; #desctiption, which displays in launcher
|
||||
icon: ""; #name of the icon file
|
||||
background: ""; #name of the background file
|
||||
launchcommand: ""; #command, which starts the program
|
||||
6
launcher-client-wpf/Resources/launcher.dtsod
Normal file
6
launcher-client-wpf/Resources/launcher.dtsod
Normal file
@@ -0,0 +1,6 @@
|
||||
version: 1;
|
||||
|
||||
$server: {
|
||||
ip: "127.0.0.1";
|
||||
port: 25000;
|
||||
};
|
||||
BIN
launcher-client-wpf/Resources/logo-D.ico
Normal file
BIN
launcher-client-wpf/Resources/logo-D.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
34
launcher-client-wpf/launcher-client-wpf.csproj
Normal file
34
launcher-client-wpf/launcher-client-wpf.csproj
Normal file
@@ -0,0 +1,34 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<UseWPF>true</UseWPF>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<RootNamespace>Launcher.Client.WPF</RootNamespace>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<Nullable>disable</Nullable>
|
||||
<DebugType>full</DebugType>
|
||||
<ApplicationIcon>Resources\logo-D.ico</ApplicationIcon>
|
||||
<TargetCulture Label="Invariant" />
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<Platforms>AnyCPU</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="GUI\App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<XamlRuntime>Wpf</XamlRuntime>
|
||||
</ApplicationDefinition>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="..\..\DTLib\bin\Release\net6.0\DTLib.dll" />
|
||||
<Reference Include="..\..\DTLib\bin\Release\net6.0\DTLib.Dtsod.dll" />
|
||||
<Reference Include="..\..\DTLib\bin\Release\net6.0\DTLib.Network.dll" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\*" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user