feat: 重构项目结构,添加 WPF 应用
- 将核心功能提取到 WCTDataMiner.Core 类库 - 添加 WCTDataMiner.Wpf 桌面应用 - 支持数据解析、导出、统计等功能 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
54
src/WCTDataMiner.Wpf/ViewModels/MainViewModel.cs
Normal file
54
src/WCTDataMiner.Wpf/ViewModels/MainViewModel.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
namespace WCTDataMiner.Wpf.ViewModels;
|
||||
|
||||
/// <summary>
|
||||
/// 主窗口 ViewModel - 导航控制
|
||||
/// </summary>
|
||||
public partial class MainViewModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private ObservableObject _currentView = null!;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? _selectedTxPanel;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? _selectedTxHardware;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? _selectedTxSoftware;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? _selectedRxType;
|
||||
|
||||
// 筛选选项列表
|
||||
public List<string> TxPanels { get; } = new() { "全部", "singleMold", "dualMold" };
|
||||
public List<string> TxHardwares { get; } = new() { "全部", "v1.0", "v2.0" };
|
||||
public List<string> TxSoftwares { get; } = new() { "全部", "hex2_1", "hex2_2" };
|
||||
public List<string> RxTypes { get; } = new() { "全部", "iPhone15", "iPhone16", "Android" };
|
||||
|
||||
public MainViewModel()
|
||||
{
|
||||
_currentView = new ScenarioListViewModel();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void NavigateToScenarios()
|
||||
{
|
||||
CurrentView = new ScenarioListViewModel();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void NavigateToPlossChart(int scenarioId)
|
||||
{
|
||||
CurrentView = new PlossChartViewModel { ScenarioId = scenarioId };
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void NavigateToQfodChart(int scenarioId)
|
||||
{
|
||||
CurrentView = new QfodChartViewModel { ScenarioId = scenarioId };
|
||||
}
|
||||
}
|
||||
49
src/WCTDataMiner.Wpf/ViewModels/PlossChartViewModel.cs
Normal file
49
src/WCTDataMiner.Wpf/ViewModels/PlossChartViewModel.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using LiveChartsCore;
|
||||
using LiveChartsCore.SkiaSharpView;
|
||||
|
||||
namespace WCTDataMiner.Wpf.ViewModels;
|
||||
|
||||
/// <summary>
|
||||
/// Ploss 折线图 ViewModel
|
||||
/// </summary>
|
||||
public partial class PlossChartViewModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private int _scenarioId;
|
||||
|
||||
[ObservableProperty]
|
||||
private ISeries[] _series;
|
||||
|
||||
[ObservableProperty]
|
||||
private Axis[] _xAxes;
|
||||
|
||||
[ObservableProperty]
|
||||
private Axis[] _yAxes;
|
||||
|
||||
public PlossChartViewModel()
|
||||
{
|
||||
// 初始化图表配置
|
||||
Series = Array.Empty<ISeries>();
|
||||
XAxes = new Axis[] { new Axis { Name = "Trigger Count" } };
|
||||
YAxes = new Axis[] { new Axis { Name = "Power Loss (mW)" } };
|
||||
}
|
||||
|
||||
public async Task LoadDataAsync()
|
||||
{
|
||||
// TODO: 从数据库加载 Ploss 数据并构建图表
|
||||
Series = new ISeries[]
|
||||
{
|
||||
new LineSeries<double>
|
||||
{
|
||||
Name = "Ploss",
|
||||
Values = new double[] { -2882, -3500, -4200, -3800, -4500 }
|
||||
},
|
||||
new LineSeries<double>
|
||||
{
|
||||
Name = "Threshold",
|
||||
Values = new double[] { -3000, -3000, -3000, -3000, -3000 }
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
49
src/WCTDataMiner.Wpf/ViewModels/QfodChartViewModel.cs
Normal file
49
src/WCTDataMiner.Wpf/ViewModels/QfodChartViewModel.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using LiveChartsCore;
|
||||
using LiveChartsCore.SkiaSharpView;
|
||||
|
||||
namespace WCTDataMiner.Wpf.ViewModels;
|
||||
|
||||
/// <summary>
|
||||
/// Qfod 折线图 ViewModel
|
||||
/// </summary>
|
||||
public partial class QfodChartViewModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private int _scenarioId;
|
||||
|
||||
[ObservableProperty]
|
||||
private ISeries[] _series;
|
||||
|
||||
[ObservableProperty]
|
||||
private Axis[] _xAxes;
|
||||
|
||||
[ObservableProperty]
|
||||
private Axis[] _yAxes;
|
||||
|
||||
public QfodChartViewModel()
|
||||
{
|
||||
// 初始化图表配置
|
||||
Series = Array.Empty<ISeries>();
|
||||
XAxes = new Axis[] { new Axis { Name = "Coil Index" } };
|
||||
YAxes = new Axis[] { new Axis { Name = "Q Value" } };
|
||||
}
|
||||
|
||||
public async Task LoadDataAsync()
|
||||
{
|
||||
// TODO: 从数据库加载 Qfod 数据并构建图表
|
||||
Series = new ISeries[]
|
||||
{
|
||||
new LineSeries<double>
|
||||
{
|
||||
Name = "DeltaQ",
|
||||
Values = new double[] { 25, 30, 28 }
|
||||
},
|
||||
new LineSeries<double>
|
||||
{
|
||||
Name = "CurrentQ",
|
||||
Values = new double[] { 45.5, 50.2, 48.8 }
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
36
src/WCTDataMiner.Wpf/ViewModels/ScenarioListViewModel.cs
Normal file
36
src/WCTDataMiner.Wpf/ViewModels/ScenarioListViewModel.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace WCTDataMiner.Wpf.ViewModels;
|
||||
|
||||
/// <summary>
|
||||
/// 场景列表 ViewModel
|
||||
/// </summary>
|
||||
public partial class ScenarioListViewModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private List<ScenarioItem> _scenarios;
|
||||
|
||||
[ObservableProperty]
|
||||
private ScenarioItem? _selectedScenario;
|
||||
|
||||
public ScenarioListViewModel()
|
||||
{
|
||||
// TODO: 从数据库加载场景列表
|
||||
_scenarios = new List<ScenarioItem>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 场景项数据模型
|
||||
/// </summary>
|
||||
public class ScenarioItem
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string TxPanel { get; set; } = "";
|
||||
public string TxHardware { get; set; } = "";
|
||||
public string TxSoftware { get; set; } = "";
|
||||
public string RxType { get; set; } = "";
|
||||
public string TestDate { get; set; } = "";
|
||||
public int QfodCount { get; set; }
|
||||
public int PlossCount { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user