private void buttonOK_Click(object sender, EventArgs e)
        {
            log.EnterMethod();

            ApplyConfiguration();
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }
Exemple #2
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            log.EnterMethod();

            //ApplyConfiguration();

            SelectedCamera            = null;
            SelectedChannelName       = null;
            SelectedChannelIdentifier = null;
            DialogResult = DialogResult.Ignore;

            int idx = channelSelectorControl.SelectedIndex;

            if (idx >= 0)
            {
                SelectedCamera            = channelSelectorControl.Cameras[idx];
                SelectedChannelName       = channelSelectorControl.ChannelNames[idx];
                SelectedChannelIdentifier = this.SelectedCamera.ChannelIdentifier(SelectedChannelName);
                channelSelectorControl.ActivateAndSelectChannels();
                DialogResult = DialogResult.OK;
            }

            this.Close();
        }
Exemple #3
0
        public void LoadChannels(List <Camera> cameras, string selectedChannel = null)
        {
            log.EnterMethod();

            this.Cameras.Clear();
            this.ChannelNames.Clear();
            Items.Clear();

            bool multiCamera = cameras.Count > 1;

            foreach (var camera in cameras)
            {
                foreach (var channel in camera.Channels)
                {
                    string itemName = multiCamera
                        ? camera.ChannelIdentifier(channel.Name)
                        : channel.Name;

                    int idx = Items.Add(itemName, camera.IsChannelActive(channel.Name));
                    this.Cameras.Insert(idx, camera);
                    this.ChannelNames.Insert(idx, channel.Name);
                }
            }

            if (!string.IsNullOrWhiteSpace(selectedChannel))
            {
                SelectedItem = selectedChannel;
            }
            else
            {
                if (!multiCamera)
                {
                    SelectedItem = cameras[0].SelectedChannel;
                }
            }

            RecomputeLayout();
        }