예제 #1
0
        /// <summary>
        /// Handles the Closing event of the mainWindow control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.ComponentModel.CancelEventArgs"/> instance containing the event data.</param>
        private void mainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            //var rockConfig = RockConfig.Load();
            //var window = sender as NavigationWindow;
            //rockConfig.WindowCurrentHeight = window.ActualHeight;
            //rockConfig.WindowCurrentWidth = window.ActualWidth;
            //rockConfig.Save();
            try
            {
                ImageSafeHelper.CloseDevice();
            }
            catch
            {
                // if image safe is not loaded then just ignore driver exception.
            }

            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();
        }