Преглед на файлове

添加自动测试暂停

user_lt преди 1 година
родител
ревизия
1836c3cf8f

+ 23 - 9
BlankApp1/BlankApp1/ViewModels/BusinessManageViewModel/AutoTestViewModel.cs

@@ -432,6 +432,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
         private  void Start()
         {
             CancellationToken cancellationToken = tokensource.Token;
+            StartEnalbe = false;
             Task.Run(async() =>  //模拟耗时任务
             {
 
@@ -449,20 +450,26 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
                     {
                         continue;
                     }
+                    //当前选择的项不在更新显示,更新后面的显示
+                    if(selctStartDetailId!=schDetailId)
+                    {
+                        globalSchDetailId = schDetailId;
+
+                        //更新下一个界面显示
+                        int id = Convert.ToInt32(globalSchDetailId);
+                        //界面显示
+                        System.Windows.Application.Current.Dispatcher.Invoke((delegate
+                        {
+                            GetDetailInfo(id);
+                        }));
+                    }
 
-                    globalSchDetailId = schDetailId;
                     await ExecTest();
-                    //更新下一个界面显示
-                    int id = Convert.ToInt32(globalSchDetailId);
-                    //界面显示
-                    System.Windows.Application.Current.Dispatcher.Invoke((delegate
-                    {
-                        GetDetailInfo(id);
-                    }));
+                   
                     //最后一项必须要测试
                     if (globalSchDetailId == basicSchDtls.Max(x => x.scheme_dtl_id))
                     {
-                        await ExecTest();
+                        
                         MessageBox.Show("已是此测试方案最后一个测试项!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
 
                     }
@@ -1247,6 +1254,13 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
             get { return stopOrContinueCont; }
             set { stopOrContinueCont = value; RaisePropertyChanged(); }
         }
+
+        private bool startEnalbe = true;
+        public bool StartEnalbe
+        {
+            get { return startEnalbe; }
+            set { startEnalbe = value; RaisePropertyChanged(); }
+        }
         
         #endregion
 

+ 2 - 2
BlankApp1/BlankApp1/Views/BusinessManageView/AutoTestView.xaml

@@ -265,9 +265,9 @@
         </Grid>
         <Grid Grid.Row="5">
             <StackPanel Orientation="Horizontal"  HorizontalAlignment="Center">
-                <Button  Content="开始检测" Width="80"    Command="{Binding StartCommand}" Style="{StaticResource NormalButtonStyle}" />
+                <Button  Content="开始检测" Width="80" IsEnabled="{Binding StartEnalbe}" Height="30" FontSize="12"   Command="{Binding StartCommand}" Style="{DynamicResource WD.PrimaryButton}" />
                 <Button  Content="{Binding StopOrContinueCont}" Width="80"    Command="{Binding StopOrContinueCommand}" Style="{StaticResource NormalButtonStyle}" Margin="10,0,0,0" />
-                <Button  Content="停止" Width="80"    Command="{Binding CancelCommand}" Style="{StaticResource NormalButtonStyle}" Margin="10,0,0,0" />
+                <!--<Button  Content="停止" Width="80"    Command="{Binding CancelCommand}" Style="{StaticResource NormalButtonStyle}" Margin="10,0,0,0" />-->
             </StackPanel>
           
         </Grid>