Add button interactions
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user