我想从onTimeOutCommand()方法中执行onCloseCommand(object sender)方法,但我不知道如何传递从该方法传递的所需参数?
请参考以下代码片段。
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}"
视图模型代码:
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?
}
米脂
catspeake
相关分类