Merge branch 'master' of https://git.kaiyili-lab.com/huangsucan/ACP
This commit is contained in:
@@ -227,7 +227,7 @@ Command="{Binding GetFileStringCommand}">
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Header="切换九宫格"
|
||||
<MenuItem Header="切换初始主界面"
|
||||
FontSize="13"
|
||||
Height="50"
|
||||
Foreground="White"
|
||||
|
||||
@@ -1,18 +1,30 @@
|
||||
using DeviceCommand.Base;
|
||||
using DeviceCommand.Devices;
|
||||
using MainModule.Views;
|
||||
using System.Reflection;
|
||||
using UIShare.GlobalVariable;
|
||||
using Prism.Ioc;
|
||||
using Prism.Modularity;
|
||||
|
||||
namespace MainModule
|
||||
{
|
||||
[Module(OnDemand=true)]
|
||||
[Module(OnDemand = true)]
|
||||
public class MainModule : IModule
|
||||
{
|
||||
public void OnInitialized(IContainerProvider containerProvider)
|
||||
{
|
||||
IRegionManager regionManager = containerProvider.Resolve<IRegionManager>();
|
||||
|
||||
// 1. 加载主界面
|
||||
regionManager.RegisterViewWithRegion("ShellViewManager", typeof(MainView));
|
||||
|
||||
// 2. 给 3 个台架分别注入测试视图
|
||||
// 当你点击 "台架 1" 的 Tab 时,就会显示这个 AutomatedTestingView
|
||||
regionManager.RegisterViewWithRegion("TestCell1", typeof(AutomatedTestingView));
|
||||
|
||||
// 当你点击 "台架 2" 的 Tab 时,就会显示这个 AutomatedTestingView
|
||||
regionManager.RegisterViewWithRegion("TestCell2", typeof(AutomatedTestingView));
|
||||
|
||||
// 当你点击 "台架 3" 的 Tab 时,就会显示这个 AutomatedTestingView
|
||||
regionManager.RegisterViewWithRegion("TestCell3", typeof(AutomatedTestingView));
|
||||
}
|
||||
|
||||
public void RegisterTypes(IContainerRegistry containerRegistry)
|
||||
@@ -22,4 +34,4 @@ namespace MainModule
|
||||
containerRegistry.RegisterForNavigation<ProtocolStartView>("ProtocolStartView");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
xmlns:converters="clr-namespace:UIShare.Converters;assembly=UIShare"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920">
|
||||
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Loaded">
|
||||
<i:InvokeCommandAction Command="{Binding LoadedCommand}"/>
|
||||
@@ -18,241 +19,100 @@
|
||||
<converters:StringToVisibilityConverter x:Key="StringToVisibilityConverter"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Background="#F0F2F5">
|
||||
<!-- 加一个浅灰底色更能衬托出白色的选项卡,可根据你的UI调整 -->
|
||||
|
||||
<!-- 顶部的选项卡,切换 3 个台架 -->
|
||||
<TabControl Margin="5">
|
||||
|
||||
<TabControl.Resources>
|
||||
<!-- 1. 去除 TabControl 原生的丑陋边框和灰色背景 -->
|
||||
<Style TargetType="TabControl">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Padding" Value="0,5,0,0"/>
|
||||
</Style>
|
||||
|
||||
<!-- 2. 美化 TabItem 标签头 -->
|
||||
<Style TargetType="TabItem">
|
||||
<Setter Property="FontSize" Value="16"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="Foreground" Value="#8C8C8C"/>
|
||||
<!-- 默认灰字 -->
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Padding" Value="25,12"/>
|
||||
<!-- 撑大点击区域 -->
|
||||
<Setter Property="Margin" Value="0,0,4,0"/>
|
||||
<!-- 标签之间的间距 -->
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
|
||||
<!-- 核心魔法:重写外观结构 -->
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="TabItem">
|
||||
<!-- 用一个带底部边框的 Border 包装文字 -->
|
||||
<Border Name="Border"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="Transparent"
|
||||
BorderThickness="0,0,0,3"
|
||||
CornerRadius="4,4,0,0">
|
||||
<ContentPresenter x:Name="ContentSite"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
ContentSource="Header"
|
||||
Margin="{TemplateBinding Padding}"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<!-- 交互状态1:鼠标悬浮 -->
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="#E6E6E6"/>
|
||||
<Setter Property="Foreground" Value="#595959"/>
|
||||
</Trigger>
|
||||
|
||||
<!-- 交互状态2:被选中 -->
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="White"/>
|
||||
<!-- 选中时的底部指示条颜色(蓝色) -->
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="#007ACC"/>
|
||||
<!-- 选中时的字体颜色(蓝色) -->
|
||||
<Setter Property="Foreground" Value="#007ACC"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
<!-- 单元 1:TestCell1,默认 (0,0) -->
|
||||
<ContentControl prism:RegionManager.RegionName="TestCell1" Margin="2">
|
||||
<ContentControl.Style>
|
||||
<Style TargetType="ContentControl">
|
||||
<Setter Property="Grid.Row" Value="0"/>
|
||||
<Setter Property="Grid.Column" Value="0"/>
|
||||
<Setter Property="Grid.RowSpan" Value="1"/>
|
||||
<Setter Property="Grid.ColumnSpan" Value="1"/>
|
||||
<Style.Triggers>
|
||||
<!-- !!!这是你原有的全屏隐藏逻辑!完美保留!!! -->
|
||||
<DataTrigger Binding="{Binding ExpandedCellName, Converter={StaticResource StringToVisibilityConverter}}" Value="Visible">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding ExpandedCellName}" Value="TestCell1">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
<Setter Property="Grid.Row" Value="0"/>
|
||||
<Setter Property="Grid.Column" Value="0"/>
|
||||
<Setter Property="Grid.RowSpan" Value="3"/>
|
||||
<Setter Property="Grid.ColumnSpan" Value="3"/>
|
||||
<Setter Property="Panel.ZIndex" Value="99"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ContentControl.Style>
|
||||
</ContentControl>
|
||||
</TabControl.Resources>
|
||||
|
||||
<!-- 单元 2:TestCell2,默认 (0,1) -->
|
||||
<ContentControl prism:RegionManager.RegionName="TestCell2" Margin="2">
|
||||
<ContentControl.Style>
|
||||
<Style TargetType="ContentControl">
|
||||
<Setter Property="Grid.Row" Value="0"/>
|
||||
<Setter Property="Grid.Column" Value="1"/>
|
||||
<Setter Property="Grid.RowSpan" Value="1"/>
|
||||
<Setter Property="Grid.ColumnSpan" Value="1"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ExpandedCellName, Converter={StaticResource StringToVisibilityConverter}}" Value="Visible">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding ExpandedCellName}" Value="TestCell2">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
<Setter Property="Grid.Row" Value="0"/>
|
||||
<Setter Property="Grid.Column" Value="0"/>
|
||||
<Setter Property="Grid.RowSpan" Value="3"/>
|
||||
<Setter Property="Grid.ColumnSpan" Value="3"/>
|
||||
<Setter Property="Panel.ZIndex" Value="99"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ContentControl.Style>
|
||||
</ContentControl>
|
||||
<!-- 标签页 1 -->
|
||||
<TabItem Header="台架 1 (Bench 1)">
|
||||
<!-- 加一个白底包裹,显得更像现代卡片 -->
|
||||
<Border Background="White" CornerRadius="0,4,4,4" Margin="0" BorderThickness="0" Padding="5">
|
||||
<ContentControl prism:RegionManager.RegionName="TestCell1" />
|
||||
</Border>
|
||||
</TabItem>
|
||||
|
||||
<!-- 单元 3:TestCell3,默认 (0,2) -->
|
||||
<ContentControl prism:RegionManager.RegionName="TestCell3" Margin="2">
|
||||
<ContentControl.Style>
|
||||
<Style TargetType="ContentControl">
|
||||
<Setter Property="Grid.Row" Value="0"/>
|
||||
<Setter Property="Grid.Column" Value="2"/>
|
||||
<Setter Property="Grid.RowSpan" Value="1"/>
|
||||
<Setter Property="Grid.ColumnSpan" Value="1"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ExpandedCellName, Converter={StaticResource StringToVisibilityConverter}}" Value="Visible">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding ExpandedCellName}" Value="TestCell3">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
<Setter Property="Grid.Row" Value="0"/>
|
||||
<Setter Property="Grid.Column" Value="0"/>
|
||||
<Setter Property="Grid.RowSpan" Value="3"/>
|
||||
<Setter Property="Grid.ColumnSpan" Value="3"/>
|
||||
<Setter Property="Panel.ZIndex" Value="99"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ContentControl.Style>
|
||||
</ContentControl>
|
||||
<!-- 标签页 2 -->
|
||||
<TabItem Header="台架 2 (Bench 2)">
|
||||
<Border Background="White" CornerRadius="0,4,4,4" Margin="0" BorderThickness="0" Padding="5">
|
||||
<ContentControl prism:RegionManager.RegionName="TestCell2" />
|
||||
</Border>
|
||||
</TabItem>
|
||||
|
||||
<!-- 单元 4:TestCell4,默认 (1,0) -->
|
||||
<ContentControl prism:RegionManager.RegionName="TestCell4" Margin="2">
|
||||
<ContentControl.Style>
|
||||
<Style TargetType="ContentControl">
|
||||
<Setter Property="Grid.Row" Value="1"/>
|
||||
<Setter Property="Grid.Column" Value="0"/>
|
||||
<Setter Property="Grid.RowSpan" Value="1"/>
|
||||
<Setter Property="Grid.ColumnSpan" Value="1"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ExpandedCellName, Converter={StaticResource StringToVisibilityConverter}}" Value="Visible">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding ExpandedCellName}" Value="TestCell4">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
<Setter Property="Grid.Row" Value="0"/>
|
||||
<Setter Property="Grid.Column" Value="0"/>
|
||||
<Setter Property="Grid.RowSpan" Value="3"/>
|
||||
<Setter Property="Grid.ColumnSpan" Value="3"/>
|
||||
<Setter Property="Panel.ZIndex" Value="99"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ContentControl.Style>
|
||||
</ContentControl>
|
||||
<!-- 标签页 3 -->
|
||||
<TabItem Header="台架 3 (Bench 3)">
|
||||
<Border Background="White" CornerRadius="0,4,4,4" Margin="0" BorderThickness="0" Padding="5">
|
||||
<ContentControl prism:RegionManager.RegionName="TestCell3" />
|
||||
</Border>
|
||||
</TabItem>
|
||||
|
||||
<!-- 单元 5:TestCell5,默认 (1,1) -->
|
||||
<ContentControl prism:RegionManager.RegionName="TestCell5" Margin="2">
|
||||
<ContentControl.Style>
|
||||
<Style TargetType="ContentControl">
|
||||
<Setter Property="Grid.Row" Value="1"/>
|
||||
<Setter Property="Grid.Column" Value="1"/>
|
||||
<Setter Property="Grid.RowSpan" Value="1"/>
|
||||
<Setter Property="Grid.ColumnSpan" Value="1"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ExpandedCellName, Converter={StaticResource StringToVisibilityConverter}}" Value="Visible">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding ExpandedCellName}" Value="TestCell5">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
<Setter Property="Grid.Row" Value="0"/>
|
||||
<Setter Property="Grid.Column" Value="0"/>
|
||||
<Setter Property="Grid.RowSpan" Value="3"/>
|
||||
<Setter Property="Grid.ColumnSpan" Value="3"/>
|
||||
<Setter Property="Panel.ZIndex" Value="99"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ContentControl.Style>
|
||||
</ContentControl>
|
||||
|
||||
<!-- 单元 6:TestCell6,默认 (1,2) -->
|
||||
<ContentControl prism:RegionManager.RegionName="TestCell6" Margin="2">
|
||||
<ContentControl.Style>
|
||||
<Style TargetType="ContentControl">
|
||||
<Setter Property="Grid.Row" Value="1"/>
|
||||
<Setter Property="Grid.Column" Value="2"/>
|
||||
<Setter Property="Grid.RowSpan" Value="1"/>
|
||||
<Setter Property="Grid.ColumnSpan" Value="1"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ExpandedCellName, Converter={StaticResource StringToVisibilityConverter}}" Value="Visible">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding ExpandedCellName}" Value="TestCell6">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
<Setter Property="Grid.Row" Value="0"/>
|
||||
<Setter Property="Grid.Column" Value="0"/>
|
||||
<Setter Property="Grid.RowSpan" Value="3"/>
|
||||
<Setter Property="Grid.ColumnSpan" Value="3"/>
|
||||
<Setter Property="Panel.ZIndex" Value="99"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ContentControl.Style>
|
||||
</ContentControl>
|
||||
|
||||
<!-- 单元 7:TestCell7,默认 (2,0) -->
|
||||
<ContentControl prism:RegionManager.RegionName="TestCell7" Margin="2">
|
||||
<ContentControl.Style>
|
||||
<Style TargetType="ContentControl">
|
||||
<Setter Property="Grid.Row" Value="2"/>
|
||||
<Setter Property="Grid.Column" Value="0"/>
|
||||
<Setter Property="Grid.RowSpan" Value="1"/>
|
||||
<Setter Property="Grid.ColumnSpan" Value="1"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ExpandedCellName, Converter={StaticResource StringToVisibilityConverter}}" Value="Visible">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding ExpandedCellName}" Value="TestCell7">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
<Setter Property="Grid.Row" Value="0"/>
|
||||
<Setter Property="Grid.Column" Value="0"/>
|
||||
<Setter Property="Grid.RowSpan" Value="3"/>
|
||||
<Setter Property="Grid.ColumnSpan" Value="3"/>
|
||||
<Setter Property="Panel.ZIndex" Value="99"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ContentControl.Style>
|
||||
</ContentControl>
|
||||
|
||||
<!-- 单元 8:TestCell8,默认 (2,1) -->
|
||||
<ContentControl prism:RegionManager.RegionName="TestCell8" Margin="2">
|
||||
<ContentControl.Style>
|
||||
<Style TargetType="ContentControl">
|
||||
<Setter Property="Grid.Row" Value="2"/>
|
||||
<Setter Property="Grid.Column" Value="1"/>
|
||||
<Setter Property="Grid.RowSpan" Value="1"/>
|
||||
<Setter Property="Grid.ColumnSpan" Value="1"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ExpandedCellName, Converter={StaticResource StringToVisibilityConverter}}" Value="Visible">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding ExpandedCellName}" Value="TestCell8">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
<Setter Property="Grid.Row" Value="0"/>
|
||||
<Setter Property="Grid.Column" Value="0"/>
|
||||
<Setter Property="Grid.RowSpan" Value="3"/>
|
||||
<Setter Property="Grid.ColumnSpan" Value="3"/>
|
||||
<Setter Property="Panel.ZIndex" Value="99"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ContentControl.Style>
|
||||
</ContentControl>
|
||||
|
||||
<!-- 单元 9:TestCell9,默认 (2,2) -->
|
||||
<!--<ContentControl prism:RegionManager.RegionName="TestCell9" Margin="2">
|
||||
<ContentControl.Style>
|
||||
<Style TargetType="ContentControl">
|
||||
<Setter Property="Grid.Row" Value="2"/>
|
||||
<Setter Property="Grid.Column" Value="2"/>
|
||||
<Setter Property="Grid.RowSpan" Value="1"/>
|
||||
<Setter Property="Grid.ColumnSpan" Value="1"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ExpandedCellName, Converter={StaticResource StringToVisibilityConverter}}" Value="Visible">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding ExpandedCellName}" Value="TestCell9">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
<Setter Property="Grid.Row" Value="0"/>
|
||||
<Setter Property="Grid.Column" Value="0"/>
|
||||
<Setter Property="Grid.RowSpan" Value="3"/>
|
||||
<Setter Property="Grid.ColumnSpan" Value="3"/>
|
||||
<Setter Property="Panel.ZIndex" Value="99"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ContentControl.Style>
|
||||
</ContentControl>-->
|
||||
</TabControl>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
Reference in New Issue
Block a user