Ejemplo n.º 1
0
 public static Delegate [] GetEventCount6( )
 {
     Delegate [] dglist2 = null;
     if (EventControl.BankDataLoaded != null)
     {
         dglist2 = BankDataLoaded?.GetInvocationList( );
     }
     return(dglist2);
 }
 //-------------------------------------------------------------------------------------------------------------------------------------------------//
 protected virtual void OnBankDataLoaded( )
 {
     if (BankDataLoaded != null)
     {
         Console.WriteLine($"Broadcasting from OnBankDataLoaded in ");
         BankDataLoaded?.Invoke(this, new LoadedEventArgs( )
         {
             DataSource = Bankcollection, CallerDb = "BANKACCOUNT"
         });
     }
 }
        public async static Task <bool> LoadBankTaskInSortOrderasync(bool b = false, int i = -1)
        {
            try
            {
                if (dtBank.Rows.Count > 0)
                {
                    dtBank.Clear( );
                }

                if (Bankcollection.Items.Count > 0)
                {
                    Bankcollection.ClearItems( );
                }

                Bankcollection = null;
                Bankcollection = new BankCollection( );

                Console.WriteLine($"Calling Task.Run in Bankcollection ....");
                await Task.Run(async( ) =>
                {
                    Console.WriteLine($"Calling LoadBankData in Task.Run in Bankcollection ....");
                    await LoadBankData( );
                    Console.WriteLine($"Returned from LoadBankData in Task.Run in Bankcollection ....");

                    Application.Current.Dispatcher.Invoke(
                        async( ) =>
                    {
                        Console.WriteLine($"Calling LoadBankCollection in Task.Run in Bankcollection ....");
                        await LoadBankCollection( );
                        Console.WriteLine($"Returned from LoadBankCollection in Task.Run in Bankcollection ....");
                    });
                });

                Console.WriteLine($"**** END **** OF ASYNC CALL METHOD {dtBank . Rows . Count} records in DataTable, {Bankcollection . Count} in Bankcollection ....");
                Console.WriteLine($"**** END **** SENDING CALLBACK MESSAGE TO SQLDBVIEWER WINDOW TO LOAD THEIR DATAGRID !!!");
                if (BankDataLoaded != null)
                {
                    BankDataLoaded.Invoke(Bankcollection, new LoadedEventArgs {
                        CallerDb = "BANKACCOUNT", DataSource = Bankcollection
                    });
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"ERROR in LoadBankTaskInSortOrderAsync() : {ex . Message}, : {ex . Data}");
                return(false);
            }
            return(true);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Central point for TRIGGERING this event
 /// </summary>
 /// <param name="obj"></param>
 /// <param name="e"></param>
 public static void TriggerBankDataLoaded(object obj, LoadedEventArgs e)
 {
     BankDataLoaded?.Invoke(obj, e);
 }