Skip to content

Commit 93d05ab

Browse files
Merge pull request #1 from SyncfusionExamples/Add_Sample
Added ECG Monitoring Dashboard Sample
2 parents 469b895 + 6a28cf6 commit 93d05ab

File tree

12 files changed

+693
-2
lines changed

12 files changed

+693
-2
lines changed

ECGMonitor/ECGMonitor.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.14.36202.13 d17.14
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ECGMonitor", "ECGMonitor\ECGMonitor.csproj", "{8634E715-C06E-4D2F-AB2F-FC3788E49B83}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{8634E715-C06E-4D2F-AB2F-FC3788E49B83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{8634E715-C06E-4D2F-AB2F-FC3788E49B83}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{8634E715-C06E-4D2F-AB2F-FC3788E49B83}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{8634E715-C06E-4D2F-AB2F-FC3788E49B83}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {DD59CB08-08B5-44F2-A4F3-9DC85D5FA175}
24+
EndGlobalSection
25+
EndGlobal

ECGMonitor/ECGMonitor/App.xaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application x:Class="ECGMonitor.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:ECGMonitor"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</Application>

ECGMonitor/ECGMonitor/App.xaml.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Configuration;
2+
using System.Data;
3+
using System.Windows;
4+
5+
namespace ECGMonitor
6+
{
7+
/// <summary>
8+
/// Interaction logic for App.xaml
9+
/// </summary>
10+
public partial class App : Application
11+
{
12+
}
13+
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Windows;
2+
3+
[assembly: ThemeInfo(
4+
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5+
//(used if a resource is not found in the page,
6+
// or application resource dictionaries)
7+
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8+
//(used if a resource is not found in the page,
9+
// app, or any theme specific resource dictionaries)
10+
)]
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>WinExe</OutputType>
5+
<TargetFramework>net9.0-windows</TargetFramework>
6+
<Nullable>enable</Nullable>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<UseWPF>true</UseWPF>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.SfChart.WPF" Version="*" />
13+
<PackageReference Include="Syncfusion.Shared.WPF" Version="*" />
14+
</ItemGroup>
15+
16+
<ItemGroup>
17+
<Resource Include="Images\electrocardiogram.png">
18+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
19+
</Resource>
20+
<Resource Include="Images\export.png">
21+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
22+
</Resource>
23+
</ItemGroup>
24+
25+
</Project>
22.8 KB
Loading
2.37 KB
Loading

ECGMonitor/ECGMonitor/MainWindow.xaml

Lines changed: 298 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
using ECGMonitor.ViewModel;
2+
using Microsoft.Win32;
3+
using System.IO;
4+
using System.Windows;
5+
using System.Windows.Media;
6+
using System.Windows.Media.Imaging;
7+
8+
namespace ECGMonitor
9+
{
10+
/// <summary>
11+
/// Interaction logic for MainWindow.xaml
12+
/// </summary>
13+
public partial class MainWindow : Window
14+
{
15+
private readonly ECGMonitorViewModel _viewModel;
16+
17+
public MainWindow()
18+
{
19+
InitializeComponent();
20+
InitializePathData(); // Initialize geometric data for paths
21+
_viewModel = new ECGMonitorViewModel();
22+
DataContext = _viewModel;
23+
this.Loaded += RealTimeChart_Loaded; // Set up event handler for loading
24+
this.Unloaded += RealTimeChart_Unloaded; // Set up event handler for unloading
25+
}
26+
27+
// Initialize geometry paths for data visualization
28+
private void InitializePathData()
29+
{
30+
QrsDuration.Data = Geometry.Parse("M13.983002,0L18.080017,11.520997 19.231018,8.736001 32,8.736001 32,10.720002 20.575989,10.720002 17.951996,17.087999 13.983002,6.047997 12.287994,11.008004 0,11.008004 0,8.9919978 10.847015,8.9919978z");
31+
QtInterval.Data = Geometry.Parse("M21.439009,0L24.41601,8.5440002 26.209011,8.5440002 26.240011,8.4800003C26.474011,7.926 26.837011,7.4829999 27.328011,7.152 27.818011,6.822 28.373012,6.6559999 28.992012,6.6560001 29.845012,6.678 30.554013,6.9659998 31.121013,7.5209998 31.685013,8.075 31.968013,8.779 31.968013,9.6329999 31.968013,10.486 31.685013,11.195 31.121013,11.761 30.554013,12.326 29.845012,12.619 28.992012,12.641 28.330012,12.641 27.753011,12.459 27.263011,12.097 26.773011,11.734 26.410011,11.265 26.17501,10.688L26.14401,10.561 23.00701,10.561 21.472009,6.2080002 17.824007,17.152 15.328006,10.561 0,10.561 0,8.5440002 16.736007,8.5440002 17.728007,11.2z");
32+
PrInterval.Data = Geometry.Parse("M10.527002,0L14.239001,11.200005 15.230997,8.5439988 31.966999,8.5439988 31.966999,10.561005 16.639002,10.561005 14.143,17.152001 10.494996,6.2080003 8.9600003,10.561005 5.8229988,10.561005 5.7920005,10.656006C5.577996,11.254006 5.2200019,11.734001 4.7189949,12.097 4.216996,12.459 3.6359944,12.640999 2.9749985,12.640999 2.1219943,12.619003 1.4119951,12.326004 0.84700024,11.761002 0.28199771,11.195 0,10.486 0,9.6330033 0,8.7789994 0.28199771,8.0750047 0.84700024,7.5210038 1.4119951,6.9660035 2.1219943,6.6669999 2.9749985,6.6240007 3.5929952,6.6460038 4.1479957,6.8219987 4.6390007,7.1520005 5.129998,7.4830018 5.4919975,7.9260026 5.7269981,8.4800035L5.7589958,8.5439988 7.5509956,8.5439988z");
33+
heartRate.Data = Geometry.Parse("M23.370204,1.8672515C21.294372,1.9053352,18.976663,2.8856077,16.599092,4.7651081L16.015115,5.2261047 15.432115,4.7651081C13.059161,2.8901167 10.673175,1.9241176 8.5431991,1.9241178 7.446229,1.9241176 6.416244,2.1801283 5.4912381,2.6991081 2.9072883,4.1470995 1.5222969,7.4460959 1.9643076,11.100071 2.7172883,17.337043 13.615153,26.253016 16.02012,28.020984 18.452095,26.261012 29.497936,17.341041 30.063938,11.128086 30.415924,7.2730923 29.013935,4.0011039 26.406974,2.5891233 25.478523,2.0858686 24.457546,1.8473029 23.370204,1.8672515z M23.381185,0.0013699633C24.778831,-0.02325648 26.102981,0.28400741 27.302959,0.93312485 30.582914,2.7111013 32.359897,6.6820917 31.938913,11.299075 31.216907,19.22305 17.355093,29.538983 16.454105,29.984996L16.093116,30.221993 15.972116,30.219003 15.599104,29.995982C14.876123,29.658977 1.0503184,19.237027 0.09433749,11.32709 -0.43867542,6.9110947 1.3183202,2.8801069 4.5712676,1.0571169 7.8332172,-0.77685892 11.97516,-0.11887239 16.015115,2.8441267 18.518211,1.0053749 21.051775,0.042413725 23.381185,0.0013699633z");
34+
bodyTemperature.Data = Geometry.Parse("M15.003009,15.000008L18.998976,15.000008 18.998976,17.000008 15.003009,17.000008z M15.003009,11.000008L21.998976,11.000008 21.998976,13.000008 15.003009,13.000008z M15.003009,7.0000076L18.998976,7.0000076 18.998976,9.0000076 15.003009,9.0000076z M8.0010233,4.9999857C8.5540237,4.9999857,9.0010233,5.4469857,9.0010233,5.9999862L9.0010233,22.091722 9.0849628,22.130604C9.9229069,22.544302 10.500984,23.422686 10.500984,24.439003 10.500984,25.853008 9.3819847,27.000013 8.0009842,27.000013 6.6199846,27.000013 5.5009847,25.853008 5.5009847,24.439003 5.5009847,23.422686 6.079062,22.544302 6.9170055,22.130604L7.0010233,22.091686 7.0010233,5.9999862C7.0010233,5.4469857,7.4480233,4.9999857,8.0010233,4.9999857z M15.003009,3.0000076L21.998976,3.0000076 21.998976,5.0000076 15.003009,5.0000076z M7.8909912,2C6.2440186,2,5,3.2330017,5,4.8700256L5,19.054016 4.5579834,19.443024C2.9320068,20.534027 2,22.264008 2,24.187012 2,27.393005 4.7030029,30 8.0239868,30 11.375,30 14,27.446014 14,24.187012 14,22.165009 13.099976,20.482025 11.466003,19.447998L11,19.154022 11,4.8700256C11,3.3140259,9.5769653,2,7.8909912,2z M7.8909912,0C10.708008,0,13,2.1850281,13,4.8700256L13,18.077026C14.914001,19.494019 16,21.690002 16,24.187012 16,28.495026 12.421997,32 8.0239868,32 3.5999756,32 0,28.495026 0,24.187012 0,21.805023 1.1129761,19.568024 3,18.103027L3,4.8700256C3,2.1400146,5.1489868,0,7.8909912,0z");
35+
bloodPressure.Data = Geometry.Parse("M15.06596,15.025998L17.06596,15.025998 17.06596,17.025999 19.066,17.025999 19.066,19.025999 17.06596,19.025999 17.06596,21.025998 15.06596,21.025998 15.06596,19.025999 13.066,19.025999 13.066,17.025999 15.06596,17.025999z M15.983973,7.8379803C13.226962,10.592976 9.871948,15.420967 9.8719482,18.569962 9.871948,21.949956 12.620959,24.699951 16.000973,24.699951 19.379986,24.699951 22.129997,21.949956 22.129997,18.569962 22.129997,15.294968 18.672984,10.616976 15.983973,7.8379803z M16.020973,5.0739851L16.693975,5.7209845C19.455986,8.37498 24.130006,14.06897 24.130006,18.569962 24.130006,23.052954 20.482991,26.699948 16.000973,26.699948 11.517955,26.699948 7.8719401,23.052954 7.8719401,18.569962 7.8719401,13.94197 12.89596,7.8999805 15.32997,5.6999846z M16,1.999999C8.2800002,1.999999 2,8.2799988 2,15.999999 2,23.719999 8.2800002,29.999999 16,29.999999 23.72,29.999999 30,23.719999 30,15.999999 30,8.2799988 23.72,1.999999 16,1.999999z M16,0C24.822,0 32,7.1779995 32,15.999999 32,24.821999 24.822,31.999999 16,31.999999 7.178,31.999999 0,24.821999 0,15.999999 0,7.1779995 7.178,0 16,0z");
36+
}
37+
38+
// Event handler for when the real-time chart is loaded
39+
private void RealTimeChart_Loaded(object sender, System.Windows.RoutedEventArgs e)
40+
{
41+
_viewModel.StopTimer(); // Ensure reset
42+
_viewModel.StartTimer(); // Start on load
43+
}
44+
45+
// Event handler for when the real-time chart is unloaded
46+
private void RealTimeChart_Unloaded(object sender, System.Windows.RoutedEventArgs e)
47+
{
48+
_viewModel.StopTimer(); // Stop on unload
49+
}
50+
51+
// Save the chart as an image file
52+
private void Button_Click(object sender, RoutedEventArgs e)
53+
{
54+
55+
if (this.chart != null)
56+
{
57+
SaveFileDialog sfd = new SaveFileDialog
58+
{
59+
FileName = "Untitled",
60+
Filter = "Bitmap(*.bmp)|*.bmp|JPEG(*.jpg,*.jpeg)|*.jpg;*.jpeg|Gif (*.gif)|*.gif|PNG(*.png)|*.png|All files (*.*)|*.*"
61+
};
62+
if (sfd.ShowDialog() == true)
63+
{
64+
using (Stream fs = sfd.OpenFile())
65+
{
66+
this.chart.Save(fs, new PngBitmapEncoder());
67+
}
68+
}
69+
}
70+
}
71+
}
72+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
namespace ECGMonitor.ViewModel
2+
{
3+
public class ECGDataPoint
4+
{
5+
public float Time { get; set; } // Time in seconds
6+
public float Voltage { get; set; } // ECG voltage in millivolts
7+
8+
public ECGDataPoint(float time, float voltage)
9+
{
10+
Time = time;
11+
Voltage = voltage;
12+
}
13+
}
14+
15+
}

0 commit comments

Comments
 (0)