private void DgFacts_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.RowIndex >= 0 && e.ColumnIndex > 0) { DisplayFact f = dgFacts.Rows[e.RowIndex].DataBoundItem as DisplayFact; DataGridViewCell cell = dgFacts.Rows[e.RowIndex].Cells[e.ColumnIndex]; if (f.Fact.FactErrorLevel != Fact.FactError.GOOD) { cell.InheritedStyle.Font = italicFont; cell.ToolTipText = "Fact is inaccurate but is being used due to Tolerate slightly inaccurate census dates option."; if (f.Fact.FactErrorLevel != Fact.FactError.WARNINGALLOW) { cell.InheritedStyle.ForeColor = Color.Red; // if ignoring facts then set as red cell.ToolTipText = "Fact is an error and isn't being used"; } } cell.Style.BackColor = f.BackColour; if (e.ColumnIndex == dgFacts.Columns["CensusReference"].Index && f.CensusReference != null && f.CensusReference.URL.Length > 0) { cell.Style.ForeColor = Color.Blue; cell.Style.Font = linkFont; cell.ToolTipText = "Click link to view census records on Find My Past."; } } }
private void DgFacts_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0 && e.ColumnIndex == 1) { DisplayFact ignoreFact = (DisplayFact)dgFacts.Rows[e.RowIndex].DataBoundItem; ignoreFact.IgnoreFact = !(bool)dgFacts.Rows[e.RowIndex].Cells["IgnoreFact"].Value; // value will be value before click so invert it if (ignoreFact.IgnoreFact) { //ignoring this record so add it to the list if its not already present if (!IgnoreList.Contains(ignoreFact.FactHash)) { IgnoreList.Add(ignoreFact.FactHash); } } else { IgnoreList.Remove(ignoreFact.FactHash); // no longer ignoring so remove from list } SerializeIgnoreList(); } if (e.RowIndex >= 0 && e.ColumnIndex == dgFacts.Columns["CensusReference"].Index) { DisplayFact df = (DisplayFact)dgFacts.Rows[e.RowIndex].DataBoundItem; if (df.CensusReference.URL.Length > 0) { HttpUtility.VisitWebsite(df.CensusReference.URL); } } }
private void DgFacts_CellToolTipTextNeeded(object sender, DataGridViewCellToolTipTextNeededEventArgs e) { if (e.RowIndex >= 0 && e.ColumnIndex == 0) { DisplayFact f = dgFacts.Rows[e.RowIndex].DataBoundItem as DisplayFact; e.ToolTipText = f.Fact.FactErrorMessage; } }
public Sources(DisplayFact fact) { InitializeComponent(); this.sources = new SortableBindingList <IDisplaySource>(); dgSources.AutoGenerateColumns = false; ExtensionMethods.DoubleBuffered(dgSources, true); reportFormHelper = new ReportFormHelper(this, this.Text, dgSources, this.ResetTable, "Sources"); AddSources(fact); }
public void AddSelections(DataGridViewSelectedRowCollection rows) { Clear(); foreach (DataGridViewRow row in rows) { DisplayFact dispFact = row.DataBoundItem as DisplayFact; MapLocation ml = new MapLocation(dispFact.Ind, dispFact.Fact, dispFact.FactDate); AddFeatureDataRow(dispFact, ml, LIGHT_GREEN); } }
private void SelectFact(DisplayFact dispFact) { foreach (DataGridViewRow row in dgFacts.Rows) { DisplayFact rowFact = (DisplayFact)row.DataBoundItem; if (rowFact.Equals(dispFact)) { dgFacts.Rows[row.Index].Selected = true; } } }
void AddSources(DisplayFact fact) { foreach (FactSource s in fact.Sources) { if (!sources.Contains(s)) { sources.Add(s); } } dgSources.DataSource = sources; reportFormHelper.LoadColumnLayout("SourcesColumns.xml"); tsRecords.Text = sources.Count + " Records"; }
private FeatureDataRow AddFeatureDataRow(DisplayFact dispfact, MapLocation loc, string colour) { GeoResponse.CResult.CGeometry.CViewPort vp = loc.Location.ViewPort; FeatureDataRow r = TearDropLocations.NewRow(); r["DisplayFact"] = dispfact; r["MapLocation"] = loc; r["ViewPort"] = new Envelope(vp.NorthEast.Long, vp.SouthWest.Long, vp.NorthEast.Lat, vp.SouthWest.Lat); r["Colour"] = colour; r.Geometry = loc.Geometry; TearDropLocations.AddRow(r); return(r); }
public SourcesForm(DisplayFact fact) { InitializeComponent(); Top += NativeMethods.TopTaskbarOffset; sources = new SortableBindingList <IDisplaySource>(); dgSources.AutoGenerateColumns = false; ExtensionMethods.DoubleBuffered(dgSources, true); reportFormHelper = new ReportFormHelper(this, this.Text, dgSources, this.ResetTable, "Sources"); if (fact is object) // checks for not null { AddSources(fact); } }
private void MapBox1_MapQueried(FeatureDataTable data) { this.Cursor = Cursors.WaitCursor; isQuerying = true; dgFacts.ClearSelection(); foreach (FeatureDataRow row in data) { if (row["DisplayFact"] != null && row["Colour"].ToString() == TearDropLayer.GREY) { DisplayFact dispFact = (DisplayFact)row["DisplayFact"]; SelectFact(dispFact); } } isQuerying = false; this.Cursor = Cursors.Default; }
private void DgFacts_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0 && e.ColumnIndex >= 0) { DisplayFact f = dgFacts.Rows[e.RowIndex].DataBoundItem as DisplayFact; if (f.Fact.FactType == Fact.REPORT) { Facts person = new Facts(f.Ind); person.Show(); } else { Sources sourceForm = new Sources(f); sourceForm.Show(); } } }
private void SetBackColour() { bool backColourGrey = false; DisplayFact previous = null; foreach (DisplayFact fact in facts) { if (previous != null) { if ((CensusRefReport && previous.CensusReference != fact.CensusReference) || (!CensusRefReport && previous.IndividualID != fact.IndividualID)) { backColourGrey = !backColourGrey; } } fact.BackColour = backColourGrey ? Color.LightGray : Color.White; previous = fact; } }
public void ShowHideFactRows() { CurrencyManager cm = (CurrencyManager)BindingContext[dgFacts.DataSource]; cm.SuspendBinding(); foreach (DataGridViewRow row in dgFacts.Rows) { if (btnShowHideFacts.Checked) { DisplayFact fact = row.DataBoundItem as DisplayFact; row.Visible = !fact.IgnoreFact; } else { row.Visible = true; } } cm.ResumeBinding(); dgFacts.Refresh(); }