C00225155-02/C00225155/MegaRobo.C00225155/MegaRobo.C00225155App/MainWindow.xaml

444 lines
25 KiB
Plaintext
Raw Normal View History

2026-04-13 09:12:49 +00:00
<telerik:RadWindow
x:Class="MegaRobo.C00225155App.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:animation="clr-namespace:Telerik.Windows.Controls.Animation;assembly=Telerik.Windows.Controls"
xmlns:auth="clr-namespace:MegaRobo.Authentication;assembly=MegaRobo.Authentication"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:local="clr-namespace:MegaRobo.C00225155App"
xmlns:mat="clr-namespace:Telerik.Windows.Controls.MaterialControls;assembly=Telerik.Windows.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mega="clr-namespace:MegaRobo.WpfComponents.MegaControls;assembly=MegaRobo.WpfComponents"
xmlns:navi="clr-namespace:Telerik.Windows.Controls.Navigation;assembly=Telerik.Windows.Controls.Navigation"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:sys="clr-namespace:System;assembly=System.Runtime"
x:Name="OnwerApp"
Width="1500"
Height="920"
MinWidth="1220"
MinHeight="860"
animation:AnimationManager.IsAnimationEnabled="True"
mat:MaterialAssist.ShadowDepth="Depth2"
mat:ThemeEffectsHelper.IsAcrylic="False"
navi:RadWindowInteropHelper.AllowTransparency="True"
navi:RadWindowInteropHelper.ClipMaskCornerRadius="0"
navi:RadWindowInteropHelper.ShowInTaskbar="True"
navi:RadWindowInteropHelper.Title="苏州镁伽科技有限公司"
telerik:StyleManager.Theme="Office2019"
BorderBrush="{DynamicResource BorderColor}"
DataContext="{Binding MainWindowVM, Source={StaticResource vmLocator}}"
Background="White"
FontFamily="Microsoft YaHei"
Loaded="MainWindow_OnLoaded"
Opacity="0.975"
BorderThickness="0"
WindowStartupLocation="CenterScreen"
WindowState="Maximized"
mc:Ignorable="d">
<telerik:RadWindow.Resources>
<ResourceDictionary>
<ImageBrush x:Key="CompanyImageBrush" ImageSource="./DataBox/CompanyLogo.png"/>
<Style x:Key="ItemBaseStyle" TargetType="telerik:RadNavigationViewItem">
<Setter Property="Margin" Value="0,5,0,5"/>
<Setter Property="Content" Value="{Binding Header}" />
<Setter Property="ItemsSource" Value="{Binding SubItems}" />
<Setter Property="Icon" Value="{Binding IconKind}" />
<Setter Property="IsEnabled" Value="{Binding IsEnabled}"/>
<Setter Property="IconVisibility" Value="{Binding IconKind, Converter={StaticResource NullToVisibilityConverter}}" />
<!-- 图标模板自定义图标显示使用MahApps的Material图标 -->
<Setter Property="IconTemplate">
<Setter.Value>
<DataTemplate>
<iconPacks:PackIconMaterial
HorizontalAlignment="Center" VerticalAlignment="Center" Width="22" Height="22"
Kind="{Binding}" />
<!-- 图标类型绑定IconKind继承自上级Icon属性 -->
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
<Style
x:Key="NavigationViewItemStyle"
BasedOn="{StaticResource ItemBaseStyle}"
TargetType="telerik:RadNavigationViewItem">
<Setter Property="ItemContainerStyle" Value="{StaticResource ItemBaseStyle}" />
</Style>
<!-- 数值资源:统一管理尺寸(方便批量修改) -->
<sys:Double x:Key="IconHeight" >40</sys:Double>
<sys:Double x:Key="IconWidth" >22</sys:Double>
<!-- 菜单颜色资源:不同状态的颜色(统一视觉风格) -->
<SolidColorBrush x:Key="MenuNotSelect" Color="#f0f0f0"/>
<!-- 未选中状态:浅灰色 -->
<SolidColorBrush x:Key="MenuMouseOver" Color="#c8cfcd"/>
<!-- 鼠标悬浮:中灰色 -->
<SolidColorBrush x:Key="MenuSelected" Color="White"/>
<!-- 选中状态:白色(对比深色背景) -->
<SolidColorBrush x:Key="MenuUnEnable" Color="#FFAAA5A5"/>
<!-- 禁用状态:深灰色 -->
<sys:Double x:Key="MenuMixWidth" >40</sys:Double>
<sys:Double x:Key="MenuMaxWidth" >130</sys:Double>
<!--镁伽色-->
<SolidColorBrush x:Key="MegaRoboColor" Color="#FFDC5A2D"/>
<sys:Double x:Key="MaxFontSize">18</sys:Double>
</ResourceDictionary>
</telerik:RadWindow.Resources>
<telerik:RadWindow.Header>
<Grid>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<Label HorizontalContentAlignment="Center" Content="高通量反应合成" FontSize="26" FontWeight="DemiBold" Foreground="White"/>
</StackPanel>
<Border x:Name="NavigationRightMenu" Margin="0,0,100,0" HorizontalAlignment="Right" >
<auth:MegaAuth />
</Border>
</Grid>
</telerik:RadWindow.Header>
<!--一种风格 Background="#1A70B6"-->
<!--<DockPanel >
<Grid Width="{StaticResource MenuMixWidth}" x:Name="DockPanelMenu" DockPanel.Dock="Left" Margin="10" >
<DockPanel >
<StackPanel DockPanel.Dock="Top">
-->
<!--<StackPanel Orientation="Horizontal">
<Label Content="MEGAROBO" Foreground="{StaticResource MegaRoboColor}" FontSize="{StaticResource MaxFontSize}" VerticalContentAlignment="Center" />
-->
<!--<Label Content="(CMBU)" Foreground="{StaticResource MenuNotSelect}" FontSize="13" VerticalContentAlignment="Center" />-->
<!--
</StackPanel>-->
<!--
<StackPanel Orientation="Horizontal" DockPanel.Dock="Left" >
<Border Margin="0 0" Height="{StaticResource IconHeight}" Width="43" >
<Path Fill="{StaticResource MegaRoboColor}" Width="24" Height="24" Margin="0"
Data="M 0.0,0.0 0.0,22.8 2.6,20.3 2.6,5.3 5.0,7.4 5.0,18.3 7.8,15.8 7.8,9.7 11.3,12.8 14.9,9.7 14.9,15.8 22.5,22.8 22.8,0.3 20.0,2.9 20.0,17.2 17.5,15.1 17.5,4.7 11.3,9.7 0.0,0.0 Z" />
</Border>
<Label Content="镁伽科技" Foreground="{StaticResource MegaRoboColor}" FontSize="{StaticResource MaxFontSize}" VerticalContentAlignment="Center" Padding="2"/>
</StackPanel>
</StackPanel>
-->
<!-- 底部控制区:菜单展开/折叠开关 -->
<!--
<CheckBox DockPanel.Dock="Bottom" x:Name="RadButtonMenuStatus">
-->
<!-- 自定义CheckBox模板 -->
<!--
<CheckBox.Template>
<ControlTemplate TargetType="{x:Type CheckBox}">
<Border Background="Transparent">
<iconPacks:PackIconMaterial x:Name="RadButtonIcon" Kind="FormatIndentIncrease" Height="{StaticResource IconHeight}"
Width="{StaticResource IconWidth}" VerticalAlignment="Center" Margin="7 0" Foreground="{StaticResource MenuNotSelect}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="RadButtonIcon" Property="Kind" Value="FormatIndentDecrease"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Foreground" Value="{StaticResource MenuMouseOver}" TargetName="RadButtonIcon" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</CheckBox.Template>
</CheckBox>
-->
<!-- 底部控制区:退出按钮 -->
<!--
<Button Click="RadButton_Click" DockPanel.Dock="Bottom" Margin="0 10 0 20">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border Background="Transparent">
<Border HorizontalAlignment="Left" VerticalAlignment="Center" Margin="7 0">
<iconPacks:PackIconMaterial Kind="Power" Width="20" Height="20" x:Name="RadButtonIcon" Foreground="{StaticResource MenuNotSelect}" />
</Border>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Cursor" Value="Hand"></Setter>
<Setter Property="Foreground" Value="{StaticResource MenuMouseOver}" TargetName="RadButtonIcon" ></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
-->
<!-- 底部控制区:未知功能按钮(暂为横线图标) -->
<!--<Button Click="RadButtonMix_Click" DockPanel.Dock="Bottom" Margin="0 0 0 10">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border Background="Transparent">
<Border HorizontalAlignment="Left" VerticalAlignment="Center" Margin="2 0">
<Border x:Name="RadButtonIcon" Width="20" Height="2" Background="{StaticResource MenuNotSelect}" Margin="0 12 0 0" />
</Border>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Cursor" Value="Hand"></Setter>
<Setter Property="Background" Value="{StaticResource MenuMouseOver}" TargetName="RadButtonIcon" ></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>-->
<!-- 中间菜单列表ListBox绑定ViewModel菜单数据 -->
<!--
<ListBox ItemsSource="{Binding NavigationMenuList,Mode=OneWay}" SelectedItem="{Binding SelectedMenu,Mode=TwoWay}"
BorderThickness="0" Margin="0 20" x:Name="naviMenu"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
-->
<!-- 事件转命令MVVM模式下将ListBox的SelectionChanged事件绑定到ViewModel命令 -->
<!--
<telerik:EventToCommandBehavior.EventBindings>
<telerik:EventBinding Command="{Binding SelectedMenuCommand}" PassEventArgsToCommand="True" RaiseOnHandledEvents="True" EventName="SelectionChanged" />
</telerik:EventToCommandBehavior.EventBindings>
-->
<!-- 自定义ListBox样式去掉默认边框和背景 -->
<!--
<ListBox.Style>
<Style TargetType="{x:Type ListBox}" >
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="0">
<ScrollViewer Focusable="False">
<ItemsPresenter />
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.Style>
-->
<!-- 自定义ListBoxItem样式菜单项的视觉状态 -->
<!--
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="IsEnabled" Value="{Binding IsEnabled}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
-->
<!-- 菜单项容器:圆角边框,默认透明 -->
<!--
<Border x:Name="ItemBorder" CornerRadius="10" Background="Transparent" BorderThickness="2" ToolTip="{Binding Descr}" >
<DockPanel>
<iconPacks:PackIconMaterial x:Name="RadButtonIcon" DockPanel.Dock="Left" Kind="{Binding IconKind}"
Height="{StaticResource IconHeight}"
Width="{StaticResource IconWidth}" VerticalAlignment="Center" Margin="7 0 0 0"
Foreground="{StaticResource MenuNotSelect}"/>
<Label x:Name="LabContent" Content="{Binding Header}" Foreground="{StaticResource MenuNotSelect}"
FontSize="{StaticResource MaxFontSize}" VerticalContentAlignment="Center" Padding="15 0 10 0"/>
</DockPanel>
</Border>
-->
<!-- 菜单项状态触发器 -->
<!--
<ControlTemplate.Triggers>
-->
<!-- 选中状态:背景变品牌橙,文本/图标变白色 -->
<!--
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="{StaticResource MegaRoboColor}" TargetName="ItemBorder"/>
<Setter Property="Foreground" Value="{StaticResource MenuSelected}" TargetName="LabContent" />
<Setter Property="Foreground" Value="{StaticResource MenuSelected}" TargetName="RadButtonIcon" />
</Trigger>
-->
<!-- 禁用状态:文本/图标变白色(设计需求) -->
<!--
<DataTrigger Binding="{Binding IsEnabled}" Value="False">
<Setter Property="Foreground" Value="{StaticResource MenuUnEnable}" TargetName="LabContent" />
<Setter Property="Foreground" Value="{StaticResource MenuUnEnable}" TargetName="RadButtonIcon" />
</DataTrigger>
-->
<!-- 鼠标悬浮+未选中:文本/图标变中灰,光标变手型 -->
<!--
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True"/>
<Condition Property="IsSelected" Value="False"/>
</MultiTrigger.Conditions>
<Setter Property="Cursor" Value="Hand"></Setter>
<Setter Property="Foreground" Value="{StaticResource MenuMouseOver}" TargetName="LabContent" />
<Setter Property="Foreground" Value="{StaticResource MenuMouseOver}" TargetName="RadButtonIcon" />
</MultiTrigger>
-->
<!-- 鼠标悬浮+已选中:仅光标变手型(颜色已为白色,无需修改) -->
<!--
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True"/>
<Condition Property="IsSelected" Value="True"/>
</MultiTrigger.Conditions>
<Setter Property="Cursor" Value="Hand"/>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
</DockPanel>
-->
<!-- 菜单伸缩动画触发器控制左侧Grid的宽度变化 -->
<!--
<Grid.Triggers>
-->
<!-- 开关未选中折叠菜单宽度动画到40MenuMixWidth时长0.3秒 -->
<!--
<EventTrigger SourceName="RadButtonMenuStatus" RoutedEvent="CheckBox.Unchecked">
<BeginStoryboard>
<Storyboard >
<DoubleAnimation Storyboard.TargetName="DockPanelMenu" Storyboard.TargetProperty="Width"
To="{StaticResource MenuMixWidth}" Duration="0:0:0.2"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
-->
<!-- 开关选中展开菜单宽度动画到MenuMaxWidth时长0.3秒 -->
<!--
<EventTrigger SourceName="RadButtonMenuStatus" RoutedEvent="CheckBox.Checked">
<BeginStoryboard>
<Storyboard >
<DoubleAnimation Storyboard.TargetName="DockPanelMenu" Storyboard.TargetProperty="Width"
To="{StaticResource MenuMaxWidth}" Duration="0:0:0.2"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Grid.Triggers>
</Grid>
-->
<!-- 右侧主内容区域:页面切换容器 -->
<!--
<Grid>
<Border CornerRadius="10 0 0 10" Background="White" Padding="5" BorderThickness="0 0 0 0" BorderBrush="Black">
-->
<!--阴影会导致 动画卡顿 取消-->
<!--
<telerik:RadTransitionControl x:Name="viewContainer">
<telerik:RadTransitionControl.Transition>
<telerik:SlideAndZoomTransition x:Name="slideAndZoomTransition"/>
</telerik:RadTransitionControl.Transition>
</telerik:RadTransitionControl>
</Border>
</Grid>
</DockPanel>-->
<!--第二种风格-->
<mega:MegaGrid Rows="*">
<Grid Background="Transparent">
<Grid x:Name="rootPanel">
<Grid x:Name="mainPanel">
<Border BorderThickness="0,0">
<telerik:RadNavigationView
x:Name="naviMenu"
AllowMultipleExpandedItems="False"
BorderThickness="1"
ExpandedPaneWidth="135"
FontFamily="Microsoft YaHei"
FontSize="16"
ItemContainerStyle="{StaticResource NavigationViewItemStyle}"
ItemsSource="{Binding NavigationMenuList, Mode=OneWay}"
SelectedItem="{Binding SelectedMenu, Mode=TwoWay}"
SubItemsIndentation="18">
<telerik:RadNavigationView.Content>
<Border BorderThickness="1,0,0,0">
<telerik:RadTransitionControl x:Name="viewContainer" >
<telerik:RadTransitionControl.Transition>
<telerik:SlideAndZoomTransition x:Name="slideAndZoomTransition" />
</telerik:RadTransitionControl.Transition>
</telerik:RadTransitionControl>
</Border>
</telerik:RadNavigationView.Content>
<telerik:RadNavigationView.PaneFooter>
<StackPanel>
<telerik:RadNavigationViewItem Content="关于" FontSize="18">
<telerik:RadNavigationViewItem.Icon>
<Border
Margin="3,0"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<iconPacks:Material
Width="22"
Height="22"
Kind="InformationOutline" />
</Border>
</telerik:RadNavigationViewItem.Icon>
</telerik:RadNavigationViewItem>
<telerik:RadNavigationViewItem
Padding="0"
Content="镁伽技术支持"
FontSize="15"
ToolTip="技术支持单位">
<telerik:RadNavigationViewItem.Icon>
<Border
Margin="0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Path
Width="24"
Height="24"
Margin="5,0"
Data="M 0.0,0.0 0.0,22.8 2.6,20.3 2.6,5.3 5.0,7.4 5.0,18.3 7.8,15.8 7.8,9.7 11.3,12.8 14.9,9.7 14.9,15.8 22.5,22.8 22.8,0.3 20.0,2.9 20.0,17.2 17.5,15.1 17.5,4.7 11.3,9.7 0.0,0.0 Z"
Fill="Orange" />
</Border>
</telerik:RadNavigationViewItem.Icon>
</telerik:RadNavigationViewItem>
</StackPanel>
</telerik:RadNavigationView.PaneFooter>
<telerik:EventToCommandBehavior.EventBindings>
<telerik:EventBinding Command="{Binding SelectedMenuCommand}" EventName="SelectionChanged" />
</telerik:EventToCommandBehavior.EventBindings>
</telerik:RadNavigationView>
</Border>
</Grid>
<!--<Border Grid.Row="1" BorderBrush="{StaticResource AccentColorBrush50}" BorderThickness="0">
</Border>
<Border
Grid.Row="1"
Background="White"
BorderBrush="#9feeeeee"
BorderThickness="0,1,0,1">
<mega:MegaLogger x:Name="MegaLogger" />
<StackPanel Orientation="Horizontal">
</StackPanel>
</Border>-->
</Grid>
</Grid>
</mega:MegaGrid>
</telerik:RadWindow>