Exemple #1
0
        private void btnDownload_Click(object sender, RoutedEventArgs e)
        {
            string filepath = this.openFileDialog();

            if (filepath != "")
            {
                ISet <System.Windows.Controls.ListViewItem> headers = this.getSelectedTrackHeaders();
                if (headers.Count == 0)
                {
                    return;
                }

                GpxSerializer s = new GpxSerializer();
                s.setSerialConnection(this._dgSerialConnection);

                foreach (System.Windows.Controls.ListViewItem sel in headers)
                {
                    TrackHeaderEntry the = sel.Content as TrackHeaderEntry;
                    s.addTrackHeaderEntry(the);
                }

                s.setFilePath(filepath);

                s.serialize();

                // We have to do this to get the green light to come back on.
                this.getConfig();
            }
        }
Exemple #2
0
        private void refreshTrackHeaders()
        {
            try
            {
                GetDGTrackHeadersCommand c = new GetDGTrackHeadersCommand();
                c.setSerialConnection(this.getSerialConnection());

                c.execute();

                GetDGTrackHeadersCommandResult cr = (GetDGTrackHeadersCommandResult)c.getLastResult();

                foreach (DGTrackHeader th in cr.getTrackHeaders())
                {
                    if (!th.getIsValid())
                    {
                        continue;
                    }

                    if (th.getIsFirstBlock())
                    {
                        this.addCurrentTrackHeaderEntry();

                        this._currentTrackHeaderEntry = new TrackHeaderEntry(th);
                    }
                    else
                    {
                        this._currentTrackHeaderEntry.addTrackId(th.getFileIndex());
                    }
                }

                this.addCurrentTrackHeaderEntry();

                this.lblStatus.Content  = "Connected on port " + this.getSerialConnection().getPortName() + ".\n";
                this.lblStatus.Content += this._dgConfig.getMemoryUsage() + "% memory consumed.\n";
                this.lblStatus.Content += this.TrackHeaders.Count + " track headers retrieved.";
            }
            catch (kimandtodd.DG200CSharp.commands.exceptions.CommandException ex)
            {
                this.lblStatus.Content += "Retrieving track headers failed: " + ex.Message;
            }
        }
Exemple #3
0
 public void addTrackHeaderEntry(TrackHeaderEntry newEntry)
 {
     this._trackHeaderEntries.Add(newEntry);
 }