コード例 #1
0
        private void Autoupdateedsm_Tick(object sender, EventArgs e)            // tick tock to get edsm data very slowly!
        {
            if (dataGridViewStarList.FirstDisplayedCell != null && checkBoxEDSM.Checked)
            {
                int top = dataGridViewStarList.FirstDisplayedCell.RowIndex;
                if (top != autoupdaterowstart)
                {
                    autoupdaterowstart  = top;
                    autoupdaterowoffset = 0;
                }

                while (true)
                {
                    int             row = autoupdaterowstart + autoupdaterowoffset;
                    DataGridViewRow rw  = (row >= 0 && row < dataGridViewStarList.Rows.Count) ? dataGridViewStarList.Rows[row] : null;

                    if (rw == null || rw.Displayed == false)        // don't go beyond end or beyond displayed area
                    {
                        //System.Diagnostics.Debug.WriteLine("Stop at " + row + " " + autoupdaterowoffset);
                        break;
                    }

                    autoupdaterowoffset++;

                    HistoryEntry he = rw.Tag as HistoryEntry;

                    if (!EDSMClass.HasBodyLookupOccurred(he.System.Name))       // this tells us if a body lookup has occurred
                    {
                        System.Diagnostics.Debug.WriteLine("StarList EDSM Update row" + row);
                        CheckEDSM(rw);
                        break;
                    }
                    else
                    {
                        System.Diagnostics.Debug.WriteLine("StarList Skip row as already checked " + row);
                    }
                }
            }
        }