.Net with C#

Read GPS data (Waipoint, Track, ...) from Garmin GPS with C#

  • Posted on: 6 January 2011
  • By: markus.wilhelm

I wanted to read track data from any Garmin GPS device directly via my C# code. I found lots of classes and libraries for free and lots of where I had to pay for. But all of them had the same problem that communication via the COM Port seems to be verry buggy. I decided to develop my own and found that this is not that easy ;-(.

I did a lot of brainstorming and found a tricky way of how to do this. I make use of the Garmin Plugin for browsers. But how? Quite easy, more easy than you would expect. I implemented a webbrowser control into the C# form. The URL of this webbrowser control is a local Html file which implements the Garmin JavaScript library. After the actions of the Html implementation is finished  I read the data I want to have using the methods provided to the browser control like this: webBrowserGPS.Document.GetElementById("deviceInfoText").InnerText The important part now is to developt the Html page which offers user interaction in several ways.

You will find the Java Script sources together with some examples and the documentation at the Garmin Website: http://developer.garmin.com/web-device/garmin-communicator-plugin/
I added my example fot the Html and Javascript implementation to my download Area.

Development: 

Fehler im Microsoft "SpreadsheetML Schemas"

  • Posted on: 5 January 2011
  • By: markus.wilhelm

Hi,
ich habe für eines meiner Projekte beim Import von Excel XML Dateien eine validierung mittels XSD eingebaut und dazu die XSD Dokumente von Microsoft verwendet. Bei der Prüfung wird die XSD excelss.xsd verwendet die sich auf einige andere XSD bezieht und diese zur Laufzeit importiert. Eine der dabei verwendeten XSDs ist folgende: office.xsd. Unter Excel 2007 wird beim speichern als Excel 2003 XML Arbeitsmappe als Version in der XML Datei 12.00 reingeschrieben. Microsoft XSD Files

<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<
Author>Markus Wilhelm</Author>
<
LastAuthor>Markus Wilhelm</LastAuthor>
<
Created>2011-01-05T13:20:04Z</Created>
<
Company>OSRAM and OSRAM Sylvania</Company>
<
Version>12.00</Version>
<
/DocumentProperties>

Bei der XSD validierung wird aber eine Versionsnummer xx.xxxx erwartet und folglich schlägt die Validierung per se fehl. Damit das nicht passiert müsst ihr den Wert für {4} in der Datei office.xsd auf {2} ändern.

<xsd:simpleType name="versionType">
<
xsd:annotation>
<
xsd:documentation>Defines a version number format.</xsd:documentation>
<
/xsd:annotation>
<
xsd:restriction base="xsd:string">
<
xsd:pattern value="[0-9]?[0-9].[0-9]{2}"></xsd:pattern>
<
/xsd:restriction>
<
/xsd:simpleType>

Development: 

dataGridView.AutoGenerateColumns = false;

  • Posted on: 5 January 2011
  • By: markus.wilhelm

Hi ihr,
nachdem ich micht jetzt neben PHP und Webanwendungen auch wieder mit der Entwicklung von Klientapplikationen beschäftigt habe, bin ich jetzt auf ein recht bescheuertes Problem gestoßen.

Obwohl im Visual Studio 2008 folgende Eigenschaft automatisch gesetzt wird werden die Spalten des Databound Dataset jedesmal wieder von neuem in Gridview angelegt.
dataGridView.AutoGenerateColumns = false;

Ich hab dazu ziemlich lange gesucht und folgendes gefunden:
Ihr müsst in der .resx Datei der betroffenen Form einfach all Einträge dieser Art löschen, komplett.
<metadata name="ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</
metadata>

LG Markus

Development: 

Undo / Redo with undomadeeasy

  • Posted on: 19 December 2010
  • By: markus.wilhelm

I created a new .Net application and found a genious library for implementing Undo / Redo functionality to. You can find the trial version at http://www.undomadeeasy.com/

For the better usage I created a helper class which is downloadable in our download store. The helper class currently offers the following helper methods:

How to use this class:
Import this class to your project. Just copy and paste the needed line to your event handlers or wherever you need it.

UndoHelperClass.Instance.ChangeCheckBox((CheckBox)sender);
UndoHelperClass.Instance.ChangeTextbox((TextBox)sender);
UndoHelperClass.Instance.ChangeRichTextBox((RichTextBox)sender);
UndoHelperClass.Instance.ChangeRadioButton((RadioButton)sender); 
UndoHelperClass.Instance.ChangeDateTimePicker((DateTimePicker)sender);
UndoHelperClass.Instance.ChangeNumberUpdDown((NumericUpDown)sender);
UndoHelperClass.Instance.ChangeCombobox((ComboBox)sender); 

Special Handlign for DataGridView Table:
Working with dataGridView only works if you assigned a DataTable object as the Databinding for this datagridview. It is necessary
to have the column rowPosition (visible = false), this offers the posibility to add and remove rows in the middle of the table.
dataGridView1_BindingTable is of type DataTable

For tables it is with this class not possible to work with AllowUserToAddRow and AllowUserToDeleteRow. If you would use this you must work with Event handlers newrow and deletedrow and this will cause a loop. I was not able to solve this. If you have any idea feel free to enhance.

1) Add a new row
DataRow row = dataGridView1_BindingTable.NewRow();
row["xxxx"] = "";
.... (all other new columns values)
row["rowPosition"] = dataGridview.CurrentRow.Index;
UndoHelperClass.Instance.changeTableAddRow((DataGridView)sender);

2) Remove an existing row
UndoHelperClass.Instance.changeTableDeleteRow(dataGridView1_BindingTable, dataGridView1.CurrentRow.Index, true);

3) Change Cell values inside a Table
The old cell value can be stored using the event dataGridView1_CellEnter

UndoHelperClass.Instance.changeTableUpdateCell(dataGridView1_BindingTable, dataGridView1.CurrentCell.ColumnIndex, dataGridView1.CurrentCell.RowIndex, oldvalue, dataGridView1.CurrentCell.Value.ToString());

Development: