CompositeCommands, "", .
public static class HostCommands
{
private static readonly CompositeCommand Shutdown = new CompositeCommand();
public static CompositeCommand ShutdownCommand
{
get { return Shutdown; }
}
}
shutdown ,
public Shell()
{
InitializeComponent();
Closing += (sender, e) =>
{
if (HostCommands.ShutdownCommand.CanExecute(e))
HostCommands.ShutdownCommand.Execute(e);
};
}
,
public SomeViewModel(IEventAggregator eventService)
{
HostCommands.ShutdownCommand.
RegisterCommand(new DelegateCommand<object>(_ => Save()));
}
, , . , CancelEventArgs, , , Cancel = true. Shell , , . .