Я хочу выполнить метод метода onCloseCommand (отправитель объекта) в методе onTimeOutCommand (), но я не знаю, как передать обязательный параметр, передаваемый этим методом?
Пожалуйста, обратитесь к следующему фрагменту кода.
Код XAML:
x:name = "Recorder" // window name define in the begining
//below command is used for closing this window when user clicks on close button
Command = "{Binding CloseCommand}" CommandParameter="{Binding ElementName=Recorder}"
Код ViewModel:
CloseCommand = new DelegateCommand<object>(helper.onCloseCommand);
Код ViewModelHelper:
Note: onCloseCommand() methodis working as per expectation
onCloseCommand(object sender) // This method is used for closing the window on clicking on close button of this window
{
if(sender != null && send is window)
{
(sender as window).close();
}
}
onTimeOutCommand() // this method is used for closing the window (the window which is passed in onCloseCommand() method) automaticlly after time out of the recording
{
how to perform onCloseCommand() from this method?
}