/// <summary>
        /// Constructor. Calls the parent to initialize.
        /// </summary>
        public GetDGTrackHeadersCommand() : base()
        {
            DG200FileLogger.Log("GetDGTrackHeadersCommand constructor.", 3);
            this._startingTrackIndex = 0;

            this._locResult = new GetDGTrackHeadersCommandResult();
            this._session   = new GetDGTrackHeadersSession();
            this._session.setResult(this._locResult);
            this._currentResult = this._locResult;
        }
示例#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;
            }
        }