Skip to content

Commit

Permalink
更改为MaterialDesign控件
Browse files Browse the repository at this point in the history
  • Loading branch information
c longc committed Jul 25, 2023
1 parent 878239d commit 1b0c39f
Show file tree
Hide file tree
Showing 14 changed files with 273 additions and 139 deletions.
4 changes: 4 additions & 0 deletions DragonKing/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:DragonKing"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
Startup="Application_Startup">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<materialDesign:CustomColorTheme BaseTheme="Light" PrimaryColor="Aqua" SecondaryColor="DarkGreen" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
<ResourceDictionary Source="/DragonKing.UI;component/Collection.xaml" />
<ResourceDictionary Source="/DragonKing.UI;component/Themes/Light.xaml" />
</ResourceDictionary.MergedDictionaries>
Expand Down
10 changes: 2 additions & 8 deletions DragonKing/DragonKing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,13 @@
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Model\**" />
<EmbeddedResource Remove="Model\**" />
<None Remove="Model\**" />
<Page Remove="Model\**" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" />
<PackageReference Include="MaterialDesignThemes" Version="4.9.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
<PackageReference Include="Panuon.WPF.UI" Version="1.1.14.3" />
<PackageReference Include="Panuon.WPF.UI" Version="1.1.15.1" />
</ItemGroup>

<ItemGroup>
Expand Down
45 changes: 45 additions & 0 deletions DragonKing/Model/RecordListItemModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DragonKing.Model
{
public class RecordListItemModel
{
public int Id { get; set; }
public int SampleId { get; set; }
public string Index { get; set; }

public string Channel { get; set; }
/// <summary>
/// 加样孔
/// </summary>
public string SampleIndex { get; set; }
public string SampleBarCode { get; set; }
public string ExperimentName { get; set; }
/// <summary>
/// 项目Id
/// </summary>
public int ProjectId { get; set; }
/// <summary>
/// 项目名称
/// </summary>
public string Project { get; set; }
/// <summary>
/// 检测时间
/// </summary>
public DateTime DetectionTime { get; set; }

/// <summary>
/// 结果,是否有效
/// </summary>

public string Result { get; set; }
public string OperatorName { get; set; }//操作人员

//public CommonLibrary.SampleType SampleType { get; set; }//样本类型
public string SampleType { get; set; }//样本类型
}
}
36 changes: 20 additions & 16 deletions DragonKing/View/MainView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,17 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:local="clr-namespace:DragonKing.View"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI"
Title="MainView"
Width="1366"
Height="768"
WindowState="Maximized"
WindowStartupLocation="CenterScreen"
pu:WindowXCaption.Height="0"
WindowStartupLocation="CenterScreen"
WindowState="Maximized"
mc:Ignorable="d">
<pu:WindowX.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Panuon.WPF.UI;component/Control.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</pu:WindowX.Resources>

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
Expand Down Expand Up @@ -57,22 +52,31 @@
</ListBox>

<Button
Margin="0 0 5 10"
Width="55"
Height="55"
Margin="0,0,25,10"
Padding="1"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="50"
FontWeight="SemiBold"
Foreground="White"
Background="{x:Null}"
Content="×"
Click="Close"/>
Click="Close"
BorderThickness="0"
FontWeight="SemiBold"
Foreground="White">
<Button.Content>
<materialDesign:PackIcon
Width="45"
Height="45"
Kind="CloseOutline" />
</Button.Content>
</Button>

<ContentControl
Grid.Row="1"
Margin="10"
BorderThickness="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
BorderThickness="0"
Content="{Binding Content}" />


Expand Down
199 changes: 111 additions & 88 deletions DragonKing/View/ResultView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:local="clr-namespace:DragonKing.View"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI"
Width="1800"
d:DesignHeight="450"
Height="850"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="2*" />
<RowDefinition Height="4*" />
<RowDefinition Height="4*" />
</Grid.RowDefinitions>
<Border>
<WrapPanel>
Expand Down Expand Up @@ -57,97 +58,119 @@
<Button Content="清除" Style="{StaticResource ResultButtonStyle}" />
</WrapPanel>
</Border>

<Border Grid.Row="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<DataGrid
Margin="20"
AutoGenerateColumns="False"
Background="Transparent"
BorderThickness="0"
CanUserAddRows="False"
CanUserSortColumns="False"
CellStyle="{StaticResource cellstyle}"
FrozenColumnCount="4"
ItemsSource="{Binding UserList, IsAsync=True}"
RowHeaderWidth="60"
SelectedItem="{Binding SelectedUser}"
Style="{StaticResource dgstyle}">
<DataGrid.Columns>
<DataGridTextColumn
Width="*"
Binding="{Binding Name}"
CanUserSort="False"
Header="实验名称"
IsReadOnly="True" />
<DataGridTextColumn
Width="*"
Binding="{Binding .}"
CanUserSort="False"
Header="项目"
IsReadOnly="True" />
<DataGridTextColumn
Width="*"
Binding="{Binding .}"
CanUserSort="False"
Header="样本编号"
IsReadOnly="True" />
<DataGridTextColumn
Width="*"
Binding="{Binding .}"
CanUserSort="False"
Header="通道"
IsReadOnly="True" />
<DataGridTextColumn
Width="*"
Binding="{Binding .}"
CanUserSort="False"
Header="样本类型"
IsReadOnly="True" />
<DataGridTextColumn
Width="*"
Binding="{Binding .}"
CanUserSort="False"
Header="检测时间"
IsReadOnly="True" />
<DataGridTextColumn
Width="*"
Binding="{Binding .}"
CanUserSort="False"
Header="结果"
IsReadOnly="True" />
<DataGridTextColumn
Width="*"
Binding="{Binding .}"
CanUserSort="False"
Header="操作者"
IsReadOnly="True" />
<DataGridTemplateColumn Width="1*" Header="操作">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel VerticalAlignment="Center" Orientation="Horizontal">
<Button
Command="{Binding DeleteUserCommand}"
Content="删除"
Style="{StaticResource DeleteButtonStyle}" />
<Button
Command="{Binding UpdateUserCommand}"
Content="属性"
Style="{StaticResource PropertyButtonStyle}" />
<Button
Command="{Binding UpdateUserCommand}"
Content="属性"
Style="{StaticResource PropertyButtonStyle}" />
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<StackPanel>
<DataGrid
Margin="20"
AutoGenerateColumns="False"
Background="Transparent"
BorderThickness="0"
CanUserAddRows="False"
CanUserSortColumns="False"
CellStyle="{StaticResource cellstyle}"
FrozenColumnCount="4"
ItemsSource="{Binding RecordListDisplay, IsAsync=True}"
RowHeaderWidth="60"
Style="{StaticResource dgstyle}">
<DataGrid.Columns>
<DataGridTextColumn
Width="*"
Binding="{Binding Id}"
CanUserSort="False"
Header="实验名称"
IsReadOnly="True" />
<DataGridTextColumn
Width="*"
Binding="{Binding .}"
CanUserSort="False"
Header="项目"
IsReadOnly="True" />
<DataGridTextColumn
Width="*"
Binding="{Binding .}"
CanUserSort="False"
Header="样本编号"
IsReadOnly="True" />
<DataGridTextColumn
Width="*"
Binding="{Binding .}"
CanUserSort="False"
Header="通道"
IsReadOnly="True" />
<DataGridTextColumn
Width="*"
Binding="{Binding .}"
CanUserSort="False"
Header="样本类型"
IsReadOnly="True" />
<DataGridTextColumn
Width="*"
Binding="{Binding .}"
CanUserSort="False"
Header="检测时间"
IsReadOnly="True" />
<DataGridTextColumn
Width="*"
Binding="{Binding .}"
CanUserSort="False"
Header="结果"
IsReadOnly="True" />
<DataGridTextColumn
Width="*"
Binding="{Binding .}"
CanUserSort="False"
Header="操作者"
IsReadOnly="True" />
<DataGridTemplateColumn Width="1*" Header="操作">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel VerticalAlignment="Center" Orientation="Horizontal">
<Button
Command="{Binding DeleteUserCommand}"
Content="删除"
Style="{StaticResource DeleteButtonStyle}" />
<Button
Command="{Binding UpdateUserCommand}"
Content="属性"
Style="{StaticResource PropertyButtonStyle}" />
<Button
Command="{Binding UpdateUserCommand}"
Content="属性"
Style="{StaticResource PropertyButtonStyle}" />
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<pu:Pagination
Height="40"
HorizontalAlignment="Right"
CurrentPage="{Binding CurrentPage}"
FontSize="16"
ItemsWidth="40"
MaxPage="{Binding TotalPages}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="CurrentPageChanged">
<i:InvokeCommandAction Command="{Binding GoToPageCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</pu:Pagination>
<WrapPanel>
<TextBox
x:Name="page"
Width="60"
pu:TextBoxHelper.Watermark="Page"
Text="{Binding CurrentPage}" />
<Button Command="{Binding GoToPageCommand}" Content="Go" />

</WrapPanel>
</StackPanel>

</Grid>
</Border>
</Grid>
Expand Down
1 change: 1 addition & 0 deletions DragonKing/View/ResultView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ public ResultView()
this.DataContext = App.Current._host.Services.GetService<ResultViewModel>();

}

}
}
Loading

0 comments on commit 1b0c39f

Please sign in to comment.