Rock.Apps.CheckScannerUtility.MainWindow.mainWindow_Closing C# (CSharp) Method

mainWindow_Closing() private method

Handles the Closing event of the mainWindow control.
private mainWindow_Closing ( object sender, System e ) : void
sender object The source of the event.
e System The instance containing the event data.
return void
        private void mainWindow_Closing( object sender, System.ComponentModel.CancelEventArgs e )
        {
            BatchPage batchPage = null;
            if ( mainWindow.Content is BatchPage )
            {
                batchPage = mainWindow.Content as BatchPage;
            }
            else if ( mainWindow.Content is ScanningPage )
            {
                batchPage = ( mainWindow.Content as ScanningPage ).batchPage;
            }

            if ( batchPage != null && batchPage.rangerScanner != null)
            {
                batchPage.rangerScanner.ShutDown();
            }

            Application.Current.Shutdown();
        }