Implemented UI
This commit is contained in:
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace ExeLauncher.GUI
|
namespace ExeLauncher.GUI
|
||||||
{
|
{
|
||||||
internal record ApplicationModel
|
public record ApplicationModel
|
||||||
{
|
{
|
||||||
public int Number { get; set; } = 1;
|
public int Number { get; set; } = 1;
|
||||||
public string Path { get; set; } = "";
|
public string Path { get; set; } = "";
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
xmlns:local="clr-namespace:ExeLauncher.GUI"
|
xmlns:local="clr-namespace:ExeLauncher.GUI"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
DataContext="{Binding RelativeSource={RelativeSource Self}}"
|
DataContext="{Binding RelativeSource={RelativeSource Self}}"
|
||||||
Title="MainWindow" Height="450" Width="800">
|
Title="ExeLauncher" MinHeight="335" Height="480" Width="800">
|
||||||
<DockPanel LastChildFill="True">
|
<DockPanel LastChildFill="True">
|
||||||
<!--Controls-->
|
<!--Controls-->
|
||||||
<Grid DockPanel.Dock="Bottom" Background="#F5F5F5">
|
<Grid DockPanel.Dock="Bottom" Background="#F5F5F5">
|
||||||
@@ -16,36 +16,50 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
<!--Apps-->
|
<!--Apps-->
|
||||||
<ScrollViewer>
|
<DockPanel LastChildFill="True" Margin="10">
|
||||||
<StackPanel Margin="10">
|
<GroupBox DockPanel.Dock="Top" Header="Application Info">
|
||||||
<GroupBox Header="Application Info">
|
<Grid>
|
||||||
<Grid>
|
<Grid.ColumnDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="*" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition Width="Auto" />
|
</Grid.ColumnDefinitions>
|
||||||
</Grid.ColumnDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<RowDefinition Height="35" />
|
||||||
<RowDefinition Height="35" />
|
<RowDefinition Height="35" />
|
||||||
<RowDefinition Height="35" />
|
</Grid.RowDefinitions>
|
||||||
</Grid.RowDefinitions>
|
<!--Name-->
|
||||||
<!--Name-->
|
<TextBlock Grid.Column="0" Grid.Row="0" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="5" Text="Name:" />
|
||||||
<TextBlock Grid.Column="0" Grid.Row="0" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="5" Text="Name:" />
|
<TextBox Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="2" Margin="5" VerticalContentAlignment="Center" Text="{Binding ApplicationName}" />
|
||||||
<TextBox Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="2" Margin="5" VerticalContentAlignment="Center" Text="{Binding ApplicationName}" />
|
|
||||||
|
|
||||||
<!--Icon-->
|
<!--Icon-->
|
||||||
<TextBlock Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="5" Text="Icon:" />
|
<TextBlock Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="5" Text="Icon:" />
|
||||||
<TextBox Grid.Column="1" Grid.Row="1" Margin="5" VerticalContentAlignment="Center" Text="{Binding ApplicationIconPath}" />
|
<TextBox Grid.Column="1" Grid.Row="1" Margin="5" VerticalContentAlignment="Center" Text="{Binding ApplicationIconPath}" />
|
||||||
<Button Grid.Column="2" Grid.Row="1" Margin="5" Padding="5,2" Content="Browse" Click="Button_Icon" />
|
<Button Grid.Column="2" Grid.Row="1" Margin="5" Padding="5,2" Content="Browse" Click="Button_Icon" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
<GroupBox Header="Application 1">
|
<ListView HorizontalContentAlignment="Stretch" ItemsSource="{Binding Applications}" BorderThickness="0">
|
||||||
<local:AppControl ApplicationPath="C:\Test.exe" />
|
<ListView.ItemContainerStyle>
|
||||||
</GroupBox>
|
<Style TargetType="ListViewItem">
|
||||||
<GroupBox Header="Application 2">
|
<Setter Property="Focusable" Value="false"/>
|
||||||
<local:AppControl ApplicationPath="C:\Test.exe" />
|
<Setter Property="Background" Value="Transparent" />
|
||||||
</GroupBox>
|
<Setter Property="Template">
|
||||||
</StackPanel>
|
<Setter.Value>
|
||||||
</ScrollViewer>
|
<ControlTemplate TargetType="{x:Type ListViewItem}">
|
||||||
|
<ContentPresenter />
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</ListView.ItemContainerStyle>
|
||||||
|
<ListView.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<GroupBox Header="{Binding Number}" HeaderStringFormat="Application {0}">
|
||||||
|
<local:AppControl ApplicationPath="{Binding Path}" ApplicationArguments="{Binding Arguments}" ApplicationWorkingDirectory="{Binding WorkingDirectory}" />
|
||||||
|
</GroupBox>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListView.ItemTemplate>
|
||||||
|
</ListView>
|
||||||
|
</DockPanel>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -23,8 +24,15 @@ namespace ExeLauncher.GUI
|
|||||||
public string ApplicationName { get; set; } = "";
|
public string ApplicationName { get; set; } = "";
|
||||||
public string ApplicationIconPath { get; set; } = "";
|
public string ApplicationIconPath { get; set; } = "";
|
||||||
|
|
||||||
|
public ObservableCollection<ApplicationModel> Applications { get; set; }
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
|
Applications = new()
|
||||||
|
{
|
||||||
|
new ApplicationModel()
|
||||||
|
};
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,12 +43,15 @@ namespace ExeLauncher.GUI
|
|||||||
|
|
||||||
private void Button_Add(object sender, RoutedEventArgs e)
|
private void Button_Add(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
Applications.Add(new ApplicationModel() { Number = Applications.Count + 1 });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button_Remove(object sender, RoutedEventArgs e)
|
private void Button_Remove(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (Applications.Count > 1)
|
||||||
|
{
|
||||||
|
Applications.RemoveAt(Applications.Count - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user