Binding Commands

This commit is contained in:
MaddoScientisto 2024-10-14 23:25:35 +02:00
commit 22f7143d6e
4 changed files with 156 additions and 16 deletions

View file

@ -1,19 +1,30 @@
using ImageCatalog_2.Services;
using ImageCatalog_2.Commands;
using ImageCatalog_2.Services;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace ImageCatalog_2
{
public class DataModel : ViewModelBase
{
public ICommand TestCommand { get; }
public ICommand AsyncTestCommand { get; }
private readonly ITestService _service;
public DataModel(ITestService testService)
{
_service = testService;
TestCommand = new RelayCommand(Test);
AsyncTestCommand = new AsyncCommand(TestAsync);
}
private string _sourcePath;
@ -39,5 +50,15 @@ namespace ImageCatalog_2
}
}
private void Test(object parameter)
{
Debug.WriteLine("Yep");
}
private async Task TestAsync()
{
Debug.WriteLine("Yep c");
}
}
}