Example #1
0
        private Color GetBorderColor(MonitorSelection.CellInputMode inputMode)
        {
            switch (inputMode)
            {
            case MonitorSelection.CellInputMode.DigitalPtz:
                return(Color.MediumPurple);

            case MonitorSelection.CellInputMode.Playback:
                return(Color.Orange);

            case MonitorSelection.CellInputMode.Ptz:
                return(Color.SteelBlue);

            default:
                return(Color.ForestGreen);
            }
        }
Example #2
0
        /// <summary>
        /// The ButtonChangeMode_Click method.
        /// </summary>
        /// <param name="sender">The <paramref name="sender"/> parameter.</param>
        /// <param name="args">The <paramref name="args"/> parameter.</param>
        private void ButtonChangeMode_Click(object sender, EventArgs args)
        {
            var comboBox = new ComboBox();

            comboBox.Items.Add(MonitorSelection.CellInputMode.Unknown.ToString());
            comboBox.Items.Add(MonitorSelection.CellInputMode.DigitalPtz.ToString());
            comboBox.Items.Add(MonitorSelection.CellInputMode.Navigation.ToString());
            comboBox.Items.Add(MonitorSelection.CellInputMode.Playback.ToString());
            comboBox.Items.Add(MonitorSelection.CellInputMode.Ptz.ToString());

            var inputModeValue = (int)CurrentInputMode;

            comboBox.SelectedIndex = inputModeValue;
            InputBox.Show("Cell Input Mode", "Select a new cell input mode:", comboBox, ref inputModeValue);
            var selectedMode = (MonitorSelection.CellInputMode)inputModeValue;

            if (CurrentInputMode != selectedMode)
            {
                CurrentInputMode = selectedMode;
                CurrentMonitorWall.SetMonitorSelection(CurrentCellIndex, CurrentMonitorIndex, CurrentInputMode);
                RefreshSelections(true);
            }
        }
Example #3
0
        /// <summary>
        /// The LabelCell_Click method.
        /// </summary>
        /// <param name="cellIndex">The <paramref name="cellIndex"/> parameter.</param>
        public void SelectCell(int cellIndex, string userName, MonitorSelection.CellInputMode inputMode)
        {
            var currentUserColor = GetBorderColor(inputMode);
            var panel            = _tlpCells.Controls.OfType <Panel>().FirstOrDefault(ctrl => ctrl.TabIndex == cellIndex - 1);

            if (panel != null)
            {
                // Set the highlight for the selected panel.
                if (SelectedPanels.ContainsKey(userName))
                {
                    if (SelectedPanels[userName] == panel)
                    {
                        return;
                    }

                    var currlabel = panel.Controls[0] as Label;
                    if (userName == MainForm.CurrentUserName)
                    {
                        currlabel.Text  = userName;
                        panel.BackColor = currentUserColor;
                    }
                    else
                    {
                        if (panel.BackColor != currentUserColor)
                        {
                            currlabel.Text  = userName;
                            panel.BackColor = Color.White;
                        }
                    }


                    var oldUserName = SelectedPanels[userName].Tag as string;
                    var prevLabel   = SelectedPanels[userName].Controls[0] as Label;
                    if (oldUserName == null)
                    {
                        prevLabel.Text = string.Empty;
                        SelectedPanels[userName].BackColor = Color.Black;
                    }
                    else
                    {
                        prevLabel.Text = oldUserName;
                        SelectedPanels[userName].BackColor = Color.White;
                    }

                    SelectedPanels[userName] = panel;
                }
                else
                {
                    if (userName == MainForm.CurrentUserName)
                    {
                        panel.BackColor = currentUserColor;
                    }
                    else
                    {
                        panel.Tag = userName;
                        if (panel.BackColor != currentUserColor)
                        {
                            panel.BackColor = Color.White;
                        }
                    }

                    var label = panel.Controls[0] as Label;
                    if (label != null)
                    {
                        label.Text = userName;
                    }

                    SelectedPanels.Add(userName, panel);
                }
            }
        }
Example #4
0
        /// <summary>
        /// The DisplayMonitorPosition method.
        /// </summary>
        /// <param name="position">The monitor position to display.</param>
        public void DisplayMonitorPosition(MonitorPosition position)
        {
            var width  = position.Position.Width / 2;
            var height = position.Position.Height / 2;

            int left = 0;

            if (position.Position.Left > 0)
            {
                left = position.Position.Left / 2;
            }

            int top = 0;

            if (position.Position.Top > 0)
            {
                top = position.Position.Top / 2;
            }

            if (position.Position.Width < 10)
            {
                width = 10;
            }

            if (position.Position.Height < 10)
            {
                height = 10;
            }

            var monitors     = CurrentMonitorWall.Monitors;
            var monitor      = monitors.FirstOrDefault(mon => mon.Id == position.MonitorId);
            var monitorIndex = monitors.IndexOf(monitor) + 1;

            Monitor.Layouts layout = monitor?.Layout ?? Monitor.Layouts.CellLayout4x4;

            CurrentCellIndex = 0;
            foreach (MonitorSelection selection in CurrentMonitorSelections)
            {
                if (selection.Owner.Split('@')[0] == MainForm.CurrentUserName && selection.Monitor == monitorIndex)
                {
                    CurrentCellIndex    = selection.Cell;
                    CurrentMonitorIndex = selection.Monitor;
                    CurrentInputMode    = selection.InputMode;
                }
            }

            var panel = new MonitorSelectionPanel(this, layout, CurrentCellIndex)
            {
                Tag         = position,
                Location    = new Point(left, top),
                Size        = new Size(width, height),
                BorderStyle = BorderStyle.FixedSingle
            };

            foreach (MonitorSelection selection in CurrentMonitorSelections)
            {
                if (selection.Owner.Split('@')[0] != MainForm.CurrentUserName && selection.Monitor == monitorIndex)
                {
                    panel.SelectCell(selection.Cell, selection.Owner.Split('@')[0], CurrentInputMode);
                }
            }

            var monitorIdFilter = new Dictionary <Filters.Value, string> {
                { Filters.Value.Id, position.MonitorId }
            };
            var monitorName = MainForm.CurrentSystem.GetMonitors(monitorIdFilter).FirstOrDefault()?.Name ?? position.MonitorId;

            AddMonitorSelectionPanel(panel, monitorName);
        }