Add button interactions

This commit is contained in:
2021-12-04 13:31:20 +01:00
parent 0d2f2a6653
commit 5d761a5920
4 changed files with 61 additions and 15 deletions

View File

@@ -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
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
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<ApplicationModel> 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));
}
}
}