/// <summary>
        /// Remove the screen at the specified location.
        /// </summary>
        /// <returns>true if the operation went through, false if it was canceled by the user.</returns>
        public static bool RemoveScreen(ScreenManagerKernel manager, int targetScreen)
        {
            manager.SetAllToInactive();

            if (targetScreen == -1)
            {
                manager.RemoveFirstEmpty();
                return(true);
            }

            AbstractScreen screenToRemove = manager.GetScreenAt(targetScreen);

            if (screenToRemove is CaptureScreen)
            {
                manager.RemoveScreen(screenToRemove);
                return(true);
            }

            PlayerScreen playerScreen = screenToRemove as PlayerScreen;
            bool         confirmed    = manager.BeforeReplacingPlayerContent(targetScreen);

            if (!confirmed)
            {
                return(false);
            }

            manager.RemoveScreen(screenToRemove);
            return(true);
        }
Ejemplo n.º 2
0
        private static void LoadInSpecificTarget(ScreenManagerKernel manager, int targetScreen, CameraSummary summary)
        {
            AbstractScreen screen = manager.GetScreenAt(targetScreen);

            if (screen is CaptureScreen)
            {
                CaptureScreen captureScreen = screen as CaptureScreen;
                captureScreen.LoadCamera(summary);

                manager.UpdateCaptureBuffers();
                manager.OrganizeScreens();
                manager.OrganizeCommonControls();
                manager.OrganizeMenus();
            }
            else if (screen is PlayerScreen)
            {
                // Loading a camera onto a video should never close the video.
                // We only load the camera if there is room to create a new capture screen, otherwise we do nothing.
                if (manager.ScreenCount == 1)
                {
                    manager.AddCaptureScreen();
                    LoadInSpecificTarget(manager, 1, summary);
                }
            }
        }
Ejemplo n.º 3
0
        public void Execute()
        {
            // We keep the list ordered. [0] = left.
            AbstractScreen temp = m_ScreenManagerKernel.screenList[0];

            m_ScreenManagerKernel.screenList[0] = m_ScreenManagerKernel.screenList[1];
            m_ScreenManagerKernel.screenList[1] = temp;

            // Show new disposition.
            ScreenManagerUserInterface smui = m_ScreenManagerKernel.UI as ScreenManagerUserInterface;

            if (smui != null)
            {
                smui.splitScreens.Panel1.Controls.Clear();
                smui.splitScreens.Panel2.Controls.Clear();

                smui.splitScreens.Panel1.Controls.Add(m_ScreenManagerKernel.screenList[0].UI);
                smui.splitScreens.Panel2.Controls.Add(m_ScreenManagerKernel.screenList[1].UI);
            }

            // the following lines are placed here so they also get called at unexecute.
            m_ScreenManagerKernel.OrganizeMenus();
            m_ScreenManagerKernel.UpdateStatusBar();
            m_ScreenManagerKernel.SwapSync();
            m_ScreenManagerKernel.SetSyncPoint(true);
        }
Ejemplo n.º 4
0
        private static void LoadInSpecificTarget(ScreenManagerKernel manager, int targetScreen, string path, ScreenDescriptionPlayback screenDescription)
        {
            AbstractScreen screen = manager.GetScreenAt(targetScreen);

            if (screen is CaptureScreen)
            {
                // Loading a video onto a capture screen should not close the capture screen.
                // If there is room to add a second screen, we add a playback screen and load the video there, otherwise, we don't do anything.
                if (manager.ScreenCount == 1)
                {
                    manager.AddPlayerScreen();
                    manager.UpdateCaptureBuffers();
                    LoadInSpecificTarget(manager, 1, path, screenDescription);
                }
            }
            else if (screen is PlayerScreen)
            {
                PlayerScreen playerScreen = screen as PlayerScreen;
                bool         confirmed    = manager.BeforeReplacingPlayerContent(targetScreen);
                if (!confirmed)
                {
                    return;
                }

                LoadVideo(playerScreen, path, screenDescription);

                if (playerScreen.FrameServer.Loaded)
                {
                    NotificationCenter.RaiseFileOpened(null, path);
                    PreferencesManager.FileExplorerPreferences.AddRecentFile(path);
                    PreferencesManager.Save();
                }

                manager.OrganizeScreens();
                manager.OrganizeCommonControls();
                manager.OrganizeMenus();
                manager.UpdateStatusBar();
            }
        }
        private static void LoadInSpecificTarget(ScreenManagerKernel manager, int targetScreen, string path, ScreenDescriptionPlayback screenDescription)
        {
            AbstractScreen screen = manager.GetScreenAt(targetScreen);

            if (screen is CaptureScreen)
            {
                // Loading a video onto a capture screen should not close the capture screen.
                // If there is room to add a second screen, we add a playback screen and load the video there, otherwise, we don't do anything.
                if (manager.ScreenCount == 1)
                {
                    manager.AddPlayerScreen();
                    manager.UpdateCaptureBuffers();
                    LoadInSpecificTarget(manager, 1, path, screenDescription);
                }
            }
            else if (screen is PlayerScreen)
            {
                PlayerScreen playerScreen = screen as PlayerScreen;

                if (playerScreen.IsWaitingForIdle)
                {
                    // The player screen will yield its thread after having loaded the first frame and come back later.
                    // We must not launch a new video while it's waiting.
                    log.ErrorFormat("Player screen is currently busy loading the previous video. Aborting load.");
                    return;
                }

                bool confirmed = manager.BeforeReplacingPlayerContent(targetScreen);
                if (!confirmed)
                {
                    return;
                }

                LoadVideo(playerScreen, path, screenDescription);

                bool prefsNeedSaving = false;
                if (screenDescription != null && screenDescription.IsReplayWatcher)
                {
                    PreferencesManager.FileExplorerPreferences.AddRecentWatcher(path);
                    PreferencesManager.FileExplorerPreferences.LastReplayFolder = path;
                    prefsNeedSaving = true;
                }

                if (playerScreen.FrameServer.Loaded)
                {
                    NotificationCenter.RaiseFileOpened(null, path);

                    if (screenDescription != null && screenDescription.IsReplayWatcher)
                    {
                        // At this point we have lost the actual file that was loaded. The path here still contaiins the special '*' to indicate the watched folder.
                        // The actual file is the latest file in the folder this was computed right before loading.
                        string actualPath = FilesystemHelper.GetMostRecentFile(Path.GetDirectoryName(path));
                        PreferencesManager.FileExplorerPreferences.AddRecentFile(actualPath);
                    }
                    else
                    {
                        PreferencesManager.FileExplorerPreferences.AddRecentFile(path);
                    }

                    prefsNeedSaving = true;
                }

                if (prefsNeedSaving)
                {
                    PreferencesManager.Save();
                }

                manager.OrganizeScreens();
                manager.OrganizeCommonControls();
                manager.OrganizeMenus();
                manager.UpdateStatusBar();
            }
        }