You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
996 B

2 years ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Command.Commands
{
internal class Invoker
{
private ICommand _onStart;
private ICommand _onFinish;
public void SetOnStart(ICommand command)
{
_onStart = command;
}
public void SetOnFinish(ICommand command)
{
_onFinish = command;
}
public void DoSomethingImportant()
{
Console.WriteLine("Invoker: Does anybody want something done before I begin?");
if (_onStart != null)
{
_onStart.Execute();
}
Console.WriteLine("Invoker: ...doing someting really important...");
Console.WriteLine("Invoker: Does anybody want something done after I finish?");
if (_onFinish != null)
{
_onFinish.Execute();
}
}
}
}