public void EditProfile(GPSProfile prof) { GPSConfiguration dlg = new GPSConfiguration (prof); dlg.Parent = this; dlg.Icon = this.Icon; dlg.Title = Catalog.GetString ("Edit GPS Profile..."); if ((int)ResponseType.Ok == dlg.Run ()) { string origName = prof.Name; bool isActive = false; if ((m_app.Profiles.GetActiveProfile ()) != null && (m_app.Profiles.GetActiveProfile ().Name == origName)) isActive = true; prof.Name = dlg.ProfileName; prof.BabelFormat = dlg.GPSConfig.GetBabelFormat (); prof.CacheLimit = dlg.GPSConfig.GetCacheLimit (); prof.NameMode = dlg.GPSConfig.GetNameMode (); prof.DescMode = dlg.GPSConfig.GetDescMode (); prof.LogLimit = dlg.GPSConfig.GetLogLimit (); prof.IncludeAttributes = dlg.GPSConfig.IncludeAttributes (); prof.OutputFile = dlg.GPSConfig.GetOutputFile (); prof.WaypointMappings = dlg.GPSMappings; prof.FieldNotesFile = dlg.GPSConfig.FieldNotesFile; if (origName == prof.Name) { m_app.Profiles.UpdateProfile (prof); } else { m_app.Profiles.DeleteProfile (origName); m_app.Profiles.AddProfile (prof); if (isActive) Config.GPSProf = prof.Name; } RebuildProfiles(); } }
public void AddGPSProfile() { GPSConfiguration dlg = new GPSConfiguration (); dlg.Parent = this; dlg.Icon = this.Icon; if ((int)ResponseType.Ok == dlg.Run ()) { GPSProfile prof = new GPSProfile (); prof.Name = dlg.ProfileName; prof.BabelFormat = dlg.GPSConfig.GetBabelFormat (); prof.CacheLimit = dlg.GPSConfig.GetCacheLimit (); prof.NameMode = dlg.GPSConfig.GetNameMode (); prof.DescMode = dlg.GPSConfig.GetDescMode (); prof.LogLimit = dlg.GPSConfig.GetLogLimit (); prof.IncludeAttributes = dlg.GPSConfig.IncludeAttributes (); prof.OutputFile = dlg.GPSConfig.GetOutputFile (); prof.FieldNotesFile = dlg.GPSConfig.FieldNotesFile; prof.WaypointMappings = dlg.GPSMappings; if (Config.GPSProf == null) Config.GPSProf = prof.Name; m_app.Profiles.AddProfile (prof); RebuildProfiles(); } }