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