diff --git a/ExeLauncher.GUI/AppControl.xaml b/ExeLauncher.GUI/AppControl.xaml
index cae327a..4996c66 100644
--- a/ExeLauncher.GUI/AppControl.xaml
+++ b/ExeLauncher.GUI/AppControl.xaml
@@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ExeLauncher.GUI"
mc:Ignorable="d"
- DataContext="{Binding RelativeSource={RelativeSource Self}}"
+ d:DataContext="{d:DesignInstance local:ApplicationModel}"
d:DesignHeight="450" d:DesignWidth="800">
@@ -20,15 +20,15 @@
-
+
-
+
-
+
diff --git a/ExeLauncher.GUI/AppControl.xaml.cs b/ExeLauncher.GUI/AppControl.xaml.cs
index e1e6cc0..a2da27a 100644
--- a/ExeLauncher.GUI/AppControl.xaml.cs
+++ b/ExeLauncher.GUI/AppControl.xaml.cs
@@ -54,8 +54,6 @@ namespace ExeLauncher.GUI
public AppControl()
{
InitializeComponent();
-
- //DataContext = this;
}
private void Button_Path(object sender, RoutedEventArgs e)
diff --git a/ExeLauncher.GUI/ApplicationModel.cs b/ExeLauncher.GUI/ApplicationModel.cs
index e6c4740..2aa5a52 100644
--- a/ExeLauncher.GUI/ApplicationModel.cs
+++ b/ExeLauncher.GUI/ApplicationModel.cs
@@ -1,16 +1,81 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.Linq;
+using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace ExeLauncher.GUI
{
- public record ApplicationModel
+ public record ApplicationModel : INotifyPropertyChanged
{
- public int Number { get; set; } = 1;
- public string Path { get; set; } = "";
- public string Arguments { get; set; } = "";
- public string WorkingDirectory { get; set; } = "";
+ private int _number = 1;
+ public int Number
+ {
+ get => _number;
+ set
+ {
+ if (_number != value)
+ {
+ _number = value;
+
+ NotifyPropertyChanged();
+ }
+ }
+ }
+
+ private string _path = "";
+ public string Path
+ {
+ get => _path;
+ set
+ {
+ if (_path != value)
+ {
+ _path = value;
+
+ NotifyPropertyChanged();
+ }
+ }
+ }
+
+ private string _arguments = "";
+ public string Arguments
+ {
+ get => _arguments;
+ set
+ {
+ if (_arguments != value)
+ {
+ _arguments = value;
+
+ NotifyPropertyChanged();
+ }
+ }
+ }
+
+ private string _workingDirectory = "";
+ public string WorkingDirectory
+ {
+ get => _workingDirectory;
+ set
+ {
+ if (_workingDirectory != value)
+ {
+ _workingDirectory = value;
+
+ NotifyPropertyChanged();
+ }
+ }
+ }
+
+ public event PropertyChangedEventHandler? PropertyChanged;
+
+ private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
}
}
+
diff --git a/ExeLauncher.GUI/MainWindow.xaml b/ExeLauncher.GUI/MainWindow.xaml
index 0a488f4..c3f1af3 100644
--- a/ExeLauncher.GUI/MainWindow.xaml
+++ b/ExeLauncher.GUI/MainWindow.xaml
@@ -55,7 +55,7 @@
-
+