ltwork 1 vuosi sitten
vanhempi
commit
c2678ee18d

+ 14 - 6
BlankApp1/BlankApp1/ViewModels/BusinessManageViewModel/ProjectTestViewModel.cs

@@ -1,6 +1,7 @@
 using AutoMapper;
 using AutoMapper;
 using BizService;
 using BizService;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Logging;
+using Model;
 using Model.Dto;
 using Model.Dto;
 using Model.Entities;
 using Model.Entities;
 using PLCTool.Views.BusinessManageView;
 using PLCTool.Views.BusinessManageView;
@@ -14,6 +15,7 @@ using System.Linq;
 using System.Text;
 using System.Text;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using WPFDevelopers.Helpers;
 using WPFDevelopers.Helpers;
+using static System.Net.Mime.MediaTypeNames;
 
 
 namespace PLCTool.ViewModels.BusinessManageViewModel
 namespace PLCTool.ViewModels.BusinessManageViewModel
 {
 {
@@ -29,7 +31,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
         private readonly IDialogService _dialog;
         private readonly IDialogService _dialog;
         private readonly ILogger _logger;
         private readonly ILogger _logger;
         private ObservableCollection<DeviceTestCardView> allProjectePicList = new ObservableCollection<DeviceTestCardView>();
         private ObservableCollection<DeviceTestCardView> allProjectePicList = new ObservableCollection<DeviceTestCardView>();
-        private int eachColumNum = 3; //每行展示卡片个数
+        private int eachColumNum = 4; //每行展示卡片个数
         public ProjectTestViewModel(IBasicDeviceService iBasicDeviceService, IBasicDeviceKindService iBasicDeviceKindService, IBasicProjectService iBasicProjectService, IBizTestRecordService iBizTestRecordService, IMapper mapper, IDialogService dialog, ILogger logger)
         public ProjectTestViewModel(IBasicDeviceService iBasicDeviceService, IBasicDeviceKindService iBasicDeviceKindService, IBasicProjectService iBasicProjectService, IBizTestRecordService iBizTestRecordService, IMapper mapper, IDialogService dialog, ILogger logger)
         {
         {
             _iBasicDeviceService = iBasicDeviceService;
             _iBasicDeviceService = iBasicDeviceService;
@@ -124,18 +126,24 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
                 //赋值
                 //赋值
                 allProjectePicList.Add(deviceCard);
                 allProjectePicList.Add(deviceCard);
             }
             }
+            
             foreach (var item in allProjectePicList)
             foreach (var item in allProjectePicList)
-            {
-                ProjectePicList.Add(item);
+             {
+
+                    
+                   ProjectePicList.Add(item);
+                    
+
             }
             }
+     
             //计算行数
             //计算行数
-            if (projectNames.Count % eachColumNum == 0)
+            if (ProjectePicList.Count % eachColumNum == 0)
             {
             {
-                RowsCount = projectNames.Count / eachColumNum;
+                RowsCount = ProjectePicList.Count / eachColumNum;
             }
             }
             else
             else
             {
             {
-                RowsCount = projectNames.Count / eachColumNum + 1;
+                RowsCount = ProjectePicList.Count / eachColumNum + 1;
             }
             }
             if (RowsCount < 2)
             if (RowsCount < 2)
             {
             {

+ 3 - 2
BlankApp1/BlankApp1/Views/BusinessManageView/DeviceResultCardView.xaml

@@ -6,8 +6,9 @@
              xmlns:local="clr-namespace:PLCTool.Views.BusinessManageView"
              xmlns:local="clr-namespace:PLCTool.Views.BusinessManageView"
              xmlns:prism="http://prismlibrary.com/"
              xmlns:prism="http://prismlibrary.com/"
               prism:ViewModelLocator.AutoWireViewModel="True"
               prism:ViewModelLocator.AutoWireViewModel="True"
-             Height="260" Width="280">
-    <Border BorderBrush="#CBCBCB"  BorderThickness="1" CornerRadius="5">
+             mc:Ignorable="d" 
+            Height="260" d:DesignWidth="280">
+    <Border BorderBrush="#CBCBCB"  BorderThickness="1" CornerRadius="5" Margin="10">
         <Grid>
         <Grid>
 
 
             <Grid.InputBindings>
             <Grid.InputBindings>

+ 4 - 3
BlankApp1/BlankApp1/Views/BusinessManageView/DeviceTestCardView.xaml

@@ -6,9 +6,10 @@
              xmlns:local="clr-namespace:PLCTool.Views.BusinessManageView"
              xmlns:local="clr-namespace:PLCTool.Views.BusinessManageView"
               xmlns:prism="http://prismlibrary.com/"
               xmlns:prism="http://prismlibrary.com/"
               prism:ViewModelLocator.AutoWireViewModel="True"
               prism:ViewModelLocator.AutoWireViewModel="True"
-             Height="240" Width="280">
-    <Border BorderBrush="#CBCBCB"  BorderThickness="1" CornerRadius="5">
-        <Grid>
+              mc:Ignorable="d" 
+              Height="260" d:DesignWidth="280">
+    <Border BorderBrush="#CBCBCB"  BorderThickness="1" CornerRadius="5" Margin="10">
+        <Grid >
 
 
             <Grid.InputBindings>
             <Grid.InputBindings>
                 <MouseBinding MouseAction="LeftDoubleClick" Command="{Binding DoubleClickCommand}" CommandParameter="{Binding ElementName=txtName}">
                 <MouseBinding MouseAction="LeftDoubleClick" Command="{Binding DoubleClickCommand}" CommandParameter="{Binding ElementName=txtName}">

+ 6 - 49
BlankApp1/BlankApp1/Views/BusinessManageView/ProjectTestResultView.xaml

@@ -57,58 +57,15 @@
             <Button  Content="查询" Width="80"  Margin="5,0"  Command="{Binding QueryCommand}" Style="{StaticResource NormalButtonStyle}" />
             <Button  Content="查询" Width="80"  Margin="5,0"  Command="{Binding QueryCommand}" Style="{StaticResource NormalButtonStyle}" />
             <Button  Content="重置" Width="80"  Margin="15,0"  Command="{Binding ResetCommand}" Style="{StaticResource NormalButtonStyle}" />
             <Button  Content="重置" Width="80"  Margin="15,0"  Command="{Binding ResetCommand}" Style="{StaticResource NormalButtonStyle}" />
         </StackPanel>
         </StackPanel>
+    
         <ScrollViewer Grid.Row="2">
         <ScrollViewer Grid.Row="2">
-            <ListBox  x:Name="listboxPic"  SnapsToDevicePixels="True" Grid.IsSharedSizeScope="True" ScrollViewer.VerticalScrollBarVisibility="Disabled" ItemsSource="{Binding ProjectResultPicList}"   >
-
-                <ListBox.ItemsPanel>
+            <ItemsControl  ItemsSource="{Binding ProjectResultPicList}">
+                <ItemsControl.ItemsPanel>
                     <ItemsPanelTemplate>
                     <ItemsPanelTemplate>
-                        <UniformGrid  x:Name="gridPic" Columns="3" Rows="{Binding RowsCount}"  HorizontalAlignment="Center" VerticalAlignment="Center"  >
-
-                        </UniformGrid>
+                        <UniformGrid  Columns="4"   Rows="{Binding RowsCount}" Margin="10" Cursor="Hand"/>
                     </ItemsPanelTemplate>
                     </ItemsPanelTemplate>
-                </ListBox.ItemsPanel>
-                <ListBox.Template>
-                    <ControlTemplate>
-                        <ItemsPresenter></ItemsPresenter>
-                    </ControlTemplate>
-                </ListBox.Template>
-
-            </ListBox>
+                </ItemsControl.ItemsPanel>
+            </ItemsControl>
         </ScrollViewer>
         </ScrollViewer>
-
-        <!--<ScrollViewer Grid.Row="2">
-         <ListBox x:Name="listboxPic" ItemsSource="{Binding ProjectePicList}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible"
-        VerticalAlignment="Center" BorderThickness="0">
-             <ListBox.ItemsPanel>
-                 <ItemsPanelTemplate>
-                     <myControl:MyWrapPanel IsItemsHost="True"/>
-                 </ItemsPanelTemplate>
-             </ListBox.ItemsPanel>
-             <ListBox.Template>
-                 <ControlTemplate>
-                     <ItemsPresenter></ItemsPresenter>
-                 </ControlTemplate>
-             </ListBox.Template>
-            
-         </ListBox>
-     </ScrollViewer>-->
-        <!--<ScrollViewer Grid.Row="2">
-         <ListBox x:Name="listboxPic" ItemsSource="{Binding ProjectePicList}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible"
- VerticalAlignment="Center" BorderThickness="0">
-             <ListBox.ItemsPanel>
-                 <ItemsPanelTemplate>
-                     
-                         <WrapPanel Orientation="Horizontal" Margin="10" IsItemsHost="True" ScrollViewer.CanContentScroll="True"/>
-                    
-                 </ItemsPanelTemplate>
-             </ListBox.ItemsPanel>
-             <ListBox.Template>
-                 <ControlTemplate>
-                     <ItemsPresenter></ItemsPresenter>
-                 </ControlTemplate>
-             </ListBox.Template>
-
-         </ListBox>
-     </ScrollViewer>-->
     </Grid>
     </Grid>
 </UserControl>
 </UserControl>

+ 7 - 48
BlankApp1/BlankApp1/Views/BusinessManageView/ProjectTestView.xaml

@@ -57,58 +57,17 @@
             <Button  Content="查询" Width="80"  Margin="5,0"  Command="{Binding QueryCommand}" Style="{StaticResource NormalButtonStyle}" />
             <Button  Content="查询" Width="80"  Margin="5,0"  Command="{Binding QueryCommand}" Style="{StaticResource NormalButtonStyle}" />
             <Button  Content="重置" Width="80"  Margin="15,0"  Command="{Binding ResetCommand}" Style="{StaticResource NormalButtonStyle}" />
             <Button  Content="重置" Width="80"  Margin="15,0"  Command="{Binding ResetCommand}" Style="{StaticResource NormalButtonStyle}" />
         </StackPanel>
         </StackPanel>
+     
         <ScrollViewer Grid.Row="2">
         <ScrollViewer Grid.Row="2">
-            <ListBox  x:Name="listboxPic"  SnapsToDevicePixels="True" Grid.IsSharedSizeScope="True" ScrollViewer.VerticalScrollBarVisibility="Disabled" ItemsSource="{Binding ProjectePicList}"   >
-
-                <ListBox.ItemsPanel>
+            <ItemsControl  ItemsSource="{Binding ProjectePicList}">
+                <ItemsControl.ItemsPanel>
                     <ItemsPanelTemplate>
                     <ItemsPanelTemplate>
-                        <UniformGrid  x:Name="gridPic" Columns="3" Rows="{Binding RowsCount}"  HorizontalAlignment="Center" VerticalAlignment="Center"  >
-                           
-                        </UniformGrid>
+                        <UniformGrid  Columns="4"   Rows="{Binding RowsCount}" Margin="10" Cursor="Hand" />
                     </ItemsPanelTemplate>
                     </ItemsPanelTemplate>
-                </ListBox.ItemsPanel>
-                <ListBox.Template>
-                    <ControlTemplate>
-                        <ItemsPresenter></ItemsPresenter>
-                    </ControlTemplate>
-                </ListBox.Template>
-
-            </ListBox>
+                </ItemsControl.ItemsPanel>
+            </ItemsControl>
         </ScrollViewer>
         </ScrollViewer>
+       
      
      
-        <!--<ScrollViewer Grid.Row="2">
-            <ListBox x:Name="listboxPic" ItemsSource="{Binding ProjectePicList}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible"
-           VerticalAlignment="Center" BorderThickness="0">
-                <ListBox.ItemsPanel>
-                    <ItemsPanelTemplate>
-                        <myControl:MyWrapPanel IsItemsHost="True"/>
-                    </ItemsPanelTemplate>
-                </ListBox.ItemsPanel>
-                <ListBox.Template>
-                    <ControlTemplate>
-                        <ItemsPresenter></ItemsPresenter>
-                    </ControlTemplate>
-                </ListBox.Template>
-               
-            </ListBox>
-        </ScrollViewer>-->
-        <!--<ScrollViewer Grid.Row="2">
-            <ListBox x:Name="listboxPic" ItemsSource="{Binding ProjectePicList}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible"
-    VerticalAlignment="Center" BorderThickness="0">
-                <ListBox.ItemsPanel>
-                    <ItemsPanelTemplate>
-                        
-                            <WrapPanel Orientation="Horizontal" Margin="10" IsItemsHost="True" ScrollViewer.CanContentScroll="True"/>
-                       
-                    </ItemsPanelTemplate>
-                </ListBox.ItemsPanel>
-                <ListBox.Template>
-                    <ControlTemplate>
-                        <ItemsPresenter></ItemsPresenter>
-                    </ControlTemplate>
-                </ListBox.Template>
-
-            </ListBox>
-        </ScrollViewer>-->
     </Grid>
     </Grid>
 </UserControl>
 </UserControl>