update:ui修改

This commit is contained in:
ltx 2025-10-09 10:22:55 +08:00
parent 4ef4da7781
commit 3abc86b451
7 changed files with 83 additions and 16 deletions

View File

@ -2,8 +2,9 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Wpf_AiSportsMicrospace.MyUserControl" xmlns:local="clr-namespace:Wpf_AiSportsMicrospace.MyUserControl"
xmlns:gif="http://wpfanimatedgif.codeplex.com"
Title="Home" Height="1080" Width="1920" Loaded="Window_Loaded"> Title="Home" Height="1080" Width="1920" Loaded="Window_Loaded">
<Grid Height="1065" VerticalAlignment="Bottom"> <Grid VerticalAlignment="Bottom">
<Grid.Background> <Grid.Background>
<ImageBrush ImageSource="/Resources/Img/Album/home_bg.png" Stretch="UniformToFill"/> <ImageBrush ImageSource="/Resources/Img/Album/home_bg.png" Stretch="UniformToFill"/>
</Grid.Background> </Grid.Background>
@ -27,5 +28,44 @@
Margin="0,250,0,0" Margin="0,250,0,0"
Padding="0,100" Padding="0,100"
/> />
<Grid Margin="314,803,314,0" VerticalAlignment="Top" Height="182">
<Image
Source="/Resources/Img/Album/change_back.png"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Width="330"
Margin="0,100,0,0"
/>
<Image
gif:ImageBehavior.AnimatedSource="/Resources/Img/Album/2.gif"
gif:ImageBehavior.RepeatBehavior="Forever"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="-20,10,30,20"
/>
<Image
Source="/Resources/Img/Album/change_right.png"
HorizontalAlignment="right"
VerticalAlignment="Top"
Width="330"
Margin="0,100,0,0"
/>
<Image
gif:ImageBehavior.AnimatedSource="/Resources/Img/Album/1.gif"
gif:ImageBehavior.RepeatBehavior="Forever"
HorizontalAlignment="right"
VerticalAlignment="Top"
Margin="50,10,200,20"
/>
</Grid>
<Image
gif:ImageBehavior.AnimatedSource="/Resources/Img/Album/3.gif"
gif:ImageBehavior.RepeatBehavior="Forever"
HorizontalAlignment="right"
VerticalAlignment="Top"
Margin="100,120,200,20"
/>
</Grid> </Grid>
</Window> </Window>

View File

@ -24,12 +24,12 @@ using Yztob.AiSports.Postures.Sports;
using Yztob.AiSports.Postures.Things; using Yztob.AiSports.Postures.Things;
using Yztob.AiSports.Sensors.Abstractions; using Yztob.AiSports.Sensors.Abstractions;
using Yztob.AiSports.Sensors.Things; using Yztob.AiSports.Sensors.Things;
namespace Wpf_AiSportsMicrospace namespace Wpf_AiSportsMicrospace
{ {
/// <summary> /// <summary>
/// Home.xaml 的交互逻辑 /// Home.xaml 的交互逻辑
/// </summary> /// </summary>
///
public partial class Home : Window public partial class Home : Window
{ {
private IHumanPredictor _humanPredictor; private IHumanPredictor _humanPredictor;
@ -37,14 +37,13 @@ namespace Wpf_AiSportsMicrospace
private ConcurrentQueue<VideoFrame> _frameQueue = new(); private ConcurrentQueue<VideoFrame> _frameQueue = new();
private CancellationTokenSource _cts = new(); private CancellationTokenSource _cts = new();
private SportOperate _sportOperate; private SportOperate _sportOperate;
public static Uri loadingImage = new Uri("/Resources/Img/Album/1.gif", UriKind.Relative);
public Home() public Home()
{ {
InitializeComponent(); InitializeComponent();
_humanPredictor = HumanPredictorFactory.Create(HumanPredictorType.SingleHigh); _humanPredictor = HumanPredictorFactory.Create(HumanPredictorType.SingleHigh);
_objectDetector = ObjectDetectorFactory.CreateSportGoodsDetector();
_humanGraphicsRenderer = new HumanGraphicsRenderer();
_humanGraphicsRenderer.DrawLabel = false;
//_sports = SportBase.GetSports(); //_sports = SportBase.GetSports();
//_detectQueue = new SportDetectionQueue(); //_detectQueue = new SportDetectionQueue();
@ -65,22 +64,25 @@ namespace Wpf_AiSportsMicrospace
// 默认选中第3张 // 默认选中第3张
coverFlow.SelectedIndex = 0; coverFlow.SelectedIndex = 0;
//AnimationBehavior.SetSourceUri(LoadingImage, loadingImage);
} }
private void Window_Loaded(object sender, RoutedEventArgs e) private void Window_Loaded(object sender, RoutedEventArgs e)
{ {
_sportOperate = new SportOperate(); //_sportOperate = new SportOperate();
_webcamClient = _sportOperate.CreateRTSP(); //_webcamClient = _sportOperate.CreateRTSP();
_webcamClient.OnExtractFrame += frame => //_webcamClient.OnExtractFrame += frame =>
{ //{
if (frame != null) // if (frame != null)
_frameQueue.Enqueue(frame); // _frameQueue.Enqueue(frame);
}; //};
_webcamClient.StartExtract(); //_webcamClient.StartExtract();
StartFrameProcessing(); //StartFrameProcessing();
coverFlow.ProgressCompleted += CoverFlow_ProgressCompleted; //coverFlow.ProgressCompleted += CoverFlow_ProgressCompleted;
} }
private void CoverFlow_ProgressCompleted(CoverFlowItem item) private void CoverFlow_ProgressCompleted(CoverFlowItem item)

View File

@ -13,7 +13,7 @@
<ItemsControl x:Name="ItemsHost" ItemsSource="{Binding Images, RelativeSource={RelativeSource AncestorType=UserControl}}"> <ItemsControl x:Name="ItemsHost" ItemsSource="{Binding Images, RelativeSource={RelativeSource AncestorType=UserControl}}">
<ItemsControl.ItemsPanel> <ItemsControl.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
<Canvas/> <Canvas/>
</ItemsPanelTemplate> </ItemsPanelTemplate>
</ItemsControl.ItemsPanel> </ItemsControl.ItemsPanel>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 MiB

View File

@ -9,13 +9,19 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Remove="Resources\Img\Album\1.gif" />
<None Remove="Resources\Img\Album\1.jpg" /> <None Remove="Resources\Img\Album\1.jpg" />
<None Remove="Resources\Img\Album\2.gif" />
<None Remove="Resources\Img\Album\2.jpg" /> <None Remove="Resources\Img\Album\2.jpg" />
<None Remove="Resources\Img\Album\3.gif" />
<None Remove="Resources\Img\Album\3.jpg" /> <None Remove="Resources\Img\Album\3.jpg" />
<None Remove="Resources\Img\Album\4.jpg" /> <None Remove="Resources\Img\Album\4.jpg" />
<None Remove="Resources\Img\Album\5.jpg" /> <None Remove="Resources\Img\Album\5.jpg" />
<None Remove="Resources\Img\Album\action_user.png" /> <None Remove="Resources\Img\Album\action_user.png" />
<None Remove="Resources\Img\Album\change_back.png" />
<None Remove="Resources\Img\Album\change_bg.png" /> <None Remove="Resources\Img\Album\change_bg.png" />
<None Remove="Resources\Img\Album\change_left.png" />
<None Remove="Resources\Img\Album\change_right.png" />
<None Remove="Resources\Img\Album\home_bg.png" /> <None Remove="Resources\Img\Album\home_bg.png" />
<None Remove="Resources\Img\Album\home_history.png" /> <None Remove="Resources\Img\Album\home_history.png" />
<None Remove="Resources\Img\Album\home_play.png" /> <None Remove="Resources\Img\Album\home_play.png" />
@ -49,6 +55,7 @@
<PackageReference Include="SkiaSharp" Version="3.119.0" /> <PackageReference Include="SkiaSharp" Version="3.119.0" />
<PackageReference Include="System.Drawing.Common" Version="9.0.9" /> <PackageReference Include="System.Drawing.Common" Version="9.0.9" />
<PackageReference Include="System.Speech" Version="9.0.9" /> <PackageReference Include="System.Speech" Version="9.0.9" />
<PackageReference Include="WpfAnimatedGif" Version="2.0.2" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -79,12 +86,21 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Resources\Img\Album\1.gif">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Resources\Img\Album\1.jpg"> <Resource Include="Resources\Img\Album\1.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource> </Resource>
<Resource Include="Resources\Img\Album\2.gif">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Resources\Img\Album\2.jpg"> <Resource Include="Resources\Img\Album\2.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource> </Resource>
<Resource Include="Resources\Img\Album\3.gif">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Resources\Img\Album\3.jpg"> <Resource Include="Resources\Img\Album\3.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource> </Resource>
@ -97,9 +113,18 @@
<Resource Include="Resources\Img\Album\action_user.png"> <Resource Include="Resources\Img\Album\action_user.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource> </Resource>
<Resource Include="Resources\Img\Album\change_back.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Resources\Img\Album\change_bg.png"> <Resource Include="Resources\Img\Album\change_bg.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource> </Resource>
<Resource Include="Resources\Img\Album\change_left.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Resources\Img\Album\change_right.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Resources\Img\Album\home_bg.png"> <Resource Include="Resources\Img\Album\home_bg.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource> </Resource>