/// <summary> /// For the current record, display the reference surveys, reset the moving flag and clear the record status. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Bs_PositionChanged(object sender, EventArgs e) { CurrentRecord = (SurveyCheckRec)bs.Current; if (CurrentRecord != null) { dgvRefSurveys.DataSource = CurrentRecord.ReferenceSurveys; } SetRecordStatus(""); Moving = false; }
public SurveyCheckTracking(int ID) { InitializeComponent(); // get the records SurveyCheckRecords = DBAction.GetSurveyCheckRecords(); // setup binding source bs = new BindingSource() { DataSource = SurveyCheckRecords }; navRecords.BindingSource = bs; // setup the form SetupForm(); BindProperties(); ColorForm(0xDCE6F2); // register events this.MouseWheel += ITCForm_OnMouseWheel; bs.PositionChanged += Bs_PositionChanged; bs.ListChanged += Bs_ListChanged; bs.DataError += Bs_DataError; // set initial state if (SurveyCheckRecords.Count == 0) { AddRecord(); } else { LockForm(true); } var obj = bs.List.OfType <SurveyCheckRec>().ToList().Find(f => f.ID == ID); var pos = bs.IndexOf(obj); bs.Position = pos; CurrentRecord = (SurveyCheckRec)bs.Current; SetRecordStatus(""); Moving = false; }