예제 #1
0
        //<SnippetHdcpSessionMethod>
        private void SetHdcpProtection()
        {
            hdcpSession = new HdcpSession();

            // Register an event to get notified when HDCP changes
            hdcpSession.ProtectionChanged += (HdcpSession sender, object eventArgs) =>
            {
                // In case we want to do something with the level
                HdcpProtection?protection = sender.GetEffectiveProtection();

                if (protection != null)
                {
                    currentHdcpProtection = protection.Value;
                }
                else
                {
                    // The current Hdcp protection level is pending... so treat it as though it's off altogether
                    currentHdcpProtection = HdcpProtection.Off;
                }

                // Check the protection
                outputIsProtected = sender.IsEffectiveProtectionAtLeast(desiredHdcpProtection);
            };

            hdcpSession.SetDesiredMinProtectionAsync(desiredHdcpProtection).Completed = (asyncOperation, asyncStatus) =>
            {
                if (HdcpSetProtectionResult.Success != asyncOperation.GetResults())
                {
                    // Handle the case where we failed to set the HDCP protection
                    DebugTextBlock.Text = "ERROR! Something went wrong";
                }

                outputIsProtected = hdcpSession.IsEffectiveProtectionAtLeast(desiredHdcpProtection);
            };
        }
예제 #2
0
        /// <summary>
        /// Handles the radio button selections from the UI and imposes that minimum desired protection
        /// </summary>
        private async void HdcpDesiredMinimumProtection_Click(object sender, RoutedEventArgs e)
        {
            HdcpProtection desiredMinimumProtection = HdcpProtection.Off;
            string         selected = (sender as RadioButton).Tag.ToString();

            if (Enum.TryParse(selected, out desiredMinimumProtection))
            {
                var result = await hdcpSession.SetDesiredMinProtectionAsync(desiredMinimumProtection);

                HdcpProtection?actualProtection = hdcpSession.GetEffectiveProtection();
                if (result != HdcpSetProtectionResult.Success)
                {
                    Log($"ERROR: Unable to set HdcpProtection.{desiredMinimumProtection}, Error: {result}, Actual HDCP: {actualProtection}");
                }
                else
                {
                    Log($"HDCP Requested Minimum: {desiredMinimumProtection}, Actual: {actualProtection}");
                }
            }
        }