update:
大小&位置&背景
@ -2,9 +2,11 @@
|
|||||||
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"
|
||||||
Title="Home" Height="400" Width="800" Loaded="Window_Loaded">
|
Title="Home" Height="1080" Width="1920" Loaded="Window_Loaded">
|
||||||
<Grid>
|
<Grid>
|
||||||
|
<Grid.Background>
|
||||||
<local:CoverFlowControl x:Name="coverFlow" HorizontalAlignment="Center" VerticalAlignment="Center" Height="500" Width="881" Loaded="coverFlow_Loaded"/>
|
<ImageBrush ImageSource="/Resources/Img/Album/home_bg.png" Stretch="UniformToFill"/>
|
||||||
|
</Grid.Background>
|
||||||
|
<local:CoverFlowControl x:Name="coverFlow" HorizontalAlignment="Center" VerticalAlignment="Center" Height="500" Width="1920"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@ -39,13 +39,13 @@ namespace Wpf_AiSportsMicrospace
|
|||||||
public Home()
|
public Home()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_humanPredictor = HumanPredictorFactory.Create(HumanPredictorType.SingleHigh);
|
//_humanPredictor = HumanPredictorFactory.Create(HumanPredictorType.SingleHigh);
|
||||||
_objectDetector = ObjectDetectorFactory.CreateSportGoodsDetector();
|
//_objectDetector = ObjectDetectorFactory.CreateSportGoodsDetector();
|
||||||
_humanGraphicsRenderer = new HumanGraphicsRenderer();
|
//_humanGraphicsRenderer = new HumanGraphicsRenderer();
|
||||||
_humanGraphicsRenderer.DrawLabel = false;
|
//_humanGraphicsRenderer.DrawLabel = false;
|
||||||
|
|
||||||
_sports = SportBase.GetSports();
|
//_sports = SportBase.GetSports();
|
||||||
_detectQueue = new SportDetectionQueue();
|
//_detectQueue = new SportDetectionQueue();
|
||||||
|
|
||||||
string projectRoot = Path.Combine(AppContext.BaseDirectory, @"..\..\..");
|
string projectRoot = Path.Combine(AppContext.BaseDirectory, @"..\..\..");
|
||||||
string albumPath = Path.Combine(projectRoot, "Resources", "Img", "Album");
|
string albumPath = Path.Combine(projectRoot, "Resources", "Img", "Album");
|
||||||
@ -63,9 +63,9 @@ namespace Wpf_AiSportsMicrospace
|
|||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
_tracker = PostureCalculate.CreatePointTracker("left_wrist", 0);
|
//_tracker = PostureCalculate.CreatePointTracker("left_wrist", 0);
|
||||||
|
|
||||||
LoadRTSP();
|
//LoadRTSP();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadRTSP()
|
private void LoadRTSP()
|
||||||
|
|||||||
@ -4,8 +4,8 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:Wpf_AiSportsMicrospace.MyUserControl"
|
xmlns:local="clr-namespace:Wpf_AiSportsMicrospace.MyUserControl"
|
||||||
Height="300" Width="600">
|
Height="500" Width="1080">
|
||||||
<Grid ClipToBounds="True" Background="Transparent">
|
<Grid ClipToBounds="False" Background="Transparent">
|
||||||
<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>
|
||||||
@ -23,7 +23,7 @@
|
|||||||
<TranslateTransform x:Name="translate" X="0" Y="0"/>
|
<TranslateTransform x:Name="translate" X="0" Y="0"/>
|
||||||
</TransformGroup>
|
</TransformGroup>
|
||||||
</Border.RenderTransform>
|
</Border.RenderTransform>
|
||||||
<Image Source="{Binding}" Stretch="UniformToFill" Width="150" Height="200"/>
|
<Image Source="{Binding}" Stretch="UniformToFill" Width="376" Height="461" />
|
||||||
</Border>
|
</Border>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
|
|||||||
@ -26,6 +26,23 @@ namespace Wpf_AiSportsMicrospace.MyUserControl
|
|||||||
{
|
{
|
||||||
public ObservableCollection<Uri> Images { get; set; } = new ObservableCollection<Uri>();
|
public ObservableCollection<Uri> Images { get; set; } = new ObservableCollection<Uri>();
|
||||||
|
|
||||||
|
// 添加附加属性帮助类
|
||||||
|
public static class LayoutHelper
|
||||||
|
{
|
||||||
|
public static int GetZIndex(DependencyObject obj)
|
||||||
|
{
|
||||||
|
return (int)obj.GetValue(ZIndexProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetZIndex(DependencyObject obj, int value)
|
||||||
|
{
|
||||||
|
obj.SetValue(ZIndexProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly DependencyProperty ZIndexProperty =
|
||||||
|
DependencyProperty.RegisterAttached("ZIndex", typeof(int), typeof(LayoutHelper), new PropertyMetadata(0));
|
||||||
|
}
|
||||||
|
|
||||||
private int _selectedIndex = 0;
|
private int _selectedIndex = 0;
|
||||||
public int SelectedIndex
|
public int SelectedIndex
|
||||||
{
|
{
|
||||||
@ -71,9 +88,9 @@ namespace Wpf_AiSportsMicrospace.MyUserControl
|
|||||||
private void UpdateLayoutWithAnimation(bool instant = false)
|
private void UpdateLayoutWithAnimation(bool instant = false)
|
||||||
{
|
{
|
||||||
double centerX = ActualWidth / 2;
|
double centerX = ActualWidth / 2;
|
||||||
double spacing = 180;
|
double spacing = 500;
|
||||||
double sideScale = 0.8;
|
double sideScale = 0.93;
|
||||||
double centerScale = 1.2;
|
double centerScale = 1.33;
|
||||||
|
|
||||||
for (int i = 0; i < ItemsHost.Items.Count; i++)
|
for (int i = 0; i < ItemsHost.Items.Count; i++)
|
||||||
{
|
{
|
||||||
@ -84,7 +101,7 @@ namespace Wpf_AiSportsMicrospace.MyUserControl
|
|||||||
if (border == null) continue;
|
if (border == null) continue;
|
||||||
|
|
||||||
var transformGroup = border.RenderTransform as TransformGroup;
|
var transformGroup = border.RenderTransform as TransformGroup;
|
||||||
var scale = transformGroup.Children[0] as ScaleTransform;
|
var scale = transformGroup!.Children[0] as ScaleTransform;
|
||||||
var translate = transformGroup.Children[1] as TranslateTransform;
|
var translate = transformGroup.Children[1] as TranslateTransform;
|
||||||
|
|
||||||
double targetX;
|
double targetX;
|
||||||
@ -93,27 +110,27 @@ namespace Wpf_AiSportsMicrospace.MyUserControl
|
|||||||
|
|
||||||
if (i == SelectedIndex)
|
if (i == SelectedIndex)
|
||||||
{
|
{
|
||||||
targetX = centerX - 75;
|
targetX = centerX - 190;
|
||||||
targetScale = centerScale;
|
targetScale = centerScale;
|
||||||
targetOpacity = 1.0;
|
targetOpacity = 1.0;
|
||||||
}
|
}
|
||||||
else if (i == SelectedIndex - 1 || (SelectedIndex == 0 && i == Images.Count - 1))
|
else if (i == SelectedIndex - 1 || (SelectedIndex == 0 && i == Images.Count - 1))
|
||||||
{
|
{
|
||||||
// 左边图片,循环处理
|
// 左边图片,循环处理
|
||||||
targetX = centerX - spacing - 75;
|
targetX = centerX - spacing - 190;
|
||||||
targetScale = sideScale;
|
targetScale = sideScale;
|
||||||
targetOpacity = 1.0;
|
targetOpacity = 1.0;
|
||||||
}
|
}
|
||||||
else if (i == SelectedIndex + 1 || (SelectedIndex == Images.Count - 1 && i == 0))
|
else if (i == SelectedIndex + 1 || (SelectedIndex == Images.Count - 1 && i == 0))
|
||||||
{
|
{
|
||||||
// 右边图片,循环处理
|
// 右边图片,循环处理
|
||||||
targetX = centerX + spacing - 75;
|
targetX = centerX + spacing - 190;
|
||||||
targetScale = sideScale;
|
targetScale = sideScale;
|
||||||
targetOpacity = 1.0;
|
targetOpacity = 1.0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
targetX = centerX - 75;
|
targetX = centerX - 190;
|
||||||
targetScale = sideScale;
|
targetScale = sideScale;
|
||||||
targetOpacity = 0.0;
|
targetOpacity = 0.0;
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
Wpf_AiSportsMicrospace/Resources/Img/Album/action_user.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
Wpf_AiSportsMicrospace/Resources/Img/Album/change_bg.png
Normal file
|
After Width: | Height: | Size: 793 B |
|
Before Width: | Height: | Size: 470 KiB After Width: | Height: | Size: 231 KiB |
|
Before Width: | Height: | Size: 430 KiB After Width: | Height: | Size: 223 KiB |
|
Before Width: | Height: | Size: 467 KiB After Width: | Height: | Size: 1012 KiB |
@ -14,6 +14,12 @@
|
|||||||
<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\change_bg.png" />
|
||||||
|
<None Remove="Resources\Img\Album\home_bg.png" />
|
||||||
|
<None Remove="Resources\Img\Album\home_history.png" />
|
||||||
|
<None Remove="Resources\Img\Album\home_play.png" />
|
||||||
|
<None Remove="Resources\Img\Album\home_test.png" />
|
||||||
<None Remove="Resources\Img\Badge\1.jpg" />
|
<None Remove="Resources\Img\Badge\1.jpg" />
|
||||||
<None Remove="Resources\Img\Badge\2.jpg" />
|
<None Remove="Resources\Img\Badge\2.jpg" />
|
||||||
<None Remove="Resources\Img\Badge\3.jpg" />
|
<None Remove="Resources\Img\Badge\3.jpg" />
|
||||||
@ -87,6 +93,24 @@
|
|||||||
<Resource Include="Resources\Img\Album\5.jpg">
|
<Resource Include="Resources\Img\Album\5.jpg">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="Resources\Img\Album\action_user.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Resource>
|
||||||
|
<Resource Include="Resources\Img\Album\change_bg.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Resource>
|
||||||
|
<Resource Include="Resources\Img\Album\home_bg.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Resource>
|
||||||
|
<Resource Include="Resources\Img\Album\home_history.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Resource>
|
||||||
|
<Resource Include="Resources\Img\Album\home_play.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Resource>
|
||||||
|
<Resource Include="Resources\Img\Album\home_test.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Resource>
|
||||||
<Resource Include="Resources\Img\Badge\1.jpg">
|
<Resource Include="Resources\Img\Badge\1.jpg">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
|||||||