update:缓存

This commit is contained in:
ltx 2025-11-11 14:30:29 +08:00
parent aafa6c50dd
commit 7daea89ec4
4 changed files with 43 additions and 3 deletions

View File

@ -15,6 +15,25 @@ namespace AiSportsMicrospaceDB.DBContext
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<SixGroupPoints>().HasData(
new SixGroupPoints
{
Id = 1,
points = [
(0.21, 0.88 ),
(0.36, 0.58 ),
(0.50, 0.88),
(0.64, 0.58 ),
(0.78, 0.88),
(0.92, 0.58 )
]
});
}
public DbSet<BasicConfig> BasicConfig { get; set; }
public DbSet<SixGroupPoints> SixGroupPoints { get; set; }
}
}

View File

@ -1,4 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -14,4 +15,10 @@ namespace AiSportsMicrospaceDB.Entities
public string UserName { get; set; }
public string Password { get; set; }
}
public class SixGroupPoints {
// ✅ 主键
public int Id { get; set; }
public List<(double,double)> points { get; set; }
}
}

View File

@ -14,7 +14,7 @@ namespace Dto
{
// 静态字段,保存排名列表
public static List<RankItem> RankList { get; set; } = new List<RankItem>();
public List<(double XNorm, double YNorm)> CirclePositions { get; private set; }
public List<(double XNorm, double YNorm)> CirclePositions { get; set; } = new List<(double XNorm, double YNorm)>();
public List<SportUserItem> UserList { get; private set; }
public List<string> UserNumberList { get; private set; }
public List<SportBase> Sports { get; private set; }

View File

@ -1,4 +1,5 @@
using Dto;
using AiSportsMicrospaceDB.DBContext;
using Dto;
using Emgu.CV.Flann;
using Enum;
using HandyControl.Controls;
@ -67,9 +68,23 @@ namespace Wpf_AiSportsMicrospace.Views
Unloaded += UserControl_Unloaded;
_groupJumpRopeContext = new GroupJumpRopeContext();
// 将原来的赋值方式:
//_groupJumpRopeContext.CirclePositions = config != null ? config.sixJumpPoints : _groupJumpRopeContext.CirclePositions;
// 修改为:先清空再添加元素(因为 CirclePositions 只有 get没有 set
//_groupJumpRopeContext.CirclePositions.Clear();
//if (config != null && config.sixJumpPoints != null)
//{
// foreach (var pt in config.sixJumpPoints)
// {
// _groupJumpRopeContext.CirclePositions.Add(pt);
// }
//}
}
private async void UserControl_Loaded(object sender, RoutedEventArgs e)
{
// 绑定人脸识别事件
_mainWin.FacialRecognitionEvent += async (sender, buffer) =>
{
@ -679,6 +694,5 @@ namespace Wpf_AiSportsMicrospace.Views
var fadeIn = new DoubleAnimation(0, 1, TimeSpan.FromMilliseconds(time));
Element.BeginAnimation(UIElement.OpacityProperty, fadeIn);
}
}
}