数据库添加
This commit is contained in:
parent
c160876ecc
commit
2fc06708dd
@ -1,18 +1,55 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AiSportsMicrospaceDB.Entities
|
||||
{
|
||||
[Table("BasicConfig")]
|
||||
public class BasicConfig
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Display(Description = "主键Id")]
|
||||
[Comment("Id")]
|
||||
// ✅ 主键
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///设备编号
|
||||
/// </summary>
|
||||
[Display(Name = "设备编号")]
|
||||
[Comment("设备编号")]
|
||||
[Column(TypeName = "nvarchar(100)")]
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///摄像头地址
|
||||
/// </summary>
|
||||
[Display(Name = "摄像头地址")]
|
||||
[Comment("摄像头地址")]
|
||||
[Column(TypeName = "nvarchar(100)")]
|
||||
public string Host { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///用户名
|
||||
/// </summary>
|
||||
[Display(Name = "用户名")]
|
||||
[Comment("用户名")]
|
||||
[Column(TypeName = "nvarchar(20)")]
|
||||
public string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///密码
|
||||
/// </summary>
|
||||
[Display(Name = "密码")]
|
||||
[Comment("密码")]
|
||||
[Column(TypeName = "nvarchar(20)")]
|
||||
public string Password { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
41
AiSportsMicrospaceDB/Entities/DeviceAssocSchool.cs
Normal file
41
AiSportsMicrospaceDB/Entities/DeviceAssocSchool.cs
Normal file
@ -0,0 +1,41 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AiSportsMicrospaceDB.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备学校绑定
|
||||
/// </summary>
|
||||
[Table("DeviceAssocSchool")]
|
||||
public class DeviceAssocSchool
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Display(Description = "主键Id")]
|
||||
[Comment("Id")]
|
||||
// ✅ 主键
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///学校编号
|
||||
/// </summary>
|
||||
[Display(Name = "学校编号")]
|
||||
[Comment("学校编号")]
|
||||
[Column(TypeName = "nvarchar(100)")]
|
||||
public string SchoolCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///设备编号
|
||||
/// </summary>
|
||||
[Display(Name = "设备编号")]
|
||||
[Comment("设备编号")]
|
||||
[Column(TypeName = "nvarchar(100)")]
|
||||
public string Code { get; set; }
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,8 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -9,9 +11,21 @@ using System.Threading.Tasks;
|
||||
namespace AiSportsMicrospaceDB.Entities
|
||||
{
|
||||
|
||||
[Table("JumpLongPoints")]
|
||||
public class JumpLongPoints {
|
||||
// ✅ 主键
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Display(Description = "主键Id")]
|
||||
[Comment("Id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///设备编号
|
||||
/// </summary>
|
||||
[Display(Name = "设备编号")]
|
||||
[Comment("设备编号")]
|
||||
[Column(TypeName = "nvarchar(100)")]
|
||||
public string Code { get; set; }
|
||||
public Point TopPoint1 { get; set; }
|
||||
public Point TopPoint2 { get; set; }
|
||||
public Point TopPoint3 { get; set; }
|
||||
@ -19,7 +33,4 @@ namespace AiSportsMicrospaceDB.Entities
|
||||
public Point BottomPoint2 { get; set; }
|
||||
public Point BottomPoint3 { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -9,15 +11,31 @@ using System.Threading.Tasks;
|
||||
namespace AiSportsMicrospaceDB.Entities
|
||||
{
|
||||
|
||||
[Table("SixGroupPoints")]
|
||||
public class SixGroupPoints {
|
||||
// ✅ 主键
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Display(Description = "主键Id")]
|
||||
[Comment("Id")]
|
||||
public int Id { get; set; }
|
||||
public Point point1 { get; set; }
|
||||
public Point point2 { get; set; }
|
||||
public Point point3 { get; set; }
|
||||
public Point point4 { get; set; }
|
||||
public Point point5 { get; set; }
|
||||
public Point point6 { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///设备编号
|
||||
/// </summary>
|
||||
[Display(Name = "设备编号")]
|
||||
[Comment("设备编号")]
|
||||
[Column(TypeName = "nvarchar(100)")]
|
||||
public string Code { get; set; }
|
||||
|
||||
public Point Point1 { get; set; }
|
||||
public Point Point2 { get; set; }
|
||||
public Point Point3 { get; set; }
|
||||
public Point Point4 { get; set; }
|
||||
public Point Point5 { get; set; }
|
||||
public Point Point6 { get; set; }
|
||||
public Point? Point7 { get; set; }
|
||||
public Point? Point8 { get; set; }
|
||||
public Point? Point9 { get; set; }
|
||||
public Point? Point10 { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
using AiSportsMicrospaceDB.DBContext;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using Common;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@ -32,6 +32,9 @@ public partial class App : Application
|
||||
DebugTracker.Channels.Add(new DiagnosisDebugTrackChannel());
|
||||
#endif
|
||||
|
||||
base.OnStartup(e);
|
||||
|
||||
// 创建 Host
|
||||
AppHost = Host.CreateDefaultBuilder()
|
||||
.ConfigureAppConfiguration((context, config) =>
|
||||
{
|
||||
@ -40,81 +43,86 @@ public partial class App : Application
|
||||
})
|
||||
.ConfigureServices((context, services) =>
|
||||
{
|
||||
// 读取数据库连接
|
||||
var connectionString = context.Configuration.GetConnectionString("DefaultConnection");
|
||||
services.AddDbContext<AppDbContext>(options =>
|
||||
options.UseSqlite(connectionString));
|
||||
options.UseSqlServer(connectionString));
|
||||
|
||||
//services.AddSingleton<MainWindow>();
|
||||
// 初始化全局配置
|
||||
AppSettings.Init(context.Configuration);
|
||||
|
||||
// 注入 MainWindow
|
||||
services.AddSingleton<Main>();
|
||||
|
||||
var SSS = AppSettings.SchoolCode;
|
||||
})
|
||||
.Build();
|
||||
|
||||
// 启动 Host
|
||||
AppHost.Start();
|
||||
|
||||
using (var scope = AppHost.Services.CreateScope())
|
||||
{
|
||||
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
//db.Database.EnsureDeleted(); // 删除数据库和表
|
||||
db.Database.EnsureCreated();
|
||||
//db.Database.ExecuteSqlRaw("DROP TABLE [JumpLongPoints]");
|
||||
if (!db.SixGroupPoints.Any())
|
||||
{
|
||||
db.SixGroupPoints.Add(new AiSportsMicrospaceDB.Entities.SixGroupPoints
|
||||
{
|
||||
Id = 1,
|
||||
point1 = new AiSportsMicrospaceDB.Entities.Point { X = 0.21, Y = 0.88 },
|
||||
point2 = new AiSportsMicrospaceDB.Entities.Point { X = 0.36, Y = 0.58 },
|
||||
point3 = new AiSportsMicrospaceDB.Entities.Point { X = 0.50, Y = 0.88 },
|
||||
point4 = new AiSportsMicrospaceDB.Entities.Point { X = 0.64, Y = 0.58 },
|
||||
point5 = new AiSportsMicrospaceDB.Entities.Point { X = 0.78, Y = 0.88 },
|
||||
point6 = new AiSportsMicrospaceDB.Entities.Point { X = 0.92, Y = 0.58 }
|
||||
});
|
||||
db.SaveChanges();
|
||||
}
|
||||
//using (var scope = AppHost.Services.CreateScope())
|
||||
//{
|
||||
// var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
// //db.Database.EnsureDeleted(); // 删除数据库和表
|
||||
// db.Database.EnsureCreated();
|
||||
// //db.Database.ExecuteSqlRaw("DROP TABLE [JumpLongPoints]");
|
||||
// if (!db.SixGroupPoints.Any())
|
||||
// {
|
||||
// db.SixGroupPoints.Add(new AiSportsMicrospaceDB.Entities.SixGroupPoints
|
||||
// {
|
||||
// Id = 1,
|
||||
// Point1 = new AiSportsMicrospaceDB.Entities.Point { X = 0.21, Y = 0.88 },
|
||||
// Point2 = new AiSportsMicrospaceDB.Entities.Point { X = 0.36, Y = 0.58 },
|
||||
// Point3 = new AiSportsMicrospaceDB.Entities.Point { X = 0.50, Y = 0.88 },
|
||||
// Point4 = new AiSportsMicrospaceDB.Entities.Point { X = 0.64, Y = 0.58 },
|
||||
// Point5 = new AiSportsMicrospaceDB.Entities.Point { X = 0.78, Y = 0.88 },
|
||||
// Point6 = new AiSportsMicrospaceDB.Entities.Point { X = 0.92, Y = 0.58 }
|
||||
// });
|
||||
// db.SaveChanges();
|
||||
// }
|
||||
|
||||
if (!CheckTableExists(db , "JumpLongPoints"))
|
||||
{
|
||||
var createTableSql = @"
|
||||
CREATE TABLE IF NOT EXISTS JumpLongPoints (
|
||||
Id INTEGER PRIMARY KEY,
|
||||
TopPoint1_X TEXT NOT NULL,
|
||||
TopPoint2_X TEXT NOT NULL,
|
||||
TopPoint3_X TEXT NOT NULL,
|
||||
BottomPoint1_X TEXT NOT NULL,
|
||||
BottomPoint2_X TEXT NOT NULL,
|
||||
BottomPoint3_X TEXT NOT NULL,
|
||||
TopPoint1_Y TEXT NOT NULL,
|
||||
TopPoint2_Y TEXT NOT NULL,
|
||||
TopPoint3_Y TEXT NOT NULL,
|
||||
BottomPoint1_Y TEXT NOT NULL,
|
||||
BottomPoint2_Y TEXT NOT NULL,
|
||||
BottomPoint3_Y TEXT NOT NULL
|
||||
)";
|
||||
// //if (!CheckTableExists(db , "JumpLongPoints"))
|
||||
// //{
|
||||
// // var createTableSql = @"
|
||||
// // CREATE TABLE IF NOT EXISTS JumpLongPoints (
|
||||
// // Id INTEGER PRIMARY KEY,
|
||||
// // TopPoint1_X TEXT NOT NULL,
|
||||
// // TopPoint2_X TEXT NOT NULL,
|
||||
// // TopPoint3_X TEXT NOT NULL,
|
||||
// // BottomPoint1_X TEXT NOT NULL,
|
||||
// // BottomPoint2_X TEXT NOT NULL,
|
||||
// // BottomPoint3_X TEXT NOT NULL,
|
||||
// // TopPoint1_Y TEXT NOT NULL,
|
||||
// // TopPoint2_Y TEXT NOT NULL,
|
||||
// // TopPoint3_Y TEXT NOT NULL,
|
||||
// // BottomPoint1_Y TEXT NOT NULL,
|
||||
// // BottomPoint2_Y TEXT NOT NULL,
|
||||
// // BottomPoint3_Y TEXT NOT NULL
|
||||
// // )";
|
||||
|
||||
db.Database.ExecuteSqlRaw(createTableSql);
|
||||
}
|
||||
// // db.Database.ExecuteSqlRaw(createTableSql);
|
||||
// //}
|
||||
|
||||
if (!db.JumpLongPoints.Any())
|
||||
{
|
||||
db.JumpLongPoints.Add(new AiSportsMicrospaceDB.Entities.JumpLongPoints
|
||||
{
|
||||
Id = 1,
|
||||
TopPoint1 = new AiSportsMicrospaceDB.Entities.Point { X = 245, Y = 741 },
|
||||
TopPoint2 = new AiSportsMicrospaceDB.Entities.Point { X = 1498, Y = 730 },
|
||||
TopPoint3 = new AiSportsMicrospaceDB.Entities.Point { X = 1689, Y = 724 },
|
||||
BottomPoint1 = new AiSportsMicrospaceDB.Entities.Point { X = 191, Y = 918 },
|
||||
BottomPoint3 = new AiSportsMicrospaceDB.Entities.Point { X = 1722, Y = 909 },
|
||||
});
|
||||
db.SaveChanges();
|
||||
}
|
||||
//var mainWindow = new MainWindow(db);
|
||||
//mainWindow.Show();
|
||||
}
|
||||
// if (!db.JumpLongPoints.Any())
|
||||
// {
|
||||
// db.JumpLongPoints.Add(new AiSportsMicrospaceDB.Entities.JumpLongPoints
|
||||
// {
|
||||
// Id = 1,
|
||||
// TopPoint1 = new AiSportsMicrospaceDB.Entities.Point { X = 245, Y = 741 },
|
||||
// TopPoint2 = new AiSportsMicrospaceDB.Entities.Point { X = 1498, Y = 730 },
|
||||
// TopPoint3 = new AiSportsMicrospaceDB.Entities.Point { X = 1689, Y = 724 },
|
||||
// BottomPoint1 = new AiSportsMicrospaceDB.Entities.Point { X = 191, Y = 918 },
|
||||
// BottomPoint3 = new AiSportsMicrospaceDB.Entities.Point { X = 1722, Y = 909 },
|
||||
// });
|
||||
// db.SaveChanges();
|
||||
// }
|
||||
// //var mainWindow = new MainWindow(db);
|
||||
// //mainWindow.Show();
|
||||
//}
|
||||
|
||||
// 用 DI 创建窗口
|
||||
|
||||
|
||||
|
||||
var mainWin = AppHost.Services.GetRequiredService<Main>();
|
||||
Current.MainWindow = mainWin;
|
||||
mainWin.Show();
|
||||
@ -124,19 +132,19 @@ public partial class App : Application
|
||||
}
|
||||
|
||||
|
||||
private bool CheckTableExists(AppDbContext dbContext , String name)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 使用原始SQL检查表是否存在
|
||||
var sql = "SELECT count(*) FROM sqlite_master WHERE type='table' AND name=@name";
|
||||
var result = dbContext.Database.ExecuteSqlRaw(sql, new SqliteParameter("@name", name));
|
||||
return result > 0;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//private bool CheckTableExists(AppDbContext dbContext , String name)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// // 使用原始SQL检查表是否存在
|
||||
// var sql = "SELECT count(*) FROM sqlite_master WHERE type='table' AND name=@name";
|
||||
// var result = dbContext.Database.ExecuteSqlRaw(sql, new SqlServerParameter("@name", name));
|
||||
// return result > 0;
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
@ -1,12 +1,23 @@
|
||||
using System;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
|
||||
namespace Common
|
||||
{
|
||||
public static class AppSettings
|
||||
{
|
||||
public static string SchoolCode = "202501060001";
|
||||
public static string BackendUrl = "http://localhost:9991/api/StudentFace";
|
||||
public static string Code;
|
||||
public static string SchoolCode;
|
||||
public static string BackendUrl;
|
||||
|
||||
|
||||
public static void Init(IConfiguration configuration)
|
||||
{
|
||||
Code = configuration["Code"] ?? "";
|
||||
SchoolCode = configuration["SchoolCode"] ?? "";
|
||||
BackendUrl = configuration["BackendUrl"] ?? "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,12 +2,11 @@
|
||||
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Configuration>Debug</Configuration>
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Any CPU</Platform>
|
||||
<PublishDir>C:\Users\tangl\Desktop\exe</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<SelfContained>false</SelfContained>
|
||||
<PublishSingleFile>false</PublishSingleFile>
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using AiSportsMicrospaceDB.DBContext;
|
||||
using AiSportsMicrospaceDB.Entities;
|
||||
using Common;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.ML.Runtime;
|
||||
@ -64,12 +65,25 @@ namespace Wpf_AiSportsMicrospace
|
||||
_adminClickCount = 0;
|
||||
_resetTimer.Stop();
|
||||
};
|
||||
string projectRoot = Path.Combine(AppContext.BaseDirectory, @"..\..\..");
|
||||
string albumPath = Path.Combine(projectRoot, "Resources", "Img");
|
||||
|
||||
coverFlow.Images.Add(new CoverFlowItem { ImageUri = new Uri(Path.Combine(albumPath, "test_img/test_rope.png")), ProgressColor1 = "#215bc7", ProgressColor2 = "#fc640e" });
|
||||
coverFlow.Images.Add(new CoverFlowItem { ImageUri = new Uri(Path.Combine(albumPath, "play_img/play_music.png")), ProgressColor1 = "#e73d42", ProgressColor2 = "#fd8212" });
|
||||
coverFlow.Images.Add(new CoverFlowItem { ImageUri = new Uri(Path.Combine(albumPath, "Album/home_history.png")), ProgressColor1 = "#e73d42", ProgressColor2 = "#215bc7" });
|
||||
// --------------------- CoverFlow 加载 ---------------------
|
||||
coverFlow.Images.Add(new CoverFlowItem
|
||||
{
|
||||
ImageUri = GetResourceUri("test_img/test_rope.png"),
|
||||
ProgressColor1 = "#215bc7",
|
||||
ProgressColor2 = "#fc640e"
|
||||
});
|
||||
coverFlow.Images.Add(new CoverFlowItem
|
||||
{
|
||||
ImageUri = GetResourceUri("play_img/play_music.png"),
|
||||
ProgressColor1 = "#e73d42",
|
||||
ProgressColor2 = "#fd8212"
|
||||
});
|
||||
coverFlow.Images.Add(new CoverFlowItem
|
||||
{
|
||||
ImageUri = GetResourceUri("Album/home_history.png"),
|
||||
ProgressColor1 = "#e73d42",
|
||||
ProgressColor2 = "#215bc7"
|
||||
});
|
||||
|
||||
// 默认选中第3张
|
||||
coverFlow.SelectedIndex = 0;
|
||||
@ -274,7 +288,7 @@ namespace Wpf_AiSportsMicrospace
|
||||
var app = (App)Application.Current;
|
||||
using var scope = App.AppHost.Services.CreateScope();
|
||||
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
var baseData = await db.BasicConfig.FirstOrDefaultAsync();
|
||||
var baseData = await db.BasicConfig.FirstOrDefaultAsync(x=>x.Code==AppSettings.Code);
|
||||
if (baseData == null)
|
||||
{
|
||||
baseData = new BasicConfig { Id = 1 , Host = host.Text , UserName = name.Text , Password = password.Text};
|
||||
@ -349,5 +363,25 @@ namespace Wpf_AiSportsMicrospace
|
||||
else
|
||||
this.ShowError($"与相机通信失败,错误:{reply.Status}。");
|
||||
}
|
||||
|
||||
// 辅助方法:获取资源绝对 Uri,兼容 Debug 和 发布
|
||||
private static Uri GetResourceUri(string relativePath)
|
||||
{
|
||||
string baseDir = AppContext.BaseDirectory;
|
||||
|
||||
// 发布目录下路径
|
||||
string fullPath = Path.Combine(baseDir, "Resources", "Img", relativePath.Replace("/", Path.DirectorySeparatorChar.ToString()));
|
||||
|
||||
if (!File.Exists(fullPath))
|
||||
{
|
||||
#if DEBUG
|
||||
// Debug 下 fallback 到项目根目录
|
||||
string projectRoot = Path.Combine(baseDir, @"..\..\..");
|
||||
fullPath = Path.Combine(projectRoot, "Resources", "Img", relativePath.Replace("/", Path.DirectorySeparatorChar.ToString()));
|
||||
#endif
|
||||
}
|
||||
|
||||
return new Uri(fullPath, UriKind.Absolute);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using AiSportsMicrospaceDB.DBContext;
|
||||
using Common;
|
||||
using Dto;
|
||||
using Enum;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@ -262,7 +263,7 @@ namespace Views.JumpLong
|
||||
{
|
||||
countDown.Text = i.ToString() + "s";
|
||||
|
||||
if(i == 8)
|
||||
if (i == 8)
|
||||
{
|
||||
centerImg4.Visibility = Visibility.Hidden;
|
||||
centerImg3.Visibility = Visibility.Visible;
|
||||
@ -300,7 +301,7 @@ namespace Views.JumpLong
|
||||
var app = (App)Application.Current;
|
||||
using var scope = App.AppHost.Services.CreateScope();
|
||||
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
var points = db.JumpLongPoints.FirstOrDefault();
|
||||
var points = db.JumpLongPoints.FirstOrDefault(x => x.Code == AppSettings.Code);
|
||||
var boxes = new List<BoundingBox>()
|
||||
{
|
||||
new(){
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using AiSportsMicrospaceDB.DBContext;
|
||||
using Common;
|
||||
using Dto;
|
||||
using Emgu.CV.Flann;
|
||||
using Enum;
|
||||
@ -79,13 +80,13 @@ namespace Wpf_AiSportsMicrospace.Views
|
||||
var app = (App)Application.Current;
|
||||
using var scope = App.AppHost.Services.CreateScope();
|
||||
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
var cfg = await db.SixGroupPoints.FirstOrDefaultAsync();
|
||||
var cfg = await db.SixGroupPoints.FirstOrDefaultAsync(x=>x.Code==AppSettings.Code);
|
||||
//var pointlist = JsonSerializer.Deserialize<List<(double, double)>>(cfg!.PointsJson);
|
||||
|
||||
List<(double XNorm, double YNorm)> pointlist =
|
||||
[(cfg.point1.X, cfg.point1.Y),(cfg.point2.X, cfg.point2.Y),
|
||||
(cfg.point3.X, cfg.point3.Y), (cfg.point4.X, cfg.point4.Y),
|
||||
(cfg.point5.X, cfg.point5.Y),(cfg.point6.X, cfg.point6.Y)];
|
||||
[(cfg.Point1.X, cfg.Point1.Y),(cfg.Point2.X, cfg.Point2.Y),
|
||||
(cfg.Point3.X, cfg.Point3.Y), (cfg.Point4.X, cfg.Point4.Y),
|
||||
(cfg.Point5.X, cfg.Point5.Y),(cfg.Point6.X, cfg.Point6.Y)];
|
||||
_groupJumpRopeContext.CirclePositions = pointlist;
|
||||
|
||||
DrawCirclesWithText();
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using AiSportsMicrospaceDB.DBContext;
|
||||
using Common;
|
||||
using Dto;
|
||||
using Enum;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@ -86,10 +87,10 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope
|
||||
var app = (App)Application.Current;
|
||||
using var scope = App.AppHost.Services.CreateScope();
|
||||
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
var cfg = await db.SixGroupPoints.FirstOrDefaultAsync();
|
||||
var cfg = await db.SixGroupPoints.FirstOrDefaultAsync(x => x.Code == AppSettings.Code);
|
||||
//var pointlist = JsonSerializer.Deserialize<List<(double, double)>>(cfg!.PointsJson);
|
||||
|
||||
List<(double XNorm, double YNorm)> pointlist = [(cfg.point3.X, cfg.point3.Y),(cfg.point5.X, cfg.point5.Y)];
|
||||
List<(double XNorm, double YNorm)> pointlist = [(cfg.Point3.X, cfg.Point3.Y),(cfg.Point5.X, cfg.Point5.Y)];
|
||||
_musicJumpRopeContext.UpdateCirclePositions(pointlist);
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using AiSportsMicrospaceDB.DBContext;
|
||||
using Common;
|
||||
using Dto;
|
||||
using Enum;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@ -66,13 +67,13 @@ namespace Views.JumpingJack
|
||||
var app = (App)Application.Current;
|
||||
using var scope = App.AppHost.Services.CreateScope();
|
||||
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
var cfg = await db.SixGroupPoints.FirstOrDefaultAsync();
|
||||
var cfg = await db.SixGroupPoints.FirstOrDefaultAsync(x => x.Code == AppSettings.Code);
|
||||
//var pointlist = JsonSerializer.Deserialize<List<(double, double)>>(cfg!.PointsJson);
|
||||
|
||||
List<(double XNorm, double YNorm)> pointlist =
|
||||
[(cfg.point1.X, cfg.point1.Y),(cfg.point2.X, cfg.point2.Y),
|
||||
(cfg.point3.X, cfg.point3.Y), (cfg.point4.X, cfg.point4.Y),
|
||||
(cfg.point5.X, cfg.point5.Y),(cfg.point6.X, cfg.point6.Y)];
|
||||
[(cfg.Point1.X, cfg.Point1.Y),(cfg.Point2.X, cfg.Point2.Y),
|
||||
(cfg.Point3.X, cfg.Point3.Y), (cfg.Point4.X, cfg.Point4.Y),
|
||||
(cfg.Point5.X, cfg.Point5.Y),(cfg.Point6.X, cfg.Point6.Y)];
|
||||
_groupJumpRopeContext.CirclePositions = pointlist;
|
||||
|
||||
DrawCirclesWithText();
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using AiSportsMicrospaceDB.DBContext;
|
||||
using AiSportsMicrospaceDB.Entities;
|
||||
using Common;
|
||||
using Emgu.CV.Reg;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@ -205,7 +206,8 @@ namespace Wpf_AiSportsMicrospace.Views
|
||||
var app = (App)Application.Current;
|
||||
using var scope = App.AppHost.Services.CreateScope();
|
||||
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
var pointsData = db.JumpLongPoints.FirstOrDefault();
|
||||
var pointsData = db.JumpLongPoints.FirstOrDefault(x => x.Code == AppSettings.Code);
|
||||
|
||||
if (pointsData == null)
|
||||
{
|
||||
pointsData = new JumpLongPoints { Id = 1 };
|
||||
@ -376,7 +378,7 @@ namespace Wpf_AiSportsMicrospace.Views
|
||||
var app = (App)Application.Current;
|
||||
using var scope = App.AppHost.Services.CreateScope();
|
||||
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
var pointsData = db.JumpLongPoints.FirstOrDefault();
|
||||
var pointsData = db.JumpLongPoints.FirstOrDefault(x => x.Code == AppSettings.Code);
|
||||
if (pointsData == null)
|
||||
{
|
||||
pointsData = new JumpLongPoints { Id = 1 };
|
||||
@ -384,7 +386,6 @@ namespace Wpf_AiSportsMicrospace.Views
|
||||
}
|
||||
var defaultPoints = new JumpLongPoints
|
||||
{
|
||||
Id = 1,
|
||||
TopPoint1 = new AiSportsMicrospaceDB.Entities.Point { X = 245, Y = 741 },
|
||||
TopPoint2 = new AiSportsMicrospaceDB.Entities.Point { X = 1498, Y = 730 },
|
||||
TopPoint3 = new AiSportsMicrospaceDB.Entities.Point { X = 1689, Y = 724 },
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using AiSportsMicrospaceDB.DBContext;
|
||||
using Common;
|
||||
using Dto;
|
||||
using Enum;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@ -59,13 +60,13 @@ namespace Views.SquatFu
|
||||
var app = (App)Application.Current;
|
||||
using var scope = App.AppHost.Services.CreateScope();
|
||||
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
var cfg = await db.SixGroupPoints.FirstOrDefaultAsync();
|
||||
var cfg = await db.SixGroupPoints.FirstOrDefaultAsync(x => x.Code == AppSettings.Code);
|
||||
//var pointlist = JsonSerializer.Deserialize<List<(double, double)>>(cfg!.PointsJson);
|
||||
|
||||
List<(double XNorm, double YNorm)> pointlist =
|
||||
[(cfg.point1.X, cfg.point1.Y),(cfg.point2.X, cfg.point2.Y),
|
||||
(cfg.point3.X, cfg.point3.Y), (cfg.point4.X, cfg.point4.Y),
|
||||
(cfg.point5.X, cfg.point5.Y),(cfg.point6.X, cfg.point6.Y)];
|
||||
[(cfg.Point1.X, cfg.Point1.Y),(cfg.Point2.X, cfg.Point2.Y),
|
||||
(cfg.Point3.X, cfg.Point3.Y), (cfg.Point4.X, cfg.Point4.Y),
|
||||
(cfg.Point5.X, cfg.Point5.Y),(cfg.Point6.X, cfg.Point6.Y)];
|
||||
_groupJumpRopeContext.CirclePositions = pointlist;
|
||||
|
||||
DrawCirclesWithText();
|
||||
|
||||
@ -224,7 +224,7 @@
|
||||
<PackageReference Include="FFmpeg.AutoGen.Bindings.DynamicallyLoaded" Version="7.1.1" />
|
||||
<PackageReference Include="HandyControl" Version="3.5.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.10" />
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Data Source=AiSportsMicrospaceDB.db"
|
||||
}
|
||||
"DefaultConnection": "Data Source=rm-uf64b8oxdt19pfyxfao.sqlserver.rds.aliyuncs.com;Database=AiSportsMicrospaceDB_QA;User ID=qa;Password=Admin@123;Connect Timeout=500;TrustServerCertificate=True;"
|
||||
},
|
||||
"Code": "04-68-74-3F-87-72",
|
||||
"SchoolCode": "202501060001",
|
||||
"BackendUrl": "http://localhost:9991/api/StudentFace"
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user