Пример #1
0
 public static Delegate [] GetEventCount8( )
 {
     Delegate [] dglist2 = null;
     if (DetDataLoaded != null)
     {
         dglist2 = DetDataLoaded?.GetInvocationList( );
     }
     return(dglist2);
 }
 //-------------------------------------------------------------------------------------------------------------------------------------------------//
 protected virtual void OnDetDataLoaded( )
 {
     if (DetDataLoaded != null)
     {
         Console.WriteLine($"Broadcasting from OnDetDataLoaded in ");
         DetDataLoaded?.Invoke(this, new LoadedEventArgs( )
         {
             DataSource = Detcollection, CallerDb = "DETAILS"
         });
     }
 }
        //**************************************************************************************************************************************************************//
        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);
        }
Пример #4
0
 public static void TriggerDetDataLoaded(object obj, LoadedEventArgs e)
 {
     DetDataLoaded?.Invoke(obj, e);
 }