descriptors
This commit is contained in:
parent
490c0f3f8c
commit
c5815c17e0
@ -1,30 +1,46 @@
|
||||
<Application x:Class="launcher_client_win.App"
|
||||
<Application x:Class="launcher_client_win.GUI.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Application.Resources>
|
||||
<ControlTemplate x:Key="myScrollBar" TargetType="{x:Type ScrollBar}">
|
||||
<SolidColorBrush x:Key="MyDarkTr"
|
||||
Opacity="0.8"
|
||||
Color="#141419" />
|
||||
<SolidColorBrush x:Key="MyGray" Color="#4B4B50" />
|
||||
<SolidColorBrush x:Key="MyWhite" Color="#F0F0F0" />
|
||||
<SolidColorBrush x:Key="MyGreen" Color="#2CDA11" />
|
||||
<SolidColorBrush x:Key="MyOrange" Color="#D09524" />
|
||||
<SolidColorBrush x:Key="MyRed" Color="#E5160A" />
|
||||
<SolidColorBrush x:Key="MySelectionColor" Color="#3768A4" />
|
||||
|
||||
|
||||
<ControlTemplate x:Key="myScrollBar" TargetType="{x:Type ScrollBar}">
|
||||
<Grid x:Name="Bg" SnapsToDevicePixels="True">
|
||||
<Border BorderBrush="Transparent" BorderThickness="0"
|
||||
Background="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}" Grid.Row="1"/>
|
||||
<Track x:Name="PART_Track" IsDirectionReversed="True" IsEnabled="{TemplateBinding IsMouseOver}" Grid.Row="1">
|
||||
<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="OverridesDefaultStyle" Value="True" />
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Thumb}">
|
||||
<Border x:Name="rectangle" CornerRadius="2" Background="#FF9A9FC5"
|
||||
Height="{TemplateBinding Height}" SnapsToDevicePixels="True"
|
||||
Width="{TemplateBinding Width}" />
|
||||
<Border x:Name="rectangle"
|
||||
Width="8"
|
||||
Height="{TemplateBinding Height}"
|
||||
Background="{DynamicResource MyGray}"
|
||||
SnapsToDevicePixels="True" />
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" TargetName="rectangle" Value="#FF9A9FC5"/>
|
||||
<Setter TargetName="rectangle" Property="Background" Value="{DynamicResource MyGray}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsDragging" Value="True">
|
||||
<Setter Property="Background" TargetName="rectangle" Value="#FF515ED1"/>
|
||||
<Setter TargetName="rectangle" Property="Background" Value="{DynamicResource MySelectionColor}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
@ -38,151 +54,178 @@
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTemplate x:Key="myScrollViewer" TargetType="{x:Type ScrollViewer}">
|
||||
<ControlTemplate x:Key="myScrollViewer" TargetType="{x:Type ScrollViewer}">
|
||||
<Grid x:Name="Grid">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Rectangle
|
||||
x:Name="Corner"
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
|
||||
<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"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
Content="{TemplateBinding Content}" Grid.Column="0"
|
||||
Margin="{TemplateBinding Padding}" Grid.Row="0" />
|
||||
<ScrollBar Template="{DynamicResource myScrollBar}"
|
||||
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}}"
|
||||
x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar"
|
||||
Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0"
|
||||
Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
|
||||
Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
ViewportSize="{TemplateBinding ViewportHeight}" />
|
||||
<ScrollBar Template="{DynamicResource myScrollBar}"
|
||||
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}}"
|
||||
x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar"
|
||||
Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0"
|
||||
Orientation="Horizontal" Grid.Row="1"
|
||||
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}}"
|
||||
ViewportSize="{TemplateBinding ViewportWidth}" />
|
||||
Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTemplate x:Key="myTabControl" TargetType="{x:Type TabControl}">
|
||||
<Grid KeyboardNavigation.TabNavigation="Local">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TabPanel
|
||||
Name="HeaderPanel"
|
||||
Grid.Row="0"
|
||||
Panel.ZIndex="1"
|
||||
Margin="0,0,4,0"
|
||||
IsItemsHost="True"
|
||||
KeyboardNavigation.TabIndex="1"
|
||||
Background="Transparent" />
|
||||
<Border
|
||||
Name="Border"
|
||||
Grid.Row="1"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
BorderThickness="0"
|
||||
CornerRadius="2"
|
||||
KeyboardNavigation.TabNavigation="Local"
|
||||
KeyboardNavigation.DirectionalNavigation="Contained"
|
||||
KeyboardNavigation.TabIndex="2" >
|
||||
<ContentPresenter
|
||||
Name="PART_SelectedContentHost"
|
||||
Margin="4"
|
||||
ContentSource="SelectedContent"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Foreground" Value="#FFF0F0F0" />
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="Transparent" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTemplate x:Key="myTabItem" TargetType="{x:Type TabItem}">
|
||||
<Grid>
|
||||
<Border
|
||||
x:Name="Border"
|
||||
Margin="0,0,-4,0"
|
||||
Background="#FF4D4D4D"
|
||||
BorderBrush="#FF73C300"
|
||||
BorderThickness="2,2,2,2"
|
||||
CornerRadius="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}" >
|
||||
<ContentPresenter x:Name="ContentSite"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
ContentSource="Header"
|
||||
Margin="12,2,12,2"
|
||||
RecognizesAccessKey="True"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Panel.ZIndex" Value="100" />
|
||||
<Setter TargetName="Border" Property="Background" Value="#FF0A11A2" />
|
||||
<Setter TargetName="Border" Property="BorderThickness" Value="3,3,3,3" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="Border" Property="Background" Value="Transparent" />
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="Foreground" Value="white" />
|
||||
</Trigger>
|
||||
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTemplate x:Key="myTextBox" TargetType="{x:Type TextBoxBase}">
|
||||
<Border
|
||||
Name="Border"
|
||||
Padding="2"
|
||||
Background="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
BorderBrush="Transparent"
|
||||
BorderThickness="1" >
|
||||
<ScrollViewer Margin="0" x:Name="PART_ContentHost" Template="{DynamicResource myScrollViewer}"/>
|
||||
<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"/>
|
||||
<Setter TargetName="Border" Property="Background" Value="Black" />
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="White" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTemplate x:Key="roundedButton" TargetType="Button">
|
||||
<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}}"
|
||||
CornerRadius="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<ContentPresenter Margin="2" HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" RecognizesAccessKey="True"/>
|
||||
Background="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
BorderBrush="{Binding Foreground, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
BorderThickness="{Binding BorderThickness, RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<ContentPresenter Margin="2"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
RecognizesAccessKey="True" />
|
||||
</Border>
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter TargetName="Border" Property="Background" Value="#FF4E4E59"/>
|
||||
<Setter TargetName="Border" Property="Background" Value="#FF4E4E59" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="true">
|
||||
<Setter TargetName="Border" Property="Background" Value="#FF38384F"/>
|
||||
<Setter TargetName="Border" Property="Background" Value="#FF38384F" />
|
||||
</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="FontSize" Value="15" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource MyWhite}" />
|
||||
</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 MyOrange}" />
|
||||
</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>
|
||||
|
||||
@ -1,19 +1,28 @@
|
||||
namespace launcher_client_win;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace launcher_client_win.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["MyOrange"];
|
||||
MySelectionColor = (SolidColorBrush)Resources["MySelectionColor"];
|
||||
_Main(e.Args);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"STARTUP ERROR:\n{ex}");
|
||||
Shutdown();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{ LogError("STARTUP",ex); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,98 +1,249 @@
|
||||
<Window x:Class="launcher_client_win.GUI.LauncherWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
Title="DTLauncher" Width="800" Height="500" MinWidth="800" MinHeight="500" Background="#FF232328">
|
||||
<Grid x:Name="MainGrid">
|
||||
xmlns:local="clr-namespace:launcher_client_win.GUI"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="Launcher"
|
||||
Width="800"
|
||||
Height="500"
|
||||
MinWidth="800"
|
||||
MinHeight="500"
|
||||
Background="#232328"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="10"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="10"/>
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="5" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="10"/>
|
||||
<RowDefinition Height="40"/>
|
||||
<RowDefinition Height="8"/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="10"/>
|
||||
<RowDefinition Height="5" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="5" />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="5" />
|
||||
</Grid.RowDefinitions>
|
||||
<Rectangle Fill="#FF474747" Grid.Row="2" Grid.ColumnSpan="3" Margin="0,5,0,0"/>
|
||||
<Grid Grid.Column="1" Grid.Row="1">
|
||||
<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="8"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="8"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button x:Name="HomeButton"
|
||||
Content="Home" FontWeight="Bold" FontFamily="Unispace" FontSize="20"
|
||||
Grid.Column="0" Background="Transparent" Foreground="#FF2CDA11"
|
||||
BorderThickness="3" Template="{DynamicResource roundedButton}"/>
|
||||
<Button x:Name="LogButton" Content="Log" FontWeight="Bold" FontFamily="Unispace" FontSize="20"
|
||||
Grid.Column="2" Background="Transparent" Foreground="#FFF0F0F0"
|
||||
BorderThickness="3" Template="{DynamicResource roundedButton}"/>
|
||||
<Button x:Name="SettingsButton" Content="Settings" FontWeight="Bold" FontFamily="Unispace" FontSize="20"
|
||||
Grid.Column="4" Background="Transparent" Foreground="#FFF0F0F0"
|
||||
BorderThickness="3" Template="{DynamicResource roundedButton}"/>
|
||||
<local:TabButton x:Name="LibraryButton"
|
||||
Grid.Column="0"
|
||||
Content="Library"
|
||||
FontSize="18"
|
||||
Foreground="{DynamicResource MyGreen}"
|
||||
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="HomeGrid" Visibility="Visible" Grid.Row="3" Grid.Column="1">
|
||||
|
||||
<Grid x:Name="LibraryGrid"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Visibility="Visible">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="240"/>
|
||||
<ColumnDefinition Width="10"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="10"/>
|
||||
<ColumnDefinition Width="200"/>
|
||||
<ColumnDefinition Width="220" />
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition Width="200" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Rectangle Fill="#FF474747" Grid.Column="1" Margin="3,0,3,-10"/>
|
||||
<Rectangle Fill="#FF474747" Grid.Column="3" Margin="3,0,3,-10"/>
|
||||
<ScrollViewer x:Name="ProgramsScrollViever" Template="{DynamicResource myScrollViewer}"
|
||||
Grid.Column="0" Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<StackPanel x:Name="ProgramsPanel">
|
||||
|
||||
</StackPanel>
|
||||
<ScrollViewer Grid.Column="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Template="{DynamicResource myScrollViewer}"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel x:Name="ProgramsPanel" />
|
||||
</ScrollViewer>
|
||||
<Image x:Name="BackgroundImage" Grid.Column="2" HorizontalAlignment="Stretch" Stretch="Fill" Margin="0,40,0,0" />
|
||||
<Label x:Name="NameLabel" Grid.Column="2" Grid.Row="0" Margin="0,0,0,361"
|
||||
FontSize="16" FontWeight="Bold" FontFamily="Unispace" Foreground="#FFF0F0F0"/>
|
||||
<Button x:Name="InstallButton" Content="Install" FontWeight="Bold" FontFamily="Unispace" FontSize="17"
|
||||
Grid.Column="2" Background="#FFB97523" Foreground="#FFF0F0F0"
|
||||
BorderThickness="3" Template="{DynamicResource roundedButton}" Margin="0,72,167,0"
|
||||
HorizontalAlignment="Right" Width="123" Height="37" VerticalAlignment="Top"/>
|
||||
<Button x:Name="LaunchButton" Content="Launch" FontWeight="Bold" FontFamily="Unispace" FontSize="17"
|
||||
Grid.Column="2" Background="#FFB97523" Foreground="#FFF0F0F0"
|
||||
BorderThickness="3" Template="{DynamicResource roundedButton}" Margin="0,72,20,0"
|
||||
HorizontalAlignment="Right" Width="123" Height="37" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="DescriptionBox" Template="{DynamicResource myTextBox}" Opacity="0.8"
|
||||
VerticalScrollBarVisibility="Auto" TextWrapping="Wrap" BorderThickness="0"
|
||||
Background="#FF141419" Foreground="#FFF0F0F0" SelectionBrush="#FF3E759E"
|
||||
FontSize="14" IsReadOnly="True" Grid.Column="2" Grid.Row="0" Margin="0,160,0,0"/>
|
||||
<Border BorderBrush="#FF141419" BorderThickness="1" Grid.Column="2" Grid.Row="0" Margin="0,160,0,0"/>
|
||||
<ScrollViewer x:Name="DownloadsScrollViever" Template="{DynamicResource myScrollViewer}" VerticalContentAlignment="Top"
|
||||
Grid.Column="4" Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<StackPanel x:Name="DownloadsPanel">
|
||||
|
||||
<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"
|
||||
Content="Remove"
|
||||
Foreground="{DynamicResource MyRed}"
|
||||
Style="{DynamicResource MyButtonStyle}" />
|
||||
<Button x:Name="InstallButton"
|
||||
Width="100"
|
||||
Margin="2,0"
|
||||
Content="Install"
|
||||
Foreground="{DynamicResource MyOrange}"
|
||||
Style="{DynamicResource MyButtonStyle}" />
|
||||
<Button x:Name="UpdateButton"
|
||||
Width="100"
|
||||
Margin="2,0"
|
||||
Content="Update"
|
||||
Foreground="{DynamicResource MyOrange}"
|
||||
Style="{DynamicResource MyButtonStyle}" />
|
||||
<Button x:Name="LaunchButton"
|
||||
Width="100"
|
||||
Margin="2,0"
|
||||
Content="Launch"
|
||||
Foreground="{DynamicResource MyGreen}"
|
||||
Style="{DynamicResource MyButtonStyle}" />
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
<TextBox x:Name="DescriptionBox"
|
||||
Grid.Row="4"
|
||||
Background="{DynamicResource MyDarkTr}"
|
||||
FontSize="16"
|
||||
Foreground="{DynamicResource MyWhite}"
|
||||
IsReadOnly="True"
|
||||
SelectionBrush="{DynamicResource MySelectionColor}"
|
||||
Template="{DynamicResource myTextBox}"
|
||||
TextWrapping="Wrap"
|
||||
VerticalScrollBarVisibility="Auto" />
|
||||
<TextBox x:Name="ProgramLogBox"
|
||||
Grid.Row="6"
|
||||
Background="{DynamicResource MyDarkTr}"
|
||||
FontSize="16"
|
||||
Foreground="{DynamicResource MyWhite}"
|
||||
IsReadOnly="True"
|
||||
SelectionBrush="{DynamicResource MySelectionColor}"
|
||||
Template="{DynamicResource myTextBox}"
|
||||
TextWrapping="Wrap"
|
||||
VerticalScrollBarVisibility="Auto" />
|
||||
</Grid>
|
||||
<Grid Grid.Row="0" Grid.Column="4">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="90" />
|
||||
<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 Grid.Row="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
VerticalContentAlignment="Top"
|
||||
Template="{DynamicResource myScrollViewer}">
|
||||
<StackPanel x:Name="ProgramSettings" />
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid x:Name="LogGrid" Visibility="Hidden" Grid.Row="3" Grid.Column="1">
|
||||
|
||||
|
||||
<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="34"/>
|
||||
<RowDefinition Height="10*"/>
|
||||
<RowDefinition Height="30" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Label x:Name="LogfileLabel" Content="logfile" Grid.Column="0" Grid.Row="0"
|
||||
FontSize="20" FontWeight="Bold" FontFamily="Unispace" Foreground="#FFF0F0F0"/>
|
||||
<TextBox x:Name="LogBox" Template="{DynamicResource myTextBox}"
|
||||
VerticalScrollBarVisibility="Auto" TextWrapping="Wrap" BorderThickness="0"
|
||||
Background="#FF141419" Foreground="#FFF0F0F0" SelectionBrush="#FF3E759E"
|
||||
FontSize="14" IsReadOnly="True" Grid.Column="0" Grid.Row="1"/>
|
||||
<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"
|
||||
Background="{DynamicResource MyDarkTr}"
|
||||
BorderThickness="0"
|
||||
FontSize="16"
|
||||
Foreground="{DynamicResource MyWhite}"
|
||||
IsReadOnly="True"
|
||||
SelectionBrush="{DynamicResource MySelectionColor}"
|
||||
Template="{DynamicResource myTextBox}"
|
||||
TextWrapping="Wrap"
|
||||
VerticalScrollBarVisibility="Auto" />
|
||||
</Grid>
|
||||
<Grid x:Name="SettingsGrid" Visibility="Hidden" Grid.Row="3" Grid.Column="1">
|
||||
|
||||
</Grid>
|
||||
<Grid x:Name="SettingsGrid"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Visibility="Hidden" />
|
||||
</Grid>
|
||||
</Window>
|
||||
@ -1,9 +1,127 @@
|
||||
namespace launcher_client_win.GUI;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace launcher_client_win.GUI;
|
||||
|
||||
public partial class LauncherWindow : Window
|
||||
{
|
||||
public LauncherWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
try
|
||||
{
|
||||
InitializeComponent();
|
||||
LogBox.Text = Logger.Buffer;
|
||||
Logger.MessageSent += LogHandler;
|
||||
LogfileLabel.Content = Logger.Logfile.Remove(0,Logger.Logfile.LastIndexOf(Path.Sep)+1);
|
||||
LogfileLabel.MouseLeftButtonDown += (s,e)=>
|
||||
Process.Start("explorer.exe", Logger.Logfile.Remove(Logger.Logfile.LastIndexOf(Path.Sep)));
|
||||
LogfileLabel.MouseEnter += (s,e)=>LogfileLabel.Foreground=App.MySelectionColor;
|
||||
LogfileLabel.MouseLeave += (s,e)=>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.Foreground = App.MyWhite;
|
||||
CurrentTab.TabGrid.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
var selected = (TabButton)sender;
|
||||
selected.Foreground = App.MyGreen;
|
||||
selected.TabGrid.Visibility = Visibility.Visible;
|
||||
CurrentTab = selected;
|
||||
}
|
||||
void LibraryTab_activate(object sender, RoutedEventArgs eventArgs)
|
||||
{
|
||||
LibraryButton.Foreground = App.MyGreen;
|
||||
LogButton.Foreground = App.MyWhite;
|
||||
SettingsButton.Foreground = App.MyWhite;
|
||||
LibraryGrid.Visibility = Visibility.Visible;
|
||||
LogGrid.Visibility = Visibility.Hidden;
|
||||
SettingsGrid.Visibility = Visibility.Hidden;
|
||||
}
|
||||
void LogTab_activate(object sender, RoutedEventArgs eventArgs)
|
||||
{
|
||||
LibraryButton.Foreground = App.MyWhite;
|
||||
LogButton.Foreground = App.MyGreen;
|
||||
SettingsButton.Foreground = App.MyWhite;
|
||||
LibraryGrid.Visibility = Visibility.Hidden;
|
||||
LogGrid.Visibility = Visibility.Visible;
|
||||
SettingsGrid.Visibility = Visibility.Hidden;
|
||||
}
|
||||
void SettingsTab_activate(object sender, RoutedEventArgs eventArgs)
|
||||
{
|
||||
LibraryButton.Foreground = App.MyWhite;
|
||||
LogButton.Foreground = App.MyWhite;
|
||||
SettingsButton.Foreground = App.MyGreen;
|
||||
LibraryGrid.Visibility = Visibility.Hidden;
|
||||
LogGrid.Visibility = Visibility.Hidden;
|
||||
SettingsGrid.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
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 selectedP)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (DisplayingProgram != null)
|
||||
{
|
||||
DisplayingProgram.ProgramLabel.Foreground = App.MyWhite;
|
||||
DisplayingProgram.ProgramLabel.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
else ProgramGrid.Visibility = Visibility.Visible;
|
||||
|
||||
selectedP.ProgramLabel.Foreground = App.MyGreen;
|
||||
selectedP.ProgramLabel.FontWeight = FontWeights.Bold;
|
||||
|
||||
NameLabel.Content = selectedP.Name;
|
||||
DescriptionBox.Text = selectedP.Description;
|
||||
BackgroundImage.Source =
|
||||
new BitmapImage(new Uri(
|
||||
$"{Directory.GetCurrent()}{Path.Sep}backgrounds{Path.Sep}{selectedP.BackgroundFile}",
|
||||
UriKind.Absolute));
|
||||
DisplayingProgram = selectedP;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{ LogError("SelectProgram()",ex); }
|
||||
}
|
||||
}
|
||||
33
launcher-client-win/GUI/ProgramLabel.xaml
Normal file
33
launcher-client-win/GUI/ProgramLabel.xaml
Normal file
@ -0,0 +1,33 @@
|
||||
<UserControl x:Class="launcher_client_win.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_win.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>
|
||||
17
launcher-client-win/GUI/ProgramLabel.xaml.cs
Normal file
17
launcher-client-win/GUI/ProgramLabel.xaml.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace launcher_client_win.GUI;
|
||||
|
||||
public partial class ProgramLabel : UserControl
|
||||
{
|
||||
public ProgramLabel(string label, string icon)
|
||||
{
|
||||
InitializeComponent();
|
||||
NameLabel.Content = label;
|
||||
IconImage.Source = new BitmapImage(new Uri(
|
||||
$"{Directory.GetCurrent()}{Path.Sep}icons{Path.Sep}{icon}",
|
||||
UriKind.Absolute));
|
||||
}
|
||||
}
|
||||
16
launcher-client-win/GUI/TabButton.cs
Normal file
16
launcher-client-win/GUI/TabButton.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace launcher_client_win.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);
|
||||
}
|
||||
}
|
||||
@ -22,15 +22,20 @@ public static class Launcher
|
||||
{
|
||||
public static LauncherConfig Config;
|
||||
public static readonly LauncherLogger Logger = new();
|
||||
|
||||
public static LauncherWindow CurrentLauncherWindow;
|
||||
|
||||
public static void _Main(string[] args)
|
||||
{
|
||||
Logger.Enable();
|
||||
Config = new LauncherConfig();
|
||||
LauncherWindow launcherWindow = new();
|
||||
MessageBox.Show("HELLO");
|
||||
launcherWindow.Show();
|
||||
Directory.Create("descriptors");
|
||||
Directory.Create("icons");
|
||||
Directory.Create("backgrounds");
|
||||
Directory.Create("installed");
|
||||
File.WriteAllText($"descriptors{Path.Sep}default.descriptor.template",
|
||||
ReadResource("launcher_client_win.Resources.default.descriptor.template"));
|
||||
CurrentLauncherWindow = new();
|
||||
CurrentLauncherWindow.Show();
|
||||
}
|
||||
|
||||
public static string ReadResource(string resource_path)
|
||||
@ -41,4 +46,11 @@ public static class Launcher
|
||||
Encoding.UTF8);
|
||||
return resourceStreamReader.ReadToEnd();
|
||||
}
|
||||
|
||||
public static void LogError(string context, Exception ex)
|
||||
{
|
||||
string errmsg = $"{context} ERROR:\n{ex}";
|
||||
MessageBox.Show(errmsg);
|
||||
Logger.Log(errmsg);
|
||||
}
|
||||
}
|
||||
62
launcher-client-win/Program.cs
Normal file
62
launcher-client-win/Program.cs
Normal file
@ -0,0 +1,62 @@
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Imaging;
|
||||
using launcher_client_win.GUI;
|
||||
|
||||
namespace launcher_client_win;
|
||||
|
||||
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 ProgramLabel ProgramLabel;
|
||||
private Process ProgramProcess;
|
||||
|
||||
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 += ProgramLabel_ClickHandler;
|
||||
}
|
||||
|
||||
public event Action<Program> ProgramSelectedEvent;
|
||||
void ProgramLabel_ClickHandler(object s, MouseButtonEventArgs e) => ProgramSelectedEvent?.Invoke(this);
|
||||
|
||||
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
|
||||
BIN
launcher-client-win/Resources/logo-D.ico
Normal file
BIN
launcher-client-win/Resources/logo-D.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
@ -8,6 +8,8 @@
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<Nullable>disable</Nullable>
|
||||
<DebugType>full</DebugType>
|
||||
<ApplicationIcon>Resources\logo-D.ico</ApplicationIcon>
|
||||
<TargetCulture Label="Invariant" />
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user