mirror of
https://github.com/dotMorten/NmeaParser.git
synced 2026-01-20 15:40:16 +01:00
Store NTRIP settings between runs
This commit is contained in:
parent
ab91ba3c09
commit
cd0eda6a02
|
|
@ -1,6 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" >
|
||||
<section name="SampleApp.WinDesktop.UserSettings" type="System.Configuration.ClientSettingsSection, System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
|
||||
</startup>
|
||||
<userSettings>
|
||||
<SampleApp.WinDesktop.UserSettings>
|
||||
<setting name="NTRIPServer" serializeAs="String">
|
||||
<value>esricaster.esri.com</value>
|
||||
</setting>
|
||||
<setting name="NTRIPPort" serializeAs="String">
|
||||
<value>2101</value>
|
||||
</setting>
|
||||
<setting name="NTRIPUsername" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="NTRIPPassword" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</SampleApp.WinDesktop.UserSettings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
|
|
|
|||
|
|
@ -27,6 +27,10 @@ namespace SampleApp.WinDesktop
|
|||
public NtripView()
|
||||
{
|
||||
InitializeComponent();
|
||||
host.Text = UserSettings.Default.NTRIPServer;
|
||||
port.Text = UserSettings.Default.NTRIPPort.ToString();
|
||||
username.Text = UserSettings.Default.NTRIPUsername;
|
||||
password.Password = UserSettings.Default.NTRIPPassword;
|
||||
}
|
||||
NmeaParser.Gnss.Ntrip.Client client;
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
|
|
@ -53,6 +57,12 @@ namespace SampleApp.WinDesktop
|
|||
MessageBox.Show("Failed to connect: " + ex.Message);
|
||||
return;
|
||||
}
|
||||
|
||||
UserSettings.Default.NTRIPServer = host.Text;
|
||||
UserSettings.Default.NTRIPPort = portNumber;
|
||||
UserSettings.Default.NTRIPUsername = username.Text;
|
||||
UserSettings.Default.NTRIPPassword = password.Password;
|
||||
UserSettings.Default.Save();
|
||||
if (MainWindow.monitor != null && !double.IsNaN(MainWindow.monitor.Latitude) && !double.IsNaN(MainWindow.monitor.Longitude))
|
||||
{
|
||||
var lat = MainWindow.monitor.Latitude;
|
||||
|
|
|
|||
|
|
@ -25,4 +25,17 @@
|
|||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="UserSettings.Designer.cs">
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>UserSettings.settings</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="UserSettings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>UserSettings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
74
src/SampleApp.WinDesktop/UserSettings.Designer.cs
generated
Normal file
74
src/SampleApp.WinDesktop/UserSettings.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace SampleApp.WinDesktop {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.7.0.0")]
|
||||
internal sealed partial class UserSettings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static UserSettings defaultInstance = ((UserSettings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new UserSettings())));
|
||||
|
||||
public static UserSettings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("esricaster.esri.com")]
|
||||
public string NTRIPServer {
|
||||
get {
|
||||
return ((string)(this["NTRIPServer"]));
|
||||
}
|
||||
set {
|
||||
this["NTRIPServer"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("2101")]
|
||||
public int NTRIPPort {
|
||||
get {
|
||||
return ((int)(this["NTRIPPort"]));
|
||||
}
|
||||
set {
|
||||
this["NTRIPPort"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string NTRIPUsername {
|
||||
get {
|
||||
return ((string)(this["NTRIPUsername"]));
|
||||
}
|
||||
set {
|
||||
this["NTRIPUsername"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string NTRIPPassword {
|
||||
get {
|
||||
return ((string)(this["NTRIPPassword"]));
|
||||
}
|
||||
set {
|
||||
this["NTRIPPassword"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
18
src/SampleApp.WinDesktop/UserSettings.settings
Normal file
18
src/SampleApp.WinDesktop/UserSettings.settings
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="SampleApp.WinDesktop" GeneratedClassName="UserSettings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="NTRIPServer" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">esricaster.esri.com</Value>
|
||||
</Setting>
|
||||
<Setting Name="NTRIPPort" Type="System.Int32" Scope="User">
|
||||
<Value Profile="(Default)">2101</Value>
|
||||
</Setting>
|
||||
<Setting Name="NTRIPUsername" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="NTRIPPassword" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
Loading…
Reference in a new issue