/// <summary> /// Adds the track to the top of the list. Remove duplicates from the list as well /// </summary> /// <param name="r"></param> public void pushRecord(Record r) { int idx = _RecordList.IndexOf(r); if (idx >= 0) //tests if the record is already in the list { _RecordList.RemoveAt(idx); } if (!isListFull()) { _RecordList.Insert(0, r); } // save the property Properties.Settings.Default.Save(); }
/// <summary> /// This function is called by the double click event and the datapage button click event /// </summary> /// <param name="records">Array of Record objects</param> private void goToDataPage(Record[] records) { // construct the record data page if (main.dataPage == null) { DataPage data = new DataPage(main); main.dataPage = data; } main.dataPage.setRecord(records); // Navigate to the page main.frameLogBook.Navigate(main.dataPage); // make the back button visible main.buttonBack.Visibility = System.Windows.Visibility.Visible; }
/// <summary> /// This function must be called before using the page /// If the new record is the same as the current then nothing changes /// </summary> /// <param name="record">Record object containing lap information</param> public void setRecord(Record[] records) { if (recordTable != null) { if (!recordTable.Equals(records)) { // clear lap collection and javascript array _LapCollection.Clear(); geBrowser.clearLaps(); } } this.recordTable = records; // Add the laps to the Collection foreach (Record r in recordTable) { // add record to the recentTracks property for quick viewing on the home page Properties.Settings.Default.RecentTracks.pushRecord(r); //TODO figure out why this isn't working foreach (LapInfo lap in r.Laps) { _LapCollection.Add(lap); } } }
private void buttonNext_Click(object sender, RoutedEventArgs e) { Record[] records = new Record[listViewRecords.SelectedItems.Count]; for (int i = 0; i < listViewRecords.SelectedItems.Count; i++) { records[i] = (Record)listViewRecords.SelectedItems[i]; } goToDataPage(records); }