public async System.Threading.Tasks.Task ReStoreViewSettingDetailControlAsync() { using (var dt = UnitTestStatic.GetDataTable()) { using (var dc = new DetailControl()) { dc.HTMLStyle = UnitTestInitializeWin.HTMLStyle; dc.DataTable = dt; await dc.RefreshDisplayAsync(FilterType.All, UnitTestInitializeCsv.Token); var columnFilters = new List <ToolStripDataGridViewColumnFilter> { new ToolStripDataGridViewColumnFilter(dc.FilteredDataGridView.Columns[0]) }; columnFilters[0].ColumnFilterLogic.Operator = "="; columnFilters[0].ColumnFilterLogic.ValueText = "Halloween"; columnFilters[0].ColumnFilterLogic.Active = true; var text = ViewSetting.StoreViewSetting(dc.FilteredDataGridView, columnFilters); var fn = System.IO.Path.Combine(FileSystemUtils.ExecutableDirectoryName(), "test.delete"); FileSystemUtils.FileDelete(fn); FileSystemUtils.WriteAllText(fn, text); dc.ReStoreViewSetting(fn); FileSystemUtils.FileDelete(fn); } } }
public async System.Threading.Tasks.Task DetailControlTestAsync() { using (var dt = new DataTable()) { dt.Columns.Add(new DataColumn { ColumnName = "ID", DataType = typeof(int) }); dt.Columns.Add(new DataColumn { ColumnName = "Text", DataType = typeof(string) }); dt.Columns.Add(new DataColumn { ColumnName = "Date", DataType = typeof(DateTime) }); dt.Columns.Add(new DataColumn { ColumnName = "Bool", DataType = typeof(bool) }); for (var line = 1; line < 5000; line++) { var row = dt.NewRow(); row[0] = line; row[1] = $"This is text {line / 2}"; row[2] = new DateTime(2001, 6, 6).AddHours(line * 3); row[3] = line % 3 == 0; if (random.Next(1, 10) == 5) { row.SetColumnError(random.Next(0, 3), "Error"); } if (random.Next(1, 50) == 5) { row.RowError = "Row Error"; } dt.Rows.Add(row); } using (var dc = new DetailControl()) { dc.HTMLStyle = UnitTestInitializeWin.HTMLStyle; dc.Show(); dc.DataTable = dt; await dc.RefreshDisplayAsync(FilterType.All, UnitTestInitializeCsv.Token); dc.OnlyShowErrors = true; dc.MoveMenu(); } } }
public async System.Threading.Tasks.Task SortTestAsync() { using (var dt = new DataTable()) { dt.Columns.Add(new DataColumn { ColumnName = "ID", DataType = typeof(int) }); dt.Columns.Add(new DataColumn { ColumnName = "Text", DataType = typeof(string) }); dt.Columns.Add(new DataColumn { ColumnName = "Date", DataType = typeof(DateTime) }); dt.Columns.Add(new DataColumn { ColumnName = "Bool", DataType = typeof(bool) }); for (var line = 1; line < 5000; line++) { var row = dt.NewRow(); row[0] = random.Next(1, 5000); row[1] = $"This is text {line / 2}"; row[2] = new DateTime(2001, 6, 6).AddHours(line * 3); row[3] = line % 3 == 0; dt.Rows.Add(row); } using (var dc = new DetailControl()) { dc.HTMLStyle = UnitTestInitializeWin.HTMLStyle; dc.Show(); dc.DataTable = dt; await dc.RefreshDisplayAsync(FilterType.All, UnitTestInitializeCsv.Token); dc.Sort("ID", ListSortDirection.Ascending); } } }