底部工具栏
![]()
<Border Grid.Row="1"BorderBrush="White"BorderThickness="0 0.5 0 0"><DockPanelLastChildFill="True"><StackPanelMargin="10 0 0 0"HorizontalAlignment="Center"VerticalAlignment="Center"><TextBlock><RunText="耗时:"/><RunText="{Binding ModuleParam.ElapsedTime}"/><RunText="ms"/></TextBlock><TextBlock><RunText="状态:"/><RunText="{Binding ModuleParam.Status,Converter={StaticResource StatusConverter}}"/></TextBlock></StackPanel><StackPanelOrientation="Horizontal"HorizontalAlignment="Right"><Buttonx:Name="btnExecute"Content="执行"HorizontalAlignment="Right"Margin="10 0"Command="{Binding ExecuteCommand}"/><Buttonx:Name="btnCancel"Content="取消"HorizontalAlignment="Right"Margin="10 0"Click="btnCancel_Click"/><Buttonx:Name="btnConfirm"Content="确认"HorizontalAlignment="Right"Margin="10 0"Command="{Binding ConfirmCommand}"Background="#FFFF2000"BorderBrush="#FFFF2000"/></StackPanel></DockPanel></Border>
/// <summary>/// 取消按钮/// </summary>/// <param name="sender"></param>/// <param name="e"></param>privatevoidbtnCancel_Click(objectsender,RoutedEventArgse){this.Close();}
确认按钮:关闭窗口
[NonSerialized]privateCommandBase_ConfirmCommand;publicCommandBaseConfirmCommand{get{if(_ConfirmCommand==null){_ConfirmCommand=newCommandBase((obj)=>{varview=this.ModuleViewasShowImageView;if(view!=null){view.Close();}});}return_ConfirmCommand;}}
执行
[NonSerialized]privateCommandBase_ExecuteCommand;publicCommandBaseExecuteCommand{get{if(_ExecuteCommand==null){_ExecuteCommand=newCommandBase((obj)=>{ExeModule();});}return_ExecuteCommand;}}
publicoverrideboolExeModule(){Stopwatch.Restart();try{if(nImageIndex==null||ImageParam.Count<=0){ChangeModuleRunStatus(eRunStatus.NG);returnfalse;}boolbImage=false;intnIndex=Convert.ToInt32(GetLinkValue(nImageIndex));for(inti=0;i<ImageParam.Count;i++){if(nIndex==ImageParam[i].Index&&ImageParam[i].InputImage.Text!=""){GetDispImage(ImageParam[i].InputImage.Text,true);bImage=true;}}if(DispImage==null||!DispImage.IsInitialized()||bImage==false){ChangeModuleRunStatus(eRunStatus.NG);returnfalse;}ShowHRoi();ChangeModuleRunStatus(eRunStatus.OK);returntrue;}catch(Exceptionex){ChangeModuleRunStatus(eRunStatus.NG);Logger.GetExceptionMsg(ex);returnfalse;}}