mirror of
https://github.com/dotMorten/NmeaParser.git
synced 2026-01-09 18:20:17 +01:00
Improved sample app
This commit is contained in:
parent
f91809f8e5
commit
a3e63a1111
|
|
@ -64,11 +64,11 @@ namespace NmeaParser.Nmea.Gps
|
|||
/// <summary>
|
||||
/// Name of origin
|
||||
/// </summary>
|
||||
public string OriginId { get; set; }
|
||||
public string OriginId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of destination
|
||||
/// </summary>
|
||||
public string DestinationId { get; set; }
|
||||
public string DestinationId { get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,11 +137,11 @@ namespace NmeaParser.Nmea.Gps
|
|||
/// <summary>
|
||||
/// Time since last DGPS update
|
||||
/// </summary>
|
||||
public TimeSpan TimeSinceLastDgpsUpdate { get; set; }
|
||||
public TimeSpan TimeSinceLastDgpsUpdate { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// DGPS Station ID Number
|
||||
/// </summary>
|
||||
public int DgpsStationId { get; set; }
|
||||
public int DgpsStationId { get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
38
src/SampleApp.WinDesktop/GpggaControl.xaml
Normal file
38
src/SampleApp.WinDesktop/GpggaControl.xaml
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<UserControl x:Class="SampleApp.WinDesktop.GpggaControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:SampleApp.WinDesktop"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<StackPanel DataContext="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=Message}">
|
||||
<Border Background="CornflowerBlue" Padding="10" Margin="-10,-10,-10,5">
|
||||
<TextBlock Text="GPGGA" FontSize="20" FontWeight="Bold" Foreground="White" />
|
||||
</Border>
|
||||
<TextBlock Text="Location:" FontWeight="Bold" />
|
||||
<TextBlock Text="{Binding Latitude, Mode=OneTime}" />
|
||||
<TextBlock Text="{Binding Longitude, Mode=OneTime}" />
|
||||
<local:KeyValuePairControl Header="Quality: " Value="{Binding Quality, Mode=OneTime}" />
|
||||
<local:KeyValuePairControl Header="Number of satellites: " Value="{Binding NumberOfSatellites, Mode=OneTime}" />
|
||||
<local:KeyValuePairControl Header="HDOP: " Value="{Binding Hdop, Mode=OneTime}" />
|
||||
<local:KeyValuePairControl Header="Altitude: " >
|
||||
<local:KeyValuePairControl.Value>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Altitude}" />
|
||||
<TextBlock Text="{Binding AltitudeUnits}" />
|
||||
</StackPanel>
|
||||
</local:KeyValuePairControl.Value>
|
||||
</local:KeyValuePairControl>
|
||||
<local:KeyValuePairControl Header="Height of Geoid: ">
|
||||
<local:KeyValuePairControl.Value>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding HeightOfGeoid}" />
|
||||
<TextBlock Text="{Binding HeightOfGeoidUnits}" />
|
||||
</StackPanel>
|
||||
</local:KeyValuePairControl.Value>
|
||||
</local:KeyValuePairControl>
|
||||
<local:KeyValuePairControl Header="Last DGPS update: " Value="{Binding TimeSinceLastDgpsUpdate, Mode=OneTime}" />
|
||||
<local:KeyValuePairControl Header="DGPS ID: " Value="{Binding DgpsStationId, Mode=OneTime}" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
38
src/SampleApp.WinDesktop/GpggaControl.xaml.cs
Normal file
38
src/SampleApp.WinDesktop/GpggaControl.xaml.cs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
using NmeaParser.Nmea.Gps;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace SampleApp.WinDesktop
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for GpggaControl.xaml
|
||||
/// </summary>
|
||||
public partial class GpggaControl : UserControl
|
||||
{
|
||||
public GpggaControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public Gpgga Message
|
||||
{
|
||||
get { return (Gpgga)GetValue(GpggaProperty); }
|
||||
set { SetValue(GpggaProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty GpggaProperty =
|
||||
DependencyProperty.Register("Message", typeof(Gpgga), typeof(GpggaControl), new PropertyMetadata(null));
|
||||
}
|
||||
}
|
||||
24
src/SampleApp.WinDesktop/GpgllControl.xaml
Normal file
24
src/SampleApp.WinDesktop/GpgllControl.xaml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<UserControl x:Class="SampleApp.WinDesktop.GpgllControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:SampleApp.WinDesktop"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<StackPanel DataContext="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=Message}">
|
||||
<Border Background="CornflowerBlue" Padding="10" Margin="-10,-10,-10,5">
|
||||
<TextBlock Text="GPGLL" FontSize="20" FontWeight="Bold" Foreground="White" />
|
||||
</Border>
|
||||
<TextBlock Text="Location:" FontWeight="Bold" />
|
||||
<TextBlock Text="{Binding Latitude, Mode=OneTime}" />
|
||||
<TextBlock Text="{Binding Longitude, Mode=OneTime}" />
|
||||
<TextBlock Text="Time:" FontWeight="Bold" />
|
||||
<TextBlock Text="{Binding FixTime, Mode=OneTime}" />
|
||||
<local:KeyValuePairControl Header="Data active: " FontWeight="Bold" >
|
||||
<local:KeyValuePairControl.Value>
|
||||
<CheckBox IsChecked="{Binding DataActive, Mode=OneTime}" IsEnabled="False" />
|
||||
</local:KeyValuePairControl.Value>
|
||||
</local:KeyValuePairControl>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
38
src/SampleApp.WinDesktop/GpgllControl.xaml.cs
Normal file
38
src/SampleApp.WinDesktop/GpgllControl.xaml.cs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
using NmeaParser.Nmea.Gps;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace SampleApp.WinDesktop
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for GpgllControl.xaml
|
||||
/// </summary>
|
||||
public partial class GpgllControl : UserControl
|
||||
{
|
||||
public GpgllControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public Gpgll Message
|
||||
{
|
||||
get { return (Gpgll)GetValue(MessageProperty); }
|
||||
set { SetValue(MessageProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty MessageProperty =
|
||||
DependencyProperty.Register("Message", typeof(Gpgll), typeof(GpgllControl), new PropertyMetadata(null));
|
||||
}
|
||||
}
|
||||
20
src/SampleApp.WinDesktop/GpgsaControl.xaml
Normal file
20
src/SampleApp.WinDesktop/GpgsaControl.xaml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<UserControl x:Class="SampleApp.WinDesktop.GpgsaControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:SampleApp.WinDesktop"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<StackPanel DataContext="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=Message}">
|
||||
<Border Background="CornflowerBlue" Padding="10" Margin="-10,-10,-10,5">
|
||||
<TextBlock Text="GPGSA" FontSize="20" FontWeight="Bold" Foreground="White" />
|
||||
</Border>
|
||||
<local:KeyValuePairControl Header="GPS Mode: " Value="{Binding GpsMode}"/>
|
||||
<local:KeyValuePairControl Header="Fix Mode: " Value="{Binding FixMode, Mode=OneTime}" />
|
||||
<local:KeyValuePairControl Header="Satellite vehicles: " Value="{Binding SVs, Mode=OneTime}" />
|
||||
<local:KeyValuePairControl Header="HDOP: " Value="{Binding Hdop, Mode=OneTime}" />
|
||||
<local:KeyValuePairControl Header="VDOP: " Value="{Binding Vdop, Mode=OneTime}" />
|
||||
<local:KeyValuePairControl Header="PDOP: " Value="{Binding Pdop, Mode=OneTime}" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
38
src/SampleApp.WinDesktop/GpgsaControl.xaml.cs
Normal file
38
src/SampleApp.WinDesktop/GpgsaControl.xaml.cs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
using NmeaParser.Nmea.Gps;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace SampleApp.WinDesktop
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for GpgsaControl.xaml
|
||||
/// </summary>
|
||||
public partial class GpgsaControl : UserControl
|
||||
{
|
||||
public GpgsaControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public Gpgsa Message
|
||||
{
|
||||
get { return (Gpgsa)GetValue(GpgsaProperty); }
|
||||
set { SetValue(GpgsaProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty GpgsaProperty =
|
||||
DependencyProperty.Register("Message", typeof(Gpgsa), typeof(GpgsaControl), new PropertyMetadata(null));
|
||||
}
|
||||
}
|
||||
26
src/SampleApp.WinDesktop/GprmcControl.xaml
Normal file
26
src/SampleApp.WinDesktop/GprmcControl.xaml
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<UserControl x:Class="SampleApp.WinDesktop.GprmcControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:SampleApp.WinDesktop"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<StackPanel DataContext="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=Message}">
|
||||
<Border Background="CornflowerBlue" Padding="10" Margin="-10,-10,-10,5">
|
||||
<TextBlock Text="GPRMC" FontSize="20" FontWeight="Bold" Foreground="White" />
|
||||
</Border>
|
||||
<TextBlock Text="Location:" FontWeight="Bold" />
|
||||
<TextBlock Text="{Binding Latitude, Mode=OneTime}" />
|
||||
<TextBlock Text="{Binding Longitude, Mode=OneTime}" />
|
||||
<local:KeyValuePairControl Header="Speed: " Value="{Binding Speed, Mode=OneTime}" />
|
||||
<local:KeyValuePairControl Header="Magnetic Variation: " Value="{Binding MagneticVariation, Mode=OneTime}" />
|
||||
<TextBlock Text="Time: " FontWeight="Bold" />
|
||||
<TextBlock Text="{Binding FixTime, Mode=OneTime}" />
|
||||
<local:KeyValuePairControl Header="Active: " FontWeight="Bold" >
|
||||
<local:KeyValuePairControl.Value>
|
||||
<CheckBox IsChecked="{Binding Active, Mode=OneTime}" IsEnabled="False" />
|
||||
</local:KeyValuePairControl.Value>
|
||||
</local:KeyValuePairControl>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
38
src/SampleApp.WinDesktop/GprmcControl.xaml.cs
Normal file
38
src/SampleApp.WinDesktop/GprmcControl.xaml.cs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
using NmeaParser.Nmea.Gps;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace SampleApp.WinDesktop
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for GprmcControl.xaml
|
||||
/// </summary>
|
||||
public partial class GprmcControl : UserControl
|
||||
{
|
||||
public GprmcControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public Gprmc Message
|
||||
{
|
||||
get { return (Gprmc)GetValue(MessageProperty); }
|
||||
set { SetValue(MessageProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty MessageProperty =
|
||||
DependencyProperty.Register("Message", typeof(Gprmc), typeof(GprmcControl), new PropertyMetadata(null));
|
||||
}
|
||||
}
|
||||
12
src/SampleApp.WinDesktop/KeyValuePairControl.xaml
Normal file
12
src/SampleApp.WinDesktop/KeyValuePairControl.xaml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<UserControl x:Class="SampleApp.WinDesktop.KeyValuePairControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock FontWeight="Bold" Text="{Binding Header, RelativeSource={RelativeSource AncestorType=UserControl}}" />
|
||||
<ContentControl Content="{Binding Value, RelativeSource={RelativeSource AncestorType=UserControl}}" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
50
src/SampleApp.WinDesktop/KeyValuePairControl.xaml.cs
Normal file
50
src/SampleApp.WinDesktop/KeyValuePairControl.xaml.cs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace SampleApp.WinDesktop
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for KeyValuePairControl.xaml
|
||||
/// </summary>
|
||||
public partial class KeyValuePairControl : UserControl
|
||||
{
|
||||
public KeyValuePairControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
public string Header
|
||||
{
|
||||
get { return (string)GetValue(HeaderProperty); }
|
||||
set { SetValue(HeaderProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty HeaderProperty =
|
||||
DependencyProperty.Register("Header", typeof(string), typeof(KeyValuePairControl), new PropertyMetadata(null));
|
||||
|
||||
|
||||
|
||||
public object Value
|
||||
{
|
||||
get { return (object)GetValue(ValueProperty); }
|
||||
set { SetValue(ValueProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ValueProperty =
|
||||
DependencyProperty.Register("Value", typeof(object), typeof(KeyValuePairControl), new PropertyMetadata(null));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -2,16 +2,32 @@
|
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:SampleApp.WinDesktop"
|
||||
Title="Sample App" Height="450" Width="525">
|
||||
Title="Sample App" Height="500" Width="625">
|
||||
<Grid>
|
||||
<Grid.Resources>
|
||||
<Style TargetType="UserControl" x:Key="card">
|
||||
<Setter Property="Margin" Value="10" />
|
||||
<Setter Property="Padding" Value="10" />
|
||||
<Setter Property="Background" Value="White" />
|
||||
<Setter Property="Effect">
|
||||
<Setter.Value>
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0"
|
||||
BlurRadius="20" Opacity=".5" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
<TabControl>
|
||||
<TabItem Header="Messages">
|
||||
<TextBox x:Name="output"
|
||||
AcceptsReturn="True"
|
||||
IsReadOnly="True"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
HorizontalScrollBarVisibility="Visible"
|
||||
/>
|
||||
<TabItem Header="GPS Info">
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" Background="#FFEEEEEE">
|
||||
<WrapPanel>
|
||||
<local:GprmcControl x:Name="gprmcView" Style="{StaticResource card}" />
|
||||
<local:GpggaControl x:Name="gpggaView" Style="{StaticResource card}" />
|
||||
<local:GpgsaControl x:Name="gpgsaView" Style="{StaticResource card}" />
|
||||
<local:GpgllControl x:Name="gpgllView" Style="{StaticResource card}" />
|
||||
<local:PgrmeControl x:Name="pgrmeView" Style="{StaticResource card}" />
|
||||
</WrapPanel>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
<TabItem Header="GPS Satellite view">
|
||||
<Grid>
|
||||
|
|
@ -25,6 +41,14 @@
|
|||
GpgsvMessages="{Binding GpgsvMessages, ElementName=satView}" />
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="Messages">
|
||||
<TextBox x:Name="output"
|
||||
AcceptsReturn="True"
|
||||
IsReadOnly="True"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
HorizontalScrollBarVisibility="Visible"
|
||||
/>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,13 @@ namespace SampleApp.WinDesktop
|
|||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// Use serial port:
|
||||
//var comPort = System.IO.Ports.SerialPort.GetPortNames().First();
|
||||
//var port = new System.IO.Ports.SerialPort(comPort, 4800);
|
||||
//var device = new NmeaParser.SerialPortDevice(port);
|
||||
|
||||
//Use a log file for playing back logged data
|
||||
var device = new NmeaParser.NmeaFileDevice("NmeaSampleData.txt");
|
||||
device.MessageReceived += device_MessageReceived;
|
||||
var _ = device.OpenAsync();
|
||||
|
|
@ -45,6 +52,16 @@ namespace SampleApp.WinDesktop
|
|||
if(args.IsMultipart && args.MessageParts != null)
|
||||
satView.GpgsvMessages = args.MessageParts.OfType<NmeaParser.Nmea.Gps.Gpgsv>();
|
||||
}
|
||||
if (args.Message is NmeaParser.Nmea.Gps.Gprmc)
|
||||
gprmcView.Message = args.Message as NmeaParser.Nmea.Gps.Gprmc;
|
||||
else if (args.Message is NmeaParser.Nmea.Gps.Gpgga)
|
||||
gpggaView.Message = args.Message as NmeaParser.Nmea.Gps.Gpgga;
|
||||
else if (args.Message is NmeaParser.Nmea.Gps.Gpgsa)
|
||||
gpgsaView.Message = args.Message as NmeaParser.Nmea.Gps.Gpgsa;
|
||||
else if (args.Message is NmeaParser.Nmea.Gps.Gpgll)
|
||||
gpgllView.Message = args.Message as NmeaParser.Nmea.Gps.Gpgll;
|
||||
else if (args.Message is NmeaParser.Nmea.Gps.Garmin.Pgrme)
|
||||
pgrmeView.Message = args.Message as NmeaParser.Nmea.Gps.Garmin.Pgrme;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
38
src/SampleApp.WinDesktop/PgrmeControl.xaml
Normal file
38
src/SampleApp.WinDesktop/PgrmeControl.xaml
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<UserControl x:Class="SampleApp.WinDesktop.PgrmeControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:SampleApp.WinDesktop"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<StackPanel DataContext="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=Message}">
|
||||
<Border Background="CornflowerBlue" Padding="10" Margin="-10,-10,-10,5">
|
||||
<TextBlock Text="PGRME" FontSize="20" FontWeight="Bold" Foreground="White" />
|
||||
</Border>
|
||||
<local:KeyValuePairControl Header="Horizontal Error: ">
|
||||
<local:KeyValuePairControl.Value>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding HorizontalError}" />
|
||||
<TextBlock Text="{Binding HorizontalErrorUnits}" />
|
||||
</StackPanel>
|
||||
</local:KeyValuePairControl.Value>
|
||||
</local:KeyValuePairControl>
|
||||
<local:KeyValuePairControl Header="Vertical Error: ">
|
||||
<local:KeyValuePairControl.Value>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding VerticalError}" />
|
||||
<TextBlock Text="{Binding VerticalErrorUnits}" />
|
||||
</StackPanel>
|
||||
</local:KeyValuePairControl.Value>
|
||||
</local:KeyValuePairControl>
|
||||
<local:KeyValuePairControl Header="Spherical Error: ">
|
||||
<local:KeyValuePairControl.Value>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding SphericalError}" />
|
||||
<TextBlock Text="{Binding SphericalErrorUnits}" />
|
||||
</StackPanel>
|
||||
</local:KeyValuePairControl.Value>
|
||||
</local:KeyValuePairControl>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
39
src/SampleApp.WinDesktop/PgrmeControl.xaml.cs
Normal file
39
src/SampleApp.WinDesktop/PgrmeControl.xaml.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using NmeaParser.Nmea.Gps;
|
||||
using NmeaParser.Nmea.Gps.Garmin;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace SampleApp.WinDesktop
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for PgrmeControl.xaml
|
||||
/// </summary>
|
||||
public partial class PgrmeControl : UserControl
|
||||
{
|
||||
public PgrmeControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public Pgrme Message
|
||||
{
|
||||
get { return (Pgrme)GetValue(MessageProperty); }
|
||||
set { SetValue(MessageProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty MessageProperty =
|
||||
DependencyProperty.Register("Message", typeof(Pgrme), typeof(PgrmeControl), new PropertyMetadata(null));
|
||||
}
|
||||
}
|
||||
|
|
@ -53,12 +53,54 @@
|
|||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="GpgsaControl.xaml.cs">
|
||||
<DependentUpon>GpgsaControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GpggaControl.xaml.cs">
|
||||
<DependentUpon>GpggaControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GpgllControl.xaml.cs">
|
||||
<DependentUpon>GpgllControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="KeyValuePairControl.xaml.cs">
|
||||
<DependentUpon>KeyValuePairControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="PgrmeControl.xaml.cs">
|
||||
<DependentUpon>PgrmeControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GprmcControl.xaml.cs">
|
||||
<DependentUpon>GprmcControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SatelliteSnr.xaml.cs">
|
||||
<DependentUpon>SatelliteSnr.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SatelliteView.xaml.cs">
|
||||
<DependentUpon>SatelliteView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="GpgsaControl.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="GpggaControl.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="GpgllControl.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="KeyValuePairControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="PgrmeControl.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="GprmcControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
|
|
|||
Loading…
Reference in a new issue