コード例 #1
0
ファイル: PtzPage.cs プロジェクト: kudrinyaroslav/ON-0110
        private void cmbPTZProfiles_SelectedIndexChanged(object sender, EventArgs e)
        {
            Media.Profile          profile = (cmbPTZProfiles.SelectedItem != null) ? (cmbPTZProfiles.SelectedItem as ProfileWrapper).Profile : null;
            Media.PTZConfiguration config  = profile != null ? profile.PTZConfiguration : null;
            btnAddPTZConfig.Enabled = (config == null);

            panelAbsoluteMove.Enabled  = (rbAbsoluteMove.Checked || rbRelativeMove.Checked) && !string.IsNullOrEmpty(PTZAddress) && (config != null);
            panelContiniusMove.Enabled = rbContuniousMove.Checked && !string.IsNullOrEmpty(PTZAddress) && (config != null);
            rbAbsoluteMove.Enabled     = !string.IsNullOrEmpty(PTZAddress) && (config != null);
            rbRelativeMove.Enabled     = !string.IsNullOrEmpty(PTZAddress) && (config != null);
            rbContuniousMove.Enabled   = !string.IsNullOrEmpty(PTZAddress) && (config != null);
        }
コード例 #2
0
ファイル: PtzPage.cs プロジェクト: kudrinyaroslav/ON-0110
        public void EnableControls(bool enable)
        {
            Invoke(new Action(() =>
            {
                DiscoveredDevices devices = ContextController.GetDiscoveredDevices();
                string address            = devices != null ? devices.ServiceAddress : string.Empty;

                Media.Profile profile         = (cmbPTZProfiles.SelectedItem != null) ? (cmbPTZProfiles.SelectedItem as ProfileWrapper).Profile : null;
                Media.PTZConfiguration config = profile != null ? profile.PTZConfiguration : null;

                btnGetPtzUrl.Enabled       = enable && !string.IsNullOrEmpty(address);
                btnGetProfiles.Enabled     = enable && !string.IsNullOrEmpty(MediaAddress);
                btnVideo.Enabled           = (enable && !string.IsNullOrEmpty(MediaAddress)) || (_videoWindow != null);
                rbAbsoluteMove.Enabled     = enable && !string.IsNullOrEmpty(PTZAddress) && (config != null);
                rbRelativeMove.Enabled     = enable && !string.IsNullOrEmpty(PTZAddress) && (config != null);
                rbContuniousMove.Enabled   = enable && !string.IsNullOrEmpty(PTZAddress) && (config != null);
                panelAbsoluteMove.Enabled  = enable && (rbAbsoluteMove.Checked || rbRelativeMove.Checked) && !string.IsNullOrEmpty(PTZAddress) && (config != null);
                panelContiniusMove.Enabled = enable && rbContuniousMove.Checked && !string.IsNullOrEmpty(PTZAddress) && (config != null);
                btnAddPTZConfig.Enabled    = enable && (profile != null) && (config == null);

                cmbPTZProfiles.Enabled = enable;
            }));
        }