diff --git a/ExeLauncher.GUI/AppControl.xaml b/ExeLauncher.GUI/AppControl.xaml
index 9b8f791..cae327a 100644
--- a/ExeLauncher.GUI/AppControl.xaml
+++ b/ExeLauncher.GUI/AppControl.xaml
@@ -29,7 +29,6 @@
-
-
+
diff --git a/ExeLauncher.GUI/AppControl.xaml.cs b/ExeLauncher.GUI/AppControl.xaml.cs
index 6f214b2..e1e6cc0 100644
--- a/ExeLauncher.GUI/AppControl.xaml.cs
+++ b/ExeLauncher.GUI/AppControl.xaml.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -11,7 +12,7 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
-using System.Windows.Shapes;
+using Microsoft.Win32;
namespace ExeLauncher.GUI
{
@@ -59,12 +60,20 @@ namespace ExeLauncher.GUI
private void Button_Path(object sender, RoutedEventArgs e)
{
+ var dialog = new OpenFileDialog()
+ {
+ AddExtension = true,
+ DefaultExt = ".exe",
+ FileName = "Run.exe",
+ Filter = "Executable|*.exe"
+ };
- }
-
- private void Button_WorkingDirectory(object sender, RoutedEventArgs e)
- {
+ if (dialog.ShowDialog() == true)
+ {
+ ApplicationPath = dialog.FileName;
+ ApplicationWorkingDirectory = Path.GetDirectoryName(ApplicationPath) ?? "";
+ }
}
}
}
diff --git a/ExeLauncher.GUI/MainWindow.xaml.cs b/ExeLauncher.GUI/MainWindow.xaml.cs
index d0a9aa8..6808f22 100644
--- a/ExeLauncher.GUI/MainWindow.xaml.cs
+++ b/ExeLauncher.GUI/MainWindow.xaml.cs
@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.ComponentModel;
using System.Linq;
+using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@@ -19,10 +21,41 @@ namespace ExeLauncher.GUI
///
/// Interaction logic for MainWindow.xaml
///
- public partial class MainWindow : Window
+ public partial class MainWindow : Window, INotifyPropertyChanged
{
- public string ApplicationName { get; set; } = "";
- public string ApplicationIconPath { get; set; } = "";
+ public event PropertyChangedEventHandler? PropertyChanged;
+
+ private string _appName = "";
+
+ public string ApplicationName
+ {
+ get => _appName;
+ set
+ {
+ if (_appName != value)
+ {
+ _appName = value;
+
+ NotifyPropertyChanged();
+ }
+ }
+ }
+
+ private string _applicationIconPath = "";
+
+ public string ApplicationIconPath
+ {
+ get => _applicationIconPath;
+ set
+ {
+ if (_applicationIconPath != value)
+ {
+ _applicationIconPath = value;
+
+ NotifyPropertyChanged();
+ }
+ }
+ }
public ObservableCollection Applications { get; set; }
@@ -38,7 +71,7 @@ namespace ExeLauncher.GUI
private void Button_Icon(object sender, RoutedEventArgs e)
{
-
+ ApplicationIconPath = Program.GetIcon();
}
private void Button_Add(object sender, RoutedEventArgs e)
@@ -53,5 +86,10 @@ namespace ExeLauncher.GUI
Applications.RemoveAt(Applications.Count - 1);
}
}
+
+ private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
}
}
diff --git a/ExeLauncher/Program.cs b/ExeLauncher/Program.cs
index ca38b38..3ece5b9 100644
--- a/ExeLauncher/Program.cs
+++ b/ExeLauncher/Program.cs
@@ -8,7 +8,7 @@ using System.Windows.Forms;
namespace ExeLauncher
{
- class Program
+ public class Program
{
const string Paths = "%Paths%";
const string Arguments = "%Arguments%";
@@ -62,7 +62,7 @@ namespace ExeLauncher
Console.ReadKey(true);
}
- private static void CreateExecutable(string location, string paths, string arguments, string workingDirectories, string icon)
+ public static void CreateExecutable(string location, string paths, string arguments, string workingDirectories, string icon)
{
code = code.Replace(Paths, paths);
code = code.Replace(Arguments, arguments);
@@ -92,7 +92,7 @@ namespace ExeLauncher
}
}
- private static string GetIcon()
+ public static string GetIcon()
{
var dialog = new OpenFileDialog()
{
@@ -108,7 +108,7 @@ namespace ExeLauncher
return "";
}
- private static string GetLocation()
+ public static string GetLocation()
{
var dialog = new SaveFileDialog()
{