/// <summary> /// Organizes the content of the tab. /// </summary> private void OrganizeTabContent() { PositionItemSource = new List <Positions>(); Random rand = new Random(); var imax = rand.Next(8, 10); for (int i = 0; i < imax; i++) { GenerateDumpPositions(rand); } var qry = new List <Positions>(PositionItemSource.DistinctBy(i => i.Pos).OrderBy(i => i.Pos)); AsynchronousQueryExecutor.Call(qry, l => PositionItemSource = new List <Positions>(l), null); TabGrid = new Grid(); TabGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new System.Windows.GridLength(5, System.Windows.GridUnitType.Star) }); TabGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = System.Windows.GridLength.Auto }); TabGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new System.Windows.GridLength(4, System.Windows.GridUnitType.Star) }); GridSplitter gridSplitter = new GridSplitter() { Width = 6 }; DataGrid = new DataGrid { Name = "PositionGrid", CanUserAddRows = true, ItemsSource = PositionItemSource }; ProgramEditor.SetValue(Grid.ColumnProperty, 0); gridSplitter.SetValue(Grid.ColumnProperty, 1); DataGrid.SetValue(Grid.ColumnProperty, 2); TabGrid.Children.Add(ProgramEditor); TabGrid.Children.Add(gridSplitter); TabGrid.Children.Add(DataGrid); TabContent = new Border { BorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromRgb(221, 221, 221)), BorderThickness = new System.Windows.Thickness(1), CornerRadius = new System.Windows.CornerRadius(0, 0, 10, 10), Padding = new System.Windows.Thickness(5), Child = TabGrid }; }
public static void Main(string[] args) { //this could be your linq query var qry = TestSlowLoadingEnumerable(); //We begin the call and give it our callback delegate AsynchronousQueryExecutor.Call <int>(qry, HandleResults); Console.WriteLine("Call began on seperate thread, execution continued"); Console.ReadLine(); }