Skip to content

Commit

Permalink
Merge pull request #557 from AgOpenGPS-Official/release/6.6
Browse files Browse the repository at this point in the history
  • Loading branch information
FantasyTeddy authored Jan 9, 2025
2 parents 35d0bf7 + 29638bb commit 06300cd
Show file tree
Hide file tree
Showing 16 changed files with 302 additions and 172 deletions.
9 changes: 0 additions & 9 deletions SourceCode/AgIO/Source/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,6 @@
<setting name="setPgm_defaultLon" serializeAs="String">
<value>0</value>
</setting>
<setting name="setF_culture" serializeAs="String">
<value>en</value>
</setting>
<setting name="setF_workingDirectory" serializeAs="String">
<value>Default</value>
</setting>
<setting name="setGPS_SimLatitude" serializeAs="String">
<value>0</value>
</setting>
Expand Down Expand Up @@ -190,9 +184,6 @@
<setting name="setDisplay_isAutoRunGPS_Out" serializeAs="String">
<value>False</value>
</setting>
<setting name="setConfig_profileName" serializeAs="String">
<value>Default Profile</value>
</setting>
</AgIO.Properties.Settings>
</userSettings>
</configuration>
23 changes: 21 additions & 2 deletions SourceCode/AgIO/Source/Classes/CSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Configuration;
using System.IO;
using System.Linq;
using System.Threading;
using System.Xml.Linq;
using System.Xml.XPath;

Expand Down Expand Up @@ -109,7 +110,7 @@ public static void Load()
//opening the subkey
RegistryKey regKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\AgIO");

////create default keys if not existing
//create default keys if not existing
if (regKey == null)
{
RegistryKey Key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\AgIO");
Expand All @@ -125,14 +126,26 @@ public static void Load()
try
{
//Profile File Name from Registry Key
if (regKey.GetValue("ProfileName") == null)
if (regKey.GetValue("ProfileName") == null || regKey.GetValue("ProfileName").ToString() == null)
{
RegistryKey key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\AgIO");
key.SetValue("ProfileName", "Default Profile");
Log.EventWriter("Registry -> Key Profile Name was null and Created");
}
else
{
//Culture from Registry Key
if (regKey.GetValue("AgOne_Culture") == null || regKey.GetValue("Language").ToString() == "")
{
RegistryKey key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\AgIO");
key.SetValue("Language", "en");
Log.EventWriter("Registry -> Culture was null and Created");
}
else
{
culture = regKey.GetValue("Language").ToString();
}

profileName = regKey.GetValue("ProfileName").ToString();

//get the Documents directory, if not exist, create
Expand Down Expand Up @@ -195,6 +208,8 @@ public static void Load()

public static void Save()
{
Properties.Settings.Default.Save();

RegistryKey key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\AgIO");
try
{
Expand All @@ -208,8 +223,12 @@ public static void Save()
key.Close();

if (RegistrySettings.profileName != "Default Profile")
{
Thread.Sleep(500);
SettingsIO.ExportSettings(Path.Combine(RegistrySettings.profileDirectory, RegistrySettings.profileName + ".xml"));
}
}


public static void Reset()
{
Expand Down
32 changes: 1 addition & 31 deletions SourceCode/AgIO/Source/Forms/FormKeyboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,7 @@ private void FormKeyboard_Load(object sender, EventArgs e)
keyboardString.SelectionLength = 0;
keyboard1.Focus();

//opening the subkey
RegistryKey regKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\AgOpenGPS");

//create default keys if not existing
if (regKey == null)
{
RegistryKey Key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\AgOpenGPS");

//storing the values
Key.SetValue("Language", "en");
Key.Close();

Properties.Settings.Default.setF_culture = "en";
Properties.Settings.Default.Save();
}
else
{
Properties.Settings.Default.setF_culture = regKey.GetValue("Language").ToString();
Properties.Settings.Default.Save();
regKey.Close();
}

string language = Properties.Settings.Default.setF_culture;
if (language == "fr")
{
this.Height = 587;
}
else
{
this.Height = 500;
}
this.Height = 500;
}

private void RegisterKeyboard1_ButtonPressed(object sender, KeyPressEventArgs e)
Expand Down
15 changes: 0 additions & 15 deletions SourceCode/AgIO/Source/Forms/FormProfiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ private void cboxOverWrite_SelectedIndexChanged(object sender, EventArgs e)

RegistrySettings.profileName = SanitizeFileName(cboxOverWrite.SelectedItem.ToString().Trim());

Properties.Settings.Default.setConfig_profileName = RegistrySettings.profileName;
Properties.Settings.Default.Save();

//save profile in registry
RegistrySettings.Save();

Expand Down Expand Up @@ -112,15 +109,9 @@ private void btnSaveNewProfile_Click(object sender, EventArgs e)

//reset to Default Profile and save
Settings.Default.Reset();
Settings.Default.Save();

Properties.Settings.Default.setConfig_profileName = RegistrySettings.profileName;
Properties.Settings.Default.Save();

//save profile in registry
RegistrySettings.Save();

SettingsIO.ExportSettings(Path.Combine(RegistrySettings.profileDirectory, RegistrySettings.profileName + ".xml"));

DialogResult = DialogResult.Yes;
Close();
Expand Down Expand Up @@ -175,9 +166,6 @@ private void btnSaveAs_Click(object sender, EventArgs e)
{
RegistrySettings.profileName = SanitizeFileName(tboxSaveAs.Text.ToString().Trim());

Properties.Settings.Default.setConfig_profileName = RegistrySettings.profileName;
Properties.Settings.Default.Save();

//save profile in registry
RegistrySettings.Save();

Expand Down Expand Up @@ -215,9 +203,6 @@ private void cboxChooseExisting_SelectedIndexChanged(object sender, EventArgs e)

RegistrySettings.profileName = cboxChooseExisting.SelectedItem.ToString().Trim();

Properties.Settings.Default.setConfig_profileName = RegistrySettings.profileName;
Properties.Settings.Default.Save();

RegistrySettings.Save();

DialogResult = DialogResult.Yes;
Expand Down
1 change: 0 additions & 1 deletion SourceCode/AgIO/Source/Forms/FormUDP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ private void btnSerialMonitor_Click(object sender, EventArgs e)

private void btnUDPOff_Click(object sender, EventArgs e)
{

Properties.Settings.Default.setUDP_isOn = false;
Properties.Settings.Default.setUDP_isSendNMEAToUDP = false;

Expand Down
3 changes: 0 additions & 3 deletions SourceCode/AgIO/Source/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ private static void Main()
//load the profile name and set profile directory
RegistrySettings.Load();

Properties.Settings.Default.setConfig_profileName = RegistrySettings.profileName;
Properties.Settings.Default.Save();

if (Mutex.WaitOne(TimeSpan.Zero, true))
{
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(RegistrySettings.culture);
Expand Down
36 changes: 0 additions & 36 deletions SourceCode/AgIO/Source/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions SourceCode/AgIO/Source/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,6 @@
<Setting Name="setPgm_defaultLon" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="setF_culture" Type="System.String" Scope="User">
<Value Profile="(Default)">en</Value>
</Setting>
<Setting Name="setF_workingDirectory" Type="System.String" Scope="User">
<Value Profile="(Default)">Default</Value>
</Setting>
<Setting Name="setGPS_SimLatitude" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
Expand Down Expand Up @@ -185,8 +179,5 @@
<Setting Name="setDisplay_isAutoRunGPS_Out" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="setConfig_profileName" Type="System.String" Scope="User">
<Value Profile="(Default)">Default Profile</Value>
</Setting>
</Settings>
</SettingsFile>
4 changes: 2 additions & 2 deletions SourceCode/GPS/Classes/CSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -389,14 +389,14 @@ public static void Load()

public static void Save()
{
Properties.Settings.Default.Save();

RegistryKey key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\AgOpenGPS");
try
{
key.SetValue("VehicleFileName", vehicleFileName);
key.SetValue("Language", culture);
key.SetValue("WorkingDirectory", workingDirectory);

//Log.EventWriter(vehicleFileName + " Saved to registry key");
}
catch (Exception ex)
{
Expand Down
2 changes: 1 addition & 1 deletion SourceCode/GPS/Classes/CVehicle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ public void DrawVehicle()
double svennDist = mf.camera.camSetDistance * -0.07;
double svennWidth = svennDist * 0.22;
GL.LineWidth(mf.ABLine.lineWidth);
GL.Color3(1.2, 1.25, 0.10);
GL.Color3(0.95, 0.95, 0.10);
GL.Begin(PrimitiveType.LineStrip);
{
GL.Vertex3(svennWidth, wheelbase + svennDist, 0.0);
Expand Down
Loading

0 comments on commit 06300cd

Please sign in to comment.