コード例 #1
0
        //**************************************************************************************************************************************************************//
        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);
        }
コード例 #2
0
        //**************************************************************************************************************************************************************//

        #endregion startup/load data / load collection (Detinternalcollection)
        public static bool SelectViewer(int ViewerType, DetCollection tmp)
        {
            bool result = false;

            switch (ViewerType)
            {
            case 1:
                SqlViewerDetcollection = tmp;
                result = true;
                break;

            case 2:
                EditDbDetcollection = tmp;
                result = true;
                break;

            case 3:
                MultiDetcollection = tmp;
                result             = true;
                break;

            case 4:
                DetViewerDbcollection = tmp;
                result = true;
                break;

            //case 5:
            //	CustViewerDbcollection = tmp;
            //	result = true;
            //	break;
            //case 6:
            //	DetViewerDbcollection = tmp;
            //	result = true;
            //	break;
            //case 7:
            //	SqlViewerCustcollection = tmp;
            //	result = true;
            //	break;
            //case 8:
            //	SqlViewerDetcollection = tmp;
            //	result = true;
            //	break;
            case 9:
                //					= tmp;
                result = true;
                break;
            }
            return(result);
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
 public DetCollection( )
 {
     //set the static pointer to this class
     Detcollection           = this;
     Flags.DetailsCollection = this;
 }