private void Set_ClipboardSource(object sender, RoutedEventArgs e)
        {
            var protectionPolicyManager = ProtectionPolicyManager.GetForCurrentView();

            protectionPolicyManager.Identity = Scenario1.m_enterpriseId;
            rootPage.NotifyUser("Set ProtectionPolicyManager.Identity to: " + Scenario1.m_enterpriseId, NotifyType.StatusMessage);
        }
        private async void PasteButton_Click(object sender, TextControlPasteEventArgs e)
        {
            // Mark the event as handled first. Otherwise, the
            // default paste action will happen, then the custom paste
            // action, and the user will see the text box content change.
            e.Handled = true;

            // Get content from the clipboard.
            var dataPackageView = Windows.ApplicationModel.DataTransfer.Clipboard.GetContent();

            if (dataPackageView.Contains(Windows.ApplicationModel.DataTransfer.StandardDataFormats.Text))
            {
                var response = await dataPackageView.RequestAccessAsync();

                if (response == ProtectionPolicyEvaluationResult.Allowed)
                {
                    (sender as TextBox).Text = await dataPackageView.GetTextAsync();

                    string sourceId = dataPackageView.Properties.EnterpriseId != null ? dataPackageView.Properties.EnterpriseId : "<Personal>";
                    string targetId = ProtectionPolicyManager.GetForCurrentView().Identity != null ? dataPackageView.Properties.EnterpriseId : "<Personal>";
                    string message  = "Successfully pasted text from EnterpriseId " + sourceId + " to EnterpriseId " + targetId;
                    rootPage.NotifyUser(message, NotifyType.StatusMessage);
                }
                else
                {
                    rootPage.NotifyUser("User or policy blocked access", NotifyType.StatusMessage);
                }
            }
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            rootPage = MainPage.Current;
            var protectionPolicyManager = ProtectionPolicyManager.GetForCurrentView();

            protectionPolicyManager.Identity = ""; // personal context
            InputTxtBox.Text = "Copy and paste this text to a non-enterprise app such as notepad";
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            rootPage = MainPage.Current;

            var protectionPolicyManager = ProtectionPolicyManager.GetForCurrentView();

            protectionPolicyManager.Identity = ""; // personal context
            InputTxtBox.PlaceholderText      = "Copy Text here from a non-enterprise app";
        }
Beispiel #5
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            rootPage = MainPage.Current;

            var protectionPolicyManager = ProtectionPolicyManager.GetForCurrentView();

            protectionPolicyManager.Identity = ""; // personal
            InputTxtBox.PlaceholderText      = "Paste any text here";
        }
 private void Set_ClipboardSource(object sender, RoutedEventArgs e)
 {
     try
     {
         ProtectionPolicyManager ppManager = ProtectionPolicyManager.GetForCurrentView();
         ppManager.Identity = Scenario1.m_EnterpriseIdentity;
         rootPage.NotifyUser("Set ProtectionPolicyManager.Identity to: " + Scenario1.m_EnterpriseIdentity, NotifyType.StatusMessage);
     }
     catch (Exception ex)
     {
         rootPage.NotifyUser(ex.ToString(), NotifyType.ErrorMessage);
     }
 }
        bool IsClipboardPeekAllowedAsync()
        {
            var result          = ProtectionPolicyEvaluationResult.Blocked;
            var dataPackageView = Clipboard.GetContent();

            if (dataPackageView.Contains("text"))
            {
                var protectionPolicyManager = ProtectionPolicyManager.GetForCurrentView();
                result = ProtectionPolicyManager.CheckAccess(dataPackageView.Properties.EnterpriseId,
                                                             protectionPolicyManager.Identity);
            }

            // Since this is a convenience feature to allow a peek of clipboard content,
            // if state is Blocked or ConsentRequired, do not show peek.

            return(result == ProtectionPolicyEvaluationResult.Allowed);
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            rootPage = MainPage.Current;

            try
            {
                // Set protectionPolicyManager.Identity to "" so that current view is personal

                ProtectionPolicyManager protectionPolicyManager = ProtectionPolicyManager.GetForCurrentView();
                protectionPolicyManager.Identity = "";
                InputTxtBox.PlaceholderText      = "Copy Text here from a non-enterprise app";
            }
            catch (Exception ex)
            {
                rootPage.NotifyUser(ex.ToString(), NotifyType.ErrorMessage);
            }
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            rootPage = MainPage.Current;

            try
            {
                // Set view as personal

                ProtectionPolicyManager protectionPolicyManager = ProtectionPolicyManager.GetForCurrentView();
                protectionPolicyManager.Identity = "";
                InputTxtBox.PlaceholderText      = "Paste any text here";
            }
            catch (Exception ex)
            {
                rootPage.NotifyUser(ex.ToString(), NotifyType.ErrorMessage);
            }
        }