private void setValidationText(ToolDescr td) { this.validationLabel.Text = td.substituteArgs(PictureManager.This.CameraManager.Location.Lat, PictureManager.This.CameraManager.Location.Lng, null, null).Replace("&", "&&"); }
private void refreshToolsListBox(ToolDescr td) { toolsListBox.DataSource = null; toolsListBox.DataSource = Project.tools.tools; if(td != null) { toolsListBox.SelectedItem = td; } }
public void Restore(string toolsFilePath) { tools.Clear(); try { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(toolsFilePath); foreach(XmlNode nnode in xmlDoc.ChildNodes) { if(nnode.Name.Equals("tools")) { foreach(XmlNode node in nnode) { if(node.Name.Equals("tool")) { try { ToolDescr td = new ToolDescr(node); tools.Add(td); } catch (Exception ee) { // bad node - not a big deal... LibSys.StatusBar.Error("Tools:Restore() " + ee.Message); } } } } } isDirty = false; } catch (FileNotFoundException e) { LibSys.StatusBar.Trace("OK: " + e.Message); } catch (Exception e) { LibSys.StatusBar.Error("Tools:Restore() " + e.Message); } if(tools.Count == 0) { // populate it with default set: ToolDescr td = new ToolDescr(); td.displayName = "Microsoft Streets&Trips"; td.executablePath = Project.driveSystem + "Program Files\\Microsoft Streets and Trips\\Streets.exe"; td.arguments = ""; tools.Add(td); td = new ToolDescr(); td.displayName = "Google street level map"; td.executablePath = null; // browser type td.arguments = "http://maps.google.com/maps?ll=%lat%,%lon%&z=4"; // "http://www.mapquest.com/maps/map.adp?size=big&zoom=9&latlongtype=decimal&latitude=%lat%&longitude=%lon%"; tools.Add(td); td = new ToolDescr(); td.displayName = "MSR Maps map"; td.executablePath = null; // browser type td.arguments = "http://terraserver.homeadvisor.msn.com/addressimage.aspx?t=4&s=8&Lon=%lon%&Lat=%lat%&w=2&opt=0"; tools.Add(td); td = new ToolDescr(); td.displayName = "GPSBabelWrapper"; td.executablePath = Project.driveSystem + "Program Files\\VitalBytes\\GpsBabelWrapper\\bin\\gpsbabelwrapper.exe"; td.arguments = ""; tools.Add(td); td = new ToolDescr(); td.displayName = "GSAK"; td.executablePath = Project.driveSystem + "Program Files\\GSAK\\gsak.exe"; td.arguments = "\"%file%\""; tools.Add(td); td = new ToolDescr(); td.displayName = "Geocache By Waypoint Name"; td.executablePath = null; td.arguments = "http://www.geocaching.com/seek/cache_details.aspx?pf=y&wp=%waypoint%&decrypt=y&log=y&numlogs=10"; tools.Add(td); td = new ToolDescr(); td.displayName = "Geocache By GUID"; td.executablePath = null; td.arguments = "http://www.geocaching.com/seek/cache_details.aspx?pf=y&guid=%guid%&decrypt=y&log=y&numlogs=10"; tools.Add(td); isDirty = true; //this.Save(toolsFilePath); } }
private void addToolButton_Click(object sender, System.EventArgs e) { ToolDescr td = new ToolDescr(); td.displayName = "New Tool"; td.executablePath = Project.driveSystem + "Program Files"; td.arguments = "longitude=%lon% latitude=%lat%"; Project.tools.tools.Add(td); Project.tools.isDirty = true; refreshToolsListBox(td); }
public void Restore(string toolsFilePath) { tools.Clear(); try { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(toolsFilePath); foreach (XmlNode nnode in xmlDoc.ChildNodes) { if (nnode.Name.Equals("tools")) { foreach (XmlNode node in nnode) { if (node.Name.Equals("tool")) { try { ToolDescr td = new ToolDescr(node); tools.Add(td); } catch (Exception ee) { // bad node - not a big deal... LibSys.StatusBar.Error("Tools:Restore() " + ee.Message); } } } } } isDirty = false; } catch (FileNotFoundException e) { LibSys.StatusBar.Trace("OK: " + e.Message); } catch (Exception e) { LibSys.StatusBar.Error("Tools:Restore() " + e.Message); } if (tools.Count == 0) { // populate it with default set: ToolDescr td = new ToolDescr(); td.displayName = "Microsoft Streets&Trips"; td.executablePath = Project.driveSystem + "Program Files\\Microsoft Streets and Trips\\Streets.exe"; td.arguments = ""; tools.Add(td); td = new ToolDescr(); td.displayName = "Google street level map"; td.executablePath = null; // browser type td.arguments = "http://maps.google.com/maps?ll=%lat%,%lon%&z=4"; // "http://www.mapquest.com/maps/map.adp?size=big&zoom=9&latlongtype=decimal&latitude=%lat%&longitude=%lon%"; tools.Add(td); td = new ToolDescr(); td.displayName = "MSR Maps map"; td.executablePath = null; // browser type td.arguments = "http://terraserver.homeadvisor.msn.com/addressimage.aspx?t=4&s=8&Lon=%lon%&Lat=%lat%&w=2&opt=0"; tools.Add(td); td = new ToolDescr(); td.displayName = "GPSBabelWrapper"; td.executablePath = Project.driveSystem + "Program Files\\VitalBytes\\GpsBabelWrapper\\bin\\gpsbabelwrapper.exe"; td.arguments = ""; tools.Add(td); td = new ToolDescr(); td.displayName = "GSAK"; td.executablePath = Project.driveSystem + "Program Files\\GSAK\\gsak.exe"; td.arguments = "\"%file%\""; tools.Add(td); td = new ToolDescr(); td.displayName = "Geocache By Waypoint Name"; td.executablePath = null; td.arguments = "http://www.geocaching.com/seek/cache_details.aspx?pf=y&wp=%waypoint%&decrypt=y&log=y&numlogs=10"; tools.Add(td); td = new ToolDescr(); td.displayName = "Geocache By GUID"; td.executablePath = null; td.arguments = "http://www.geocaching.com/seek/cache_details.aspx?pf=y&guid=%guid%&decrypt=y&log=y&numlogs=10"; tools.Add(td); isDirty = true; //this.Save(toolsFilePath); } }