//**************************************************************************************************************************************************************// public async static Task <bool> LoadDetailsTaskInSortOrderAsync(bool b = false) { try { if (dtDetails.Rows.Count > 0) { dtDetails.Clear( ); } if (Detcollection.Items.Count > 0) { Detcollection.ClearItems( ); } Detcollection = new DetCollection( ); st = Stopwatch.StartNew( ); Console.WriteLine($"Calling Task.Run in Detcollection ...."); await Task.Run(async( ) => { Console.WriteLine($"Calling LoadtailsDataSql in Task.Run in Detcollection ...."); await LoadDetailsDataSql( ); Console.WriteLine($"Returned from LoadDetailsDataSql in Task.Run in Detcollection ...."); }); Application.Current.Dispatcher.Invoke( () => { LoadDetCollection( ); }); st.Stop( ); Console.WriteLine($"**** END **** OF ASYNC CALL METHOD {dtDetails . Rows . Count} records in DataTable, {Detcollection . Count} in Detcollection ...."); Console.WriteLine($"**** END **** SENDING CALLBACK MESSAGE TO SQLDBVIEWER WINDOW TO LOAD THEIR DATAGRID !!!"); if (DetDataLoaded != null) { DetDataLoaded.Invoke(Detcollection, new LoadedEventArgs { CallerDb = "DETAILS", DataSource = Detcollection }); } } catch (Exception ex) { Console.WriteLine($"ERROR in LoadDetailsTaskInSortOrderAsync() : {ex . Message}, : {ex . Data}"); return(false); } return(true); }
public static DetCollection LoadDet(DetCollection dc, int ViewerType = 1) { // Called to Load/reload the One & Only Bankcollection data source if (dtDetails.Rows.Count > 0) { dtDetails.Clear( ); } if (dc != null) { Detinternalcollection = dc; } else { Detinternalcollection = new DetCollection( ); } if (Detinternalcollection.Count > 0) { Detinternalcollection.ClearItems( ); } DetCollection d = new DetCollection(); d.LoadDetailsDataSql( ); if (dtDetails.Rows.Count > 0) { LoadDetTest(Detinternalcollection); } // We now have the ONE AND ONLY pointer the the Bank data in variable Bankcollection Flags.DetCollection = Detinternalcollection; if (Flags.IsMultiMode == false) { // Finally fill and return The global Dataset SelectViewer(ViewerType, Detinternalcollection); return(Detinternalcollection); } else { // return the "working copy" pointer, it has filled the relevant collection to match the viewer return(Detinternalcollection); } }