public CommandAddCaptureScreen(ScreenManagerKernel _smk, bool _bStoreState) { m_ScreenManagerKernel = _smk; if (_bStoreState) { m_ScreenManagerKernel.StoreCurrentState(); } }
public CommandLoadMovieInScreen(ScreenManagerKernel _smk, String _filePath, int _iForceScreen, bool _bStoreState) { screenManagerKernel = _smk; filePath = _filePath; ForceScreen = _iForceScreen; if (_bStoreState) { screenManagerKernel.StoreCurrentState(); } }
/// <summary> /// Execution de la commande /// </summary> public void Execute() { // When there is only one screen, we don't want it to have the "active" screen look. // Since we have 2 screens at most, we first clean up all of them, // and we'll display the active screen look afterwards, only if needed. foreach (AbstractScreen screen in screenManagerKernel.screenList) { screen.DisplayAsActiveScreen(false); } // There are two types of closing demands: explicit and implicit. // explicit-close ask for a specific screen to be closed. // implicit-close just ask for a close, we choose which one here. if (iScreenToRemove >= 0 && iScreenToRemove < screenManagerKernel.screenList.Count) { // Explicit. Make the other one the "active" screen if necessary. // For now, we do different actions based on screen type. (fixme?) if (screenManagerKernel.screenList[iScreenToRemove] is PlayerScreen) { // PlayerScreen, check if dirty and ask for saving if so. PlayerScreen ps = (PlayerScreen)screenManagerKernel.screenList[iScreenToRemove]; bool bRemove = true; if (ps.FrameServer.Metadata.IsDirty) { DialogResult dr = MessageBox.Show(m_ResManager.GetString("InfoBox_MetadataIsDirty_Text", Thread.CurrentThread.CurrentUICulture).Replace("\\n", "\n"), m_ResManager.GetString("InfoBox_MetadataIsDirty_Title", Thread.CurrentThread.CurrentUICulture), MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { // Launch the save dialog. // Note: if user cancels this one, we will not save anything... screenManagerKernel.mnuSaveOnClick(null, EventArgs.Empty); } else if (dr == DialogResult.Cancel) { // Cancel the close. bRemove = false; screenManagerKernel.CancelLastCommand = true; } } if (bRemove) { // We store the current state now. // (We don't store it at construction time to handle the redo case better) if (m_bStoreState) { screenManagerKernel.StoreCurrentState(); } ps.m_PlayerScreenUI.ResetToEmptyState(); screenManagerKernel.screenList.RemoveAt(iScreenToRemove); // TODO: Remove all commands that were executed during this screen life from the command history. // But to do that we'll need a way to tell apart commands based on their parent screen... } } else if (screenManagerKernel.screenList[iScreenToRemove] is CaptureScreen) { // Capture. // We store the current state now. // (We don't store it at construction time to handle the redo case better) if (m_bStoreState) { screenManagerKernel.StoreCurrentState(); } screenManagerKernel.screenList[iScreenToRemove].BeforeClose(); screenManagerKernel.screenList.RemoveAt(iScreenToRemove); // TODO: Remove all commands that were executed during this screen life from the command history. // But to do that we'll need a way to tell apart commands based on their parent screen... } } else { // Implicit close. Find the empty screen. // (We actually know for sure that there is indeed an empty screen). for (int i = 0; i < screenManagerKernel.screenList.Count; i++) { if (!screenManagerKernel.screenList[i].Full) { // We store the current state now. // (We don't store it at construction time to handle the redo case better) if (m_bStoreState) { screenManagerKernel.StoreCurrentState(); } screenManagerKernel.screenList.RemoveAt(i); // TODO: Remove all commands that were executed during this screen life from the command history. // But to do that we'll need a way to tell apart commands based on their parent screen... break; } } } // Handle the remaining screen. if (screenManagerKernel.screenList.Count > 0) { screenManagerKernel.Screen_SetActiveScreen(screenManagerKernel.screenList[0]); } else { // Show back the Thumbnails... } }