Compare commits

..

2 Commits

Author SHA1 Message Date
陈伟 8efa833c6e 1. logo 替换
2. 启动动画修改
2025-04-11 16:11:55 +08:00
陈伟 d9df3bc28c 1. 界面修改
2. tab item标题显示错误
2025-04-10 16:51:35 +08:00
10 changed files with 611 additions and 117 deletions

578
App.xaml
View File

@ -8,6 +8,582 @@
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries />
<provider:ViewModelLocator x:Key="S.ViewModelLocator.Locator" />
<Style
x:Key="{ComponentResourceKey ResourceId=S.Window.Link.Custom, TypeInTargetAssembly={x:Type h:LinkWindowBase}}"
BasedOn="{StaticResource {x:Static h:MessageWindowBase.DynamicKey}}"
TargetType="{x:Type h:LinkWindowBase}">
<Setter Property="BorderThickness" Value="2" />
<Setter Property="CaptionHeight" Value="76" />
<Setter Property="CaptionForeground" Value="{DynamicResource {x:Static h:BrushKeys.ForegroundDefault}}" />
<Setter Property="CaptionBackground" Value="{DynamicResource {x:Static h:BrushKeys.Dark0_2}}" />
<Setter Property="h:TransitionService.VisibleActions">
<Setter.Value>
<h:TransitionCollection>
<h:ImageOpacityMaskTransition HideDuration="1000"
ImageSource="pack://application:,,,/Assets/logo.png"
VisibleDuration="1500" />
</h:TransitionCollection>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type h:LinkWindowBase}">
<Grid Name="g_all">
<Border x:Name="Bg"
Margin="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding h:Cattach.CornerRadius}"
Effect="{DynamicResource {x:Static h:EffectShadowKeys.Window}}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<h:GuideHost Margin="{TemplateBinding Padding}"
IsGuide="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(h:Cattach.IsGuide)}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" MinHeight="20" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Border Grid.Row="0"
Height="{TemplateBinding CaptionHeight}"
Margin="0"
Background="{TemplateBinding CaptionBackground}"
CornerRadius="{DynamicResource {x:Static h:CornerRadiusKeys.Top}}">
<DockPanel Margin="0">
<Grid x:Name="PART_Header"
Width="120"
Height="30"
Margin="20,1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="{DynamicResource {x:Static h:BrushKeys.Accent}}"
DockPanel.Dock="Left">
<Grid.OpacityMask>
<ImageBrush
ImageSource="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Logo}" />
</Grid.OpacityMask>
</Grid>
<Control Background="{TemplateBinding CaptionBackground}"
DockPanel.Dock="Left"
Foreground="{TemplateBinding CaptionForeground}"
Template="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(h:Cattach.CaptionLeftTemplate)}"
WindowChrome.IsHitTestVisibleInChrome="True" />
<ListBox x:Name="list"
Margin="0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
DockPanel.Dock="Left"
Foreground="{TemplateBinding CaptionForeground}"
ItemsSource="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Links}"
SelectedIndex="0"
SelectedItem="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=CurrentLink}">
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type h:ILinkAction}">
<Grid>
<StackPanel HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal"
WindowChrome.IsHitTestVisibleInChrome="True">
<TextBlock x:Name="tb_logo"
Margin="0,0,0,10"
Style="{DynamicResource {x:Static h:TextBlockKeys.Icon}}"
Text="{Binding Logo}" />
<TextBlock VerticalAlignment="Center"
Foreground="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem}, Path=Foreground}"
Text="{Binding DisplayName}" />
</StackPanel>
</Grid>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Logo}" Value="{x:Null}">
<Setter TargetName="tb_logo" Property="Visibility"
Value="Collapsed" />
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel HorizontalAlignment="Left"
Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="FontSize"
Value="{DynamicResource {x:Static h:FontSizeKeys.Header}}" />
<Setter Property="Foreground"
Value="{Binding RelativeSource={RelativeSource AncestorType=h:LinkWindowBase}, Path=CaptionForeground}" />
<Setter Property="Padding" Value="20,0,0,0" />
<Setter Property="Height" Value="45" />
<Setter Property="h:Cattach.GuideData" Value="跳转到指定功能页面" />
<Setter Property="h:Cattach.GuideTitle"
Value="{Binding DisplayName}" />
<Setter Property="h:Cattach.UseGuide" Value="True" />
<Setter Property="h:Cattach.GuideUseClick" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Grid Height="{TemplateBinding Height}"
Margin="{TemplateBinding Padding}"
VerticalAlignment="Center">
<Border x:Name="underline"
BorderBrush="{TemplateBinding Foreground}"
BorderThickness="0,0,0,1.5" />
<ContentPresenter Margin="15,0"
HorizontalAlignment="Left"
VerticalAlignment="{TemplateBinding VerticalAlignment}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected"
Value="false">
<Setter TargetName="underline"
Property="BorderThickness"
Value="0,0,0,0" />
</Trigger>
<Trigger Property="IsMouseOver"
Value="true">
<Setter TargetName="underline"
Property="BorderThickness"
Value="0,0,0,0" />
<Setter Property="Opacity" Value="0.8" />
<Setter Property="Cursor" Value="Hand" />
</Trigger>
<Trigger Property="IsSelected" Value="true">
<Setter TargetName="underline"
Property="BorderThickness"
Value="0,0,0,1.5" />
<Setter Property="Foreground"
Value="{DynamicResource {x:Static h:BrushKeys.Accent}}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
<StackPanel Margin="0,0,10,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
DockPanel.Dock="Right"
Orientation="Horizontal"
WindowChrome.IsHitTestVisibleInChrome="True">
<ItemsControl
Foreground="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=CaptionForeground}"
Style="{DynamicResource {x:Static h:MvpKeys.WindowCaption}}" />
<Separator Height="20"
Background="{Binding RelativeSource={RelativeSource AncestorType=h:MessageWindowBase}, Path=CaptionForeground}"
Style="{DynamicResource {x:Static h:SeparatorKeys.Vertical}}" />
<Button
Style="{DynamicResource {x:Static h:ButtonKeys.MinimizeWindow}}" />
<Button x:Name="btnMax"
Style="{DynamicResource {x:Static h:ButtonKeys.MaximizeWindow}}" />
<Button
Style="{DynamicResource {x:Static h:ButtonKeys.CloseWindow}}" />
</StackPanel>
<Control Background="{TemplateBinding CaptionBackground}"
DockPanel.Dock="Right"
Foreground="{TemplateBinding CaptionForeground}"
Template="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(h:Cattach.CaptionRightTemplate)}"
WindowChrome.IsHitTestVisibleInChrome="True" />
<Control Background="{TemplateBinding CaptionBackground}"
Foreground="{TemplateBinding CaptionForeground}"
Template="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(h:Cattach.CaptionCenterTemplate)}"
WindowChrome.IsHitTestVisibleInChrome="True" />
</DockPanel>
</Border>
<Border x:Name="BgInner"
Grid.Row="1"
Margin="0"
Background="{TemplateBinding Background}"
CornerRadius="{DynamicResource {x:Static h:CornerRadiusKeys.Bottom}}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
<AdornerDecorator WindowChrome.IsHitTestVisibleInChrome="True">
<Grid>
<h:NotifyIcon x:Name="PART_NotifyIcon"
Command="{Binding Path=MinimizeWindowCommand, RelativeSource={RelativeSource TemplatedParent}}"
Icon="{Binding Path=NotifyIconSource, RelativeSource={RelativeSource TemplatedParent}}"
IconVisibility="Visible"
Text="{TemplateBinding Title}">
<FrameworkElement.ContextMenu>
<ContextMenu>
<MenuItem
Command="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=NotifyWindowCommand}"
CommandTarget="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}}"
Header="显示面板" />
<MenuItem
Command="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=NotifyWindowCommand}"
CommandTarget="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}}"
Header="隐藏" />
<MenuItem
Command="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=CloseWindowCommand}"
CommandTarget="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}}"
Header="退出" />
</ContextMenu>
</FrameworkElement.ContextMenu>
</h:NotifyIcon>
<Grid>
<h:DialogHost Margin="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Effect="{TemplateBinding AdornerDecoratorEffect}"
Identifier="windowDialog">
<Grid>
<DockPanel>
<Control DockPanel.Dock="Left"
Template="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(h:Cattach.LeftTemplate)}" />
<Control DockPanel.Dock="Right"
Template="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(h:Cattach.RightTemplate)}" />
<Control DockPanel.Dock="Bottom"
Template="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(h:Cattach.BottomTemplate)}" />
<Control DockPanel.Dock="Top"
Template="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(h:Cattach.TopTemplate)}" />
<Grid>
<h:LinkActionFrame
LinkAction="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=CurrentLink}"
UseRandomWipe="False" />
<Control
Template="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(h:Cattach.CenterTemplate)}" />
</Grid>
</DockPanel>
<h:ContainPanel x:Name="PART_LAYERGROUP"
Background="{DynamicResource {x:Static h:BrushKeys.DialogCover}}"
ClipToBounds="True"
Visibility="Collapsed">
<h:ContainPanel.AnimationAction>
<h:ScaleTransition />
</h:ContainPanel.AnimationAction>
</h:ContainPanel>
</Grid>
</h:DialogHost>
<h:MessageContainer x:Name="PART_Message" Grid.Row="1" />
<h:Snackbar x:Name="PART_SnackBar"
MessageQueue="{h:MessageQueue}" />
</Grid>
</Grid>
</AdornerDecorator>
</Border>
</Grid>
</h:GuideHost>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="WindowState" Value="Maximized">
<Setter TargetName="btnMax" Property="h:Cattach.Icon" Value="&#xe665;" />
<Setter TargetName="g_all" Property="Margin" Value="0" />
</Trigger>
<Trigger Property="WindowState" Value="Normal">
<Setter TargetName="btnMax" Property="h:Cattach.Icon" Value="&#xe615;" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style
x:Key="{ComponentResourceKey ResourceId=S.Window.Link.Disk, TypeInTargetAssembly={x:Type h:LinkWindowBase}}"
BasedOn="{StaticResource {x:Static h:MessageWindowBase.DynamicKey}}"
TargetType="{x:Type h:LinkWindowBase}">
<Setter Property="BorderThickness" Value="2" />
<Setter Property="CaptionHeight" Value="76" />
<Setter Property="CaptionForeground" Value="{DynamicResource {x:Static h:BrushKeys.ForegroundDefault}}" />
<Setter Property="CaptionBackground" Value="{DynamicResource {x:Static h:BrushKeys.Dark0_2}}" />
<Setter Property="h:TransitionService.VisibleActions">
<Setter.Value>
<h:TransitionCollection>
<h:ImageOpacityMaskTransition HideDuration="1000"
ImageSource="/HeBianGu.General.WpfControlLib;component/Resources/logo.png"
VisibleDuration="1500" />
</h:TransitionCollection>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type h:LinkWindowBase}">
<Grid Name="g_all">
<Border x:Name="Bg"
Margin="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding h:Cattach.CornerRadius}"
Effect="{DynamicResource {x:Static h:EffectShadowKeys.Window}}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<h:GuideHost Margin="{TemplateBinding Padding}"
IsGuide="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(h:Cattach.IsGuide)}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" MinHeight="20" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Border Grid.Row="0"
Height="{TemplateBinding CaptionHeight}"
Margin="0"
Background="{TemplateBinding CaptionBackground}"
CornerRadius="{DynamicResource {x:Static h:CornerRadiusKeys.Top}}">
<DockPanel Margin="0">
<Grid x:Name="PART_Header"
Width="120"
Height="30"
Margin="20,1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="{DynamicResource {x:Static h:BrushKeys.Accent}}"
DockPanel.Dock="Left">
<Grid.OpacityMask>
<ImageBrush
ImageSource="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Logo}" />
</Grid.OpacityMask>
</Grid>
<Control Background="{TemplateBinding CaptionBackground}"
DockPanel.Dock="Left"
Foreground="{TemplateBinding CaptionForeground}"
Template="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(h:Cattach.CaptionLeftTemplate)}"
WindowChrome.IsHitTestVisibleInChrome="True" />
<ListBox x:Name="list"
Margin="0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
DockPanel.Dock="Left"
Foreground="{TemplateBinding CaptionForeground}"
ItemsSource="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Links}"
SelectedIndex="0"
SelectedItem="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=CurrentLink}">
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type h:ILinkAction}">
<Grid>
<StackPanel HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal"
WindowChrome.IsHitTestVisibleInChrome="True">
<TextBlock x:Name="tb_logo"
Margin="0,0,0,10"
Style="{DynamicResource {x:Static h:TextBlockKeys.Icon}}"
Text="{Binding Logo}" />
<TextBlock VerticalAlignment="Center"
Foreground="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem}, Path=Foreground}"
Text="{Binding DisplayName}" />
</StackPanel>
</Grid>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Logo}" Value="{x:Null}">
<Setter TargetName="tb_logo" Property="Visibility"
Value="Collapsed" />
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel HorizontalAlignment="Left"
Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="FontSize"
Value="{DynamicResource {x:Static h:FontSizeKeys.Header}}" />
<Setter Property="Foreground"
Value="{Binding RelativeSource={RelativeSource AncestorType=h:LinkWindowBase}, Path=CaptionForeground}" />
<Setter Property="Padding" Value="20,0,0,0" />
<Setter Property="Height" Value="45" />
<Setter Property="h:Cattach.GuideData" Value="跳转到指定功能页面" />
<Setter Property="h:Cattach.GuideTitle"
Value="{Binding DisplayName}" />
<Setter Property="h:Cattach.UseGuide" Value="True" />
<Setter Property="h:Cattach.GuideUseClick" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Grid Height="{TemplateBinding Height}"
Margin="{TemplateBinding Padding}"
VerticalAlignment="Center">
<Border x:Name="underline"
BorderBrush="{TemplateBinding Foreground}"
BorderThickness="0,0,0,1.5" />
<ContentPresenter Margin="15,0"
HorizontalAlignment="Left"
VerticalAlignment="{TemplateBinding VerticalAlignment}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected"
Value="false">
<Setter TargetName="underline"
Property="BorderThickness"
Value="0,0,0,0" />
</Trigger>
<Trigger Property="IsMouseOver"
Value="true">
<Setter TargetName="underline"
Property="BorderThickness"
Value="0,0,0,0" />
<Setter Property="Opacity" Value="0.8" />
<Setter Property="Cursor" Value="Hand" />
</Trigger>
<Trigger Property="IsSelected" Value="true">
<Setter TargetName="underline"
Property="BorderThickness"
Value="0,0,0,1.5" />
<Setter Property="Foreground"
Value="{DynamicResource {x:Static h:BrushKeys.Accent}}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
<StackPanel Margin="0,0,10,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
DockPanel.Dock="Right"
Orientation="Horizontal"
WindowChrome.IsHitTestVisibleInChrome="True">
<ItemsControl
Foreground="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=CaptionForeground}"
Style="{DynamicResource {x:Static h:MvpKeys.WindowCaption}}" />
<Separator Height="20"
Background="{Binding RelativeSource={RelativeSource AncestorType=h:MessageWindowBase}, Path=CaptionForeground}"
Style="{DynamicResource {x:Static h:SeparatorKeys.Vertical}}" />
<Button
Style="{DynamicResource {x:Static h:ButtonKeys.MinimizeWindow}}" />
<Button x:Name="btnMax"
Style="{DynamicResource {x:Static h:ButtonKeys.MaximizeWindow}}" />
<Button
Style="{DynamicResource {x:Static h:ButtonKeys.CloseWindow}}" />
</StackPanel>
<Control Background="{TemplateBinding CaptionBackground}"
DockPanel.Dock="Right"
Foreground="{TemplateBinding CaptionForeground}"
Template="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(h:Cattach.CaptionRightTemplate)}"
WindowChrome.IsHitTestVisibleInChrome="True" />
<Control Background="{TemplateBinding CaptionBackground}"
Foreground="{TemplateBinding CaptionForeground}"
Template="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(h:Cattach.CaptionCenterTemplate)}"
WindowChrome.IsHitTestVisibleInChrome="True" />
</DockPanel>
</Border>
<Border x:Name="BgInner"
Grid.Row="1"
Margin="0"
Background="{TemplateBinding Background}"
CornerRadius="{DynamicResource {x:Static h:CornerRadiusKeys.Bottom}}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
<AdornerDecorator WindowChrome.IsHitTestVisibleInChrome="True">
<Grid>
<h:NotifyIcon x:Name="PART_NotifyIcon"
Command="{Binding Path=MinimizeWindowCommand, RelativeSource={RelativeSource TemplatedParent}}"
Icon="{Binding Path=NotifyIconSource, RelativeSource={RelativeSource TemplatedParent}}"
IconVisibility="Visible"
Text="{TemplateBinding Title}">
<FrameworkElement.ContextMenu>
<ContextMenu>
<MenuItem
Command="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=NotifyWindowCommand}"
CommandTarget="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}}"
Header="显示面板" />
<MenuItem
Command="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=NotifyWindowCommand}"
CommandTarget="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}}"
Header="隐藏" />
<MenuItem
Command="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=CloseWindowCommand}"
CommandTarget="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}}"
Header="退出" />
</ContextMenu>
</FrameworkElement.ContextMenu>
</h:NotifyIcon>
<Grid>
<h:DialogHost Margin="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Effect="{TemplateBinding AdornerDecoratorEffect}"
Identifier="windowDialog">
<Grid>
<DockPanel>
<Control DockPanel.Dock="Left"
Template="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(h:Cattach.LeftTemplate)}" />
<Control DockPanel.Dock="Right"
Template="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(h:Cattach.RightTemplate)}" />
<Control DockPanel.Dock="Bottom"
Template="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(h:Cattach.BottomTemplate)}" />
<Control DockPanel.Dock="Top"
Template="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(h:Cattach.TopTemplate)}" />
<Grid>
<h:LinkActionFrame
LinkAction="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=CurrentLink}"
UseRandomWipe="False" />
<Control
Template="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(h:Cattach.CenterTemplate)}" />
</Grid>
</DockPanel>
<h:ContainPanel x:Name="PART_LAYERGROUP"
Background="{DynamicResource {x:Static h:BrushKeys.DialogCover}}"
ClipToBounds="True"
Visibility="Collapsed">
<h:ContainPanel.AnimationAction>
<h:ScaleTransition />
</h:ContainPanel.AnimationAction>
</h:ContainPanel>
</Grid>
</h:DialogHost>
<h:MessageContainer x:Name="PART_Message" Grid.Row="1" />
<h:Snackbar x:Name="PART_SnackBar"
MessageQueue="{h:MessageQueue}" />
</Grid>
</Grid>
</AdornerDecorator>
</Border>
</Grid>
</h:GuideHost>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="WindowState" Value="Maximized">
<Setter TargetName="btnMax" Property="h:Cattach.Icon" Value="&#xe665;" />
<Setter TargetName="g_all" Property="Margin" Value="0" />
</Trigger>
<Trigger Property="WindowState" Value="Normal">
<Setter TargetName="btnMax" Property="h:Cattach.Icon" Value="&#xe615;" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</h:ApplicationBase.Resources>
</h:ApplicationBase>
</h:ApplicationBase>

View File

@ -10,6 +10,7 @@ using HeBianGu.General.WpfControlLib;
using HeBianGu.Service.Mvp;
using HeBianGu.Systems.Identity;
using HeBianGu.Systems.Setting;
using HeBianGu.Window.Link;
using Hopetry.Services;
using SqlSugar;
using SystemSetting = FileUploader.Models.SystemSetting;
@ -21,6 +22,10 @@ namespace HeBianGu.App.Disk
/// </summary>
public partial class App : ApplicationBase
{
public new static ComponentResourceKey Custom
{
get => new ComponentResourceKey(typeof (LinkWindowBase), (object) "S.Window.Link.Custom");
}
protected override MainWindowBase CreateMainWindow(StartupEventArgs e)
{
return new ShellWindow();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -2,7 +2,7 @@
using HeBianGu.Service.Mvc;
using Hopetry.ViewModel.Sync;
namespace HeBianGu.App.Disk;
namespace Hopetry.Controller;
// control 特性名好像绑定了 xaml
[Controller("Sync")]

View File

@ -65,10 +65,6 @@
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
</ItemGroup>
<ItemGroup>
<Folder Include="Assets\" />
</ItemGroup>
<ItemGroup>
<Page Update="View\Sync\ExplorerControl.xaml">
<Generator>MSBuild:Compile</Generator>
@ -90,6 +86,7 @@
<None Update="minio.db">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Remove="Assets\logo1.png" />
</ItemGroup>
<ItemGroup>

View File

@ -4,13 +4,15 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:h="https://github.com/HeBianGu"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:disk="clr-namespace:HeBianGu.App.Disk"
xmlns:system="clr-namespace:System;assembly=HeBianGu.Base.WpfBase"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<Grid DataContext="{StaticResource S.ViewModelLocator.Locator}">
<DockPanel Margin="0,0,10,0">
<h:Row DockPanel.Dock="Top" Style="{DynamicResource {x:Static h:Row.Column10Key}}">
<h:Row DockPanel.Dock="Top" Margin="0 ,8,0,8" Style="{DynamicResource {x:Static h:Row.Column10Key}}">
<Button Grid.Column="0"
Margin="10,0"
Content="全部暂停"
@ -18,94 +20,7 @@
<Button Grid.Column="1" Content="全部取消"
Style="{DynamicResource {x:Static h:ButtonKeys.BorderBrushTransparent}}" />
</h:Row>
<TabControl h:Cattach.UseSearch="False">
<TabItem Header="{Binding DownViewModel.AllTaskHeader}">
<ListBox h:Cattach.ItemHeight="Auto"
ItemsSource="{Binding DownViewModel.AllTasks}"
Style="{DynamicResource {x:Static h:ListBoxKeys.Single}}"
VirtualizingPanel.CacheLength="15"
VirtualizingPanel.CacheLengthUnit="Item"
VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.IsVirtualizingWhenGrouping="True"
VirtualizingPanel.ScrollUnit="Pixel"
VirtualizingPanel.VirtualizationMode="Recycling">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Height="50" Margin="10">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30" />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Grid.RowSpan="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="30"
Style="{DynamicResource {x:Static h:TextBlockKeys.Icon}}"
Text="&#xe741;" />
<TextBlock Grid.RowSpan="2"
Grid.Column="1"
HorizontalAlignment="Left"
Style="{DynamicResource {x:Static h:TextBlockKeys.Default}}"
Text="{Binding FileName}" />
<TextBlock Grid.Row="0"
Grid.Column="2"
HorizontalAlignment="Right"
Style="{DynamicResource {x:Static h:TextBlockKeys.Default}}"
Text="10:10:10" />
<TextBlock Grid.Row="0"
Grid.Column="3"
Style="{DynamicResource {x:Static h:TextBlockKeys.Default}}"
Text="{Binding FileName}" />
<h:FProgressBar Grid.Column="3"
Height="15"
CornerRadius="2"
Maximum="100"
Value="11">
</h:FProgressBar>
<TextBlock Grid.Row="1"
Grid.Column="3"
Margin="-3,0"
HorizontalAlignment="Left"
Style="{DynamicResource {x:Static h:TextBlockKeys.Default}}"
Text="{Binding FileName}" />
<!--操作-->
<StackPanel Grid.RowSpan="2"
Grid.Column="4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<Button h:Cattach.Icon="&#xe76e;" /> <!--暂停-->
<Button h:Cattach.Icon="&#xe8a0;" h:Cattach.IconSize="13" /> <!--取消-->
<Button h:Cattach.Icon="&#xe87a;" h:Cattach.IconSize="15"
Command="{Binding RelativeSource={RelativeSource AncestorType=ListBox},
Path= DataContext.DownViewModel.OpenDownItemFolder }"
CommandParameter="{Binding}" /> <!--打开所在文件夹-->
</StackPanel>
<Border Grid.RowSpan="11"
Grid.ColumnSpan="11"
Margin="0,0,0,-8"
BorderBrush="{DynamicResource {x:Static h:BrushKeys.BorderBrushDefault}}"
BorderThickness="0,0,0,1" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</TabItem>
<TabControl>
<TabItem Header="{Binding DownViewModel.RunningTaskHeader}">
<ListBox h:Cattach.ItemHeight="Auto"
ItemsSource="{Binding DownViewModel.RunningTasksView}"
@ -262,7 +177,7 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<Button h:Cattach.Icon="&#xe76e;" /> <!--暂停-->
<Button h:Cattach.Icon="&#xe76e;" /> <!--暂停 &#xe76e;-->
<Button h:Cattach.Icon="&#xe8a0;" h:Cattach.IconSize="13" /> <!--取消-->
<Button h:Cattach.Icon="&#xe87a;" h:Cattach.IconSize="15"
Command="{Binding RelativeSource={RelativeSource AncestorType=ListBox},

View File

@ -9,7 +9,7 @@
Width="1266"
Height="720"
BorderBrush="Transparent"
Style="{DynamicResource {x:Static h:LinkWindowBase.DefaultKey}}"
Style="{DynamicResource {x:Static local:App.Custom}}"
mc:Ignorable="d">
<!--<h:Cattach.RightTemplate>
<ControlTemplate>

View File

@ -12,7 +12,6 @@ using Hopetry.Provider;
using Hopetry.Services;
using Newtonsoft.Json;
using SqlSugar;
using System.Windows.Data;
namespace Hopetry.ViewModel.Send;
@ -20,15 +19,16 @@ namespace Hopetry.ViewModel.Send;
public class DownViewModel : MvcViewModelBase
{
private readonly MinioService _minioService;
// todo 完成取消下载及暂停下载逻辑
public RelayCommand<DownItem> OpenDownItemFolder { get; set; }
public RelayCommand<string> LoadData { get; set; }
public RelayCommand<MinioDownloadTask> OpenDownItemFolder { get; set; }
private readonly ConcurrentQueue<MinioDownloadTask> _taskQueue = new();
private SemaphoreSlim _concurrencySemaphore;
private CancellationTokenSource _processingCts = new();
/// <summary>
/// 全部任务动态标题
/// </summary>
private string _allTaskHeader;
public string AllTaskHeader
@ -66,10 +66,8 @@ public class DownViewModel : MvcViewModelBase
}
// 绑定属性
public ObservableCollection<MinioDownloadTask> Tasks { get; } = new();
// 所有任务
public ObservableCollection<MinioDownloadTask> AllTasks { get; set; }
public ObservableCollection<MinioDownloadTask> AllTasks { get;set; } = new();
public ICollectionView RunningTasksView { get; set; }
public ICollectionView FinishedTasksView { get; set; }
@ -133,28 +131,28 @@ public class DownViewModel : MvcViewModelBase
AllTasks = new ObservableCollection<MinioDownloadTask>(data);
AllTaskHeader = $"全部({AllTasks.Count}";
Console.WriteLine(JsonConvert.SerializeObject(data));
OpenDownItemFolder = new RelayCommand<DownItem>(DoOpenDownItemFolder);
OpenDownItemFolder = new RelayCommand<MinioDownloadTask>(DoOpenDownItemFolder);
// 命令初始化
// AddTaskCommand = new RelayCommand(AddTask, CanAddTask);
// 修正:使用 CollectionViewSource 确保通知
var cvsRunning = new CollectionViewSource { Source = AllTasks };
cvsRunning.Filter += (s, e) =>
{
var b = ((MinioDownloadTask)e.Item).Status == "下载中";
var b = ((MinioDownloadTask)e.Item).Status is "下载中" or "等待中" or "已暂停";
e.Accepted = b;
};
RunningTasksView = cvsRunning.View;
var cvsPaused = new CollectionViewSource { Source = AllTasks };
cvsPaused.Filter += (s, e) =>
var cvsFinished = new CollectionViewSource { Source = AllTasks };
cvsFinished.Filter += (s, e) =>
{
var b = ((MinioDownloadTask)e.Item).Status == "已完成";
e.Accepted = b;
};
FinishedTasksView = cvsPaused.View;
FinishedTasksView = cvsFinished.View;
if (FinishedTasksView is ListCollectionView finishListView)
{
FinishedTaskHeader = $"下载中{finishListView.Count}";
FinishedTaskHeader = $"已完成{finishListView.Count}";
}
if (RunningTasksView is ListCollectionView runningListView)
@ -199,7 +197,7 @@ public class DownViewModel : MvcViewModelBase
private void AddTask()
{
var task = new MinioDownloadTask(_minioService, NewBucket, NewObjectName);
Tasks.Add(task);
AllTasks.Add(task);
_taskQueue.Enqueue(task);
RaisePropertyChanged(nameof(NewBucket));
RaisePropertyChanged(nameof(NewObjectName));
@ -266,7 +264,7 @@ public class DownViewModel : MvcViewModelBase
}
}
public void DoOpenDownItemFolder(DownItem para)
public void DoOpenDownItemFolder(MinioDownloadTask para)
{
Console.WriteLine($"点击了什么值:{JsonConvert.SerializeObject(para)}");
Process.Start("explorer.exe", para.FilePath);

View File

@ -5,19 +5,22 @@ using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows;
using System.Windows.Threading;
using Hopetry.Provider;
namespace HeBianGu.App.Disk
{
[ViewModel("Send")]
internal class SendViewModel : MvcViewModelBase
{
protected override void Init()
public SendViewModel()
{
LinkActions.Add(new LinkAction() { Action = "Down", Controller = "Send", DisplayName = "正在下载", Logo = "\xe6f3" });
LinkActions.Add(new LinkAction() { Action = "UpLoad", Controller = "Send", DisplayName = "正在上传", Logo = "\xe6fe" });
LinkActions.Add(new LinkAction() { Action = "CompleteUpload", Controller = "Send", DisplayName = "上传完成", Logo = "\xe613" });
//LinkActions.Add(new LinkAction() { Action = "Down", Controller = "Send", DisplayName = "文件快传", Logo = "\xe764" });
}
protected override void Init()
{
Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new Action(() =>
{

BIN
minio.db

Binary file not shown.