There are questions about this already, but this is a bit different so I'm asking. This is my xaml inside Window :
<i:Interaction.Triggers>
<i:EventTrigger EventName="Closing">
<i:InvokeCommandAction Command="{Binding ClosingCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
This is closing Command :
public virtual ICommand ClosingCommand
{
get { return new RelayCommand(ClosingExecute); }
}
This is Execute :
public virtual void ClosingExecute()
{
MessageBoxResult result = MessageBox.Show("Close the application?", "Shut Down", MessageBoxButton.YesNo);
if(result == MessageBoxResult.Yes)
{
Application.Current.Shutdown();
}
else
{
//I don't know what to write
}
}
How can I keep my application alive in this situation? Thanks.