// show the setup dialog public void ShowPlugin() { MovingPicturesConfig configScr; try { LoadingPopup loadingPopup = new LoadingPopup(); Thread initThread = new Thread(new ThreadStart(MovingPicturesCore.Initialize)); initThread.IsBackground = true; initThread.Start(); loadingPopup.ShowDialog(); configScr = new MovingPicturesConfig(); } catch (Exception e) { logger.FatalException("Unexpected error from plug-in initialization!", e); return; } try { configScr.ShowDialog(); } catch (Exception e) { MessageBox.Show("There was an unexpected error in the Moving Pictures Configuration screen!", "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error); logger.FatalException("Unexpected error from the Configuration Screen!", e); return; } try { MovingPicturesCore.Shutdown(); } catch (Exception e) { logger.FatalException("Unexpected error from plug-in shutdown!", e); } }
// Take the proper actions when a power event occurs private void PowerEventHandler(MovingPicturesCore.PowerEvent powerEvent) { // ignore the event if we are NOT started AND NOT suspended if (!importerStarted && !importerSuspended) return; if (powerEvent == MovingPicturesCore.PowerEvent.Suspend) { // Stop the importer when suspending and flag that we are suspended Stop(); importerSuspended = true; } else if (powerEvent == MovingPicturesCore.PowerEvent.Resume) { // Start the importer when resuming and reset the suspended flag Start(); importerSuspended = false; } }
// Take the proper actions when a power event occurs private void PowerEventHandler(MovingPicturesCore.PowerEvent powerEvent) { if (powerEvent == MovingPicturesCore.PowerEvent.Suspend) deinit(); else if (powerEvent == MovingPicturesCore.PowerEvent.Resume) init(); }