Files
WPF_Practice/PacticeSolution/CommandSample/ViewModels/MessageViewModel.cs
2023-08-03 11:59:30 +09:00

34 lines
765 B
C#

using CommandSample.Commands;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace CommandSample.ViewModels
{
internal class MessageViewModel
{
public MessageCommand DisplayMessageCommand { get; set; }
public MessageViewModel()
{
this.DisplayMessageCommand = new MessageCommand(DisplayMessage, AddMessage);
}
public void DisplayMessage(string param)
{
MessageBox.Show($"Clicked! (Param: {param})");
}
public bool AddMessage(string param)
{
if (string.IsNullOrEmpty(param))
return false;
return true;
}
}
}