示例#1
0
        // Update grid labels
        private void UpdateGridLabels()
        {
            if (cameras != null)
            {
                for (int i = 0; i < viewGrid.Rows; i++)
                {
                    for (int j = 0; j < viewGrid.Cols; j++)
                    {
                        // get camera ID of the specified cell of the grid
                        int cameraID = view.GetCamera(i, j);

                        if (cameraID > 0)
                        {
                            Camera c = cameras.GetCamera(cameraID);

                            if (c != null)
                            {
                                viewGrid.SetLabel(c.FullName, i, j);
                            }
                        }
                    }
                }
            }
        }
示例#2
0
        private void OpenView(TreeNode node)
        {
            string fullName = camerasTree.GetViewFullName(node);

            // get view
            View view = config.GetViewByName(fullName);

            // check if it is already running
            if ((viewOpened == true) && (openedID == view.ID))
            {
                return;
            }

            // close previous view
            CloseView();

            // run all cameras
            for (int i = 0; i < view.Rows; i++)
            {
                for (int j = 0; j < view.Cols; j++)
                {
                    // get camera
                    Camera camera = config.cameras.GetCamera(view.GetCamera(i, j));

                    if (camera == null)
                    {
                        continue;
                    }

                    // abort it, if it is in finalization pool
                    finalizationPool.Remove(camera);

                    // add it to running pool
                    if (runningPool.Add(camera))
                    {
                        multiplexer1.SetCamera(i, j, camera);
                    }
                }
            }

            multiplexer1.Rows             = view.Rows;
            multiplexer1.Cols             = view.Cols;
            multiplexer1.SingleCameraMode = false;
            multiplexer1.CamerasVisible   = true;
            multiplexer1.FitToWindow      = true;
            multiplexer1.CellWidth        = view.CellWidth;
            multiplexer1.CellHeight       = view.CellHeight;


            // set title
            this.Text = title + " - " + fullName;

            // reset statistics indexes
            statIndex = 0;
            statReady = 0;

            //
            openedID   = view.ID;
            viewOpened = true;

            // start timer
            //timer.Start();
        }