private void button_openAndView_Click(object sender, EventArgs e) { var path = this.fileOpenControl1.FilePath; this.NtripSourceTable = NtripSourceTable.Load(path); ViewContent(NtripSourceTable); }
private void ViewContent(NtripSourceTable table, string propertyName = "", SortOrder SortOrder = SortOrder.Ascending) { var type = enumRadioControl1.GetCurrent <SourceType>(); simpleTableControl1.Title = type.ToString(); IEnumerable <INtripSourceItem> dataSource = null; switch (type) { case SourceType.Caster: simpleTableControl1.Init <NtripCasterItem>(false); var list = table.GetItems <NtripCasterItem>(type); if (!String.IsNullOrWhiteSpace(propertyName)) { list.Sort(new Comparison <NtripCasterItem>(delegate(NtripCasterItem a, NtripCasterItem b) { return(Geo.Utils.ObjectUtil.Compare(a, b, propertyName, SortOrder == SortOrder.Ascending)); })); } dataSource = list; break; case SourceType.Network: simpleTableControl1.Init <NtripNetwork>(false); var list2 = table.GetItems <NtripNetwork>(type); if (!String.IsNullOrWhiteSpace(propertyName)) { list2.Sort(new Comparison <NtripNetwork>(delegate(NtripNetwork a, NtripNetwork b) { return(Geo.Utils.ObjectUtil.Compare(a, b, propertyName, SortOrder == SortOrder.Ascending)); })); } dataSource = list2; break; case SourceType.Stream: simpleTableControl1.Init <NtripStream>(false); var list3 = table.GetItems <NtripStream>(type); if (!String.IsNullOrWhiteSpace(propertyName)) { list3.Sort(new Comparison <NtripStream>(delegate(NtripStream a, NtripStream b) { return(Geo.Utils.ObjectUtil.Compare(a, b, propertyName, SortOrder == SortOrder.Ascending)); })); } dataSource = list3; break; default: break; } simpleTableControl1.DataBind(dataSource); simpleTableControl1.SetColumnSortModel(DataGridViewColumnSortMode.Programmatic); }