CheckCompliance() public method

public CheckCompliance ( ) : EasComplianceResults
return EasComplianceResults
        private void Launch_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                EasClientSecurityPolicy RequestedPolicy = new EasClientSecurityPolicy();
                EasComplianceResults ComplianceResult = null;

                if (RequireEncryptionValue == null)
                {
                    RequestedPolicy.RequireEncryption = false;
                }
                else
                {
                    if (RequireEncryptionValue.SelectedIndex == 1)
                    {
                        RequestedPolicy.RequireEncryption = true;
                    }
                    else
                    {
                        RequestedPolicy.RequireEncryption = false;
                    }
                }

                if (MinPasswordLengthValue == null || MinPasswordLengthValue.Text.Length == 0)
                {
                    RequestedPolicy.MinPasswordLength = 0;
                }
                else
                {
                    RequestedPolicy.MinPasswordLength = Convert.ToByte(MinPasswordLengthValue.Text);
                }

                if (DisallowConvenienceLogonValue == null)
                {
                    RequestedPolicy.DisallowConvenienceLogon = false;
                }
                else
                {
                    if (DisallowConvenienceLogonValue.SelectedIndex == 1)
                    {
                        RequestedPolicy.DisallowConvenienceLogon = true;
                    }
                    else
                    {
                        RequestedPolicy.DisallowConvenienceLogon = false;
                    }
                }

                if (MinPasswordComplexCharactersValue == null || MinPasswordComplexCharactersValue.Text.Length == 0)
                {
                    RequestedPolicy.MinPasswordComplexCharacters = 0;
                }
                else
                {
                    RequestedPolicy.MinPasswordComplexCharacters = Convert.ToByte(MinPasswordComplexCharactersValue.Text);
                }

                if (PasswordExpirationValue == null || PasswordExpirationValue.Text.Length == 0)
                {
                    RequestedPolicy.PasswordExpiration = TimeSpan.Parse("0");
                }
                else
                {
                    RequestedPolicy.PasswordExpiration = TimeSpan.FromDays(Convert.ToDouble(PasswordExpirationValue.Text));
                }

                if (PasswordHistoryValue == null || PasswordHistoryValue.Text.Length == 0)
                {
                    RequestedPolicy.PasswordHistory = 0;
                }
                else
                {
                    RequestedPolicy.PasswordHistory = Convert.ToByte(PasswordHistoryValue.Text);
                }

                if (MaxPasswordFailedAttemptsValue == null || MaxPasswordFailedAttemptsValue.Text.Length == 0)
                {
                    RequestedPolicy.MaxPasswordFailedAttempts = 0;
                }
                else
                {
                    RequestedPolicy.MaxPasswordFailedAttempts = Convert.ToByte(MaxPasswordFailedAttemptsValue.Text);
                }

                if (MaxInactivityTimeLockValue == null || MaxInactivityTimeLockValue.Text.Length == 0)
                {
                    RequestedPolicy.MaxInactivityTimeLock = TimeSpan.Parse("0");
                }
                else
                {
                    RequestedPolicy.MaxInactivityTimeLock = TimeSpan.FromSeconds(Convert.ToDouble(MaxInactivityTimeLockValue.Text));
                }

                ComplianceResult = RequestedPolicy.CheckCompliance();

                RequireEncryptionResult.Text = ComplianceResult.RequireEncryptionResult.ToString();
                EncryptionProviderTypeResult.Text = ComplianceResult.EncryptionProviderType.ToString();
                MinPasswordLengthResult.Text = ComplianceResult.MinPasswordLengthResult.ToString();
                DisallowConvenienceLogonResult.Text = ComplianceResult.DisallowConvenienceLogonResult.ToString();
                MinPasswordComplexCharactersResult.Text = ComplianceResult.MinPasswordComplexCharactersResult.ToString();
                PasswordExpirationResult.Text = ComplianceResult.PasswordExpirationResult.ToString();
                PasswordHistoryResult.Text = ComplianceResult.PasswordHistoryResult.ToString();
                MaxPasswordFailedAttemptsResult.Text = ComplianceResult.MaxPasswordFailedAttemptsResult.ToString();
                MaxInactivityTimeLockResult.Text = ComplianceResult.MaxInactivityTimeLockResult.ToString();
            }
            catch (Exception Error)
            {
                rootPage.NotifyUser(Error.Message, NotifyType.ErrorMessage);
            }
        }
        private void Launch_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Page outputFrame = (Page)rootPage.OutputFrame.Content;
                EasClientSecurityPolicy RequestedPolicy  = new Windows.Security.ExchangeActiveSyncProvisioning.EasClientSecurityPolicy();
                EasComplianceResults    ComplianceResult = null;


                CheckBox RequireEncryptionValue = outputFrame.FindName("RequireEncryptionValue") as CheckBox;
                if (RequireEncryptionValue == null)
                {
                    RequestedPolicy.RequireEncryption = false;
                }
                else
                {
                    if (RequireEncryptionValue.IsChecked == true)
                    {
                        RequestedPolicy.RequireEncryption = true;
                    }
                    else
                    {
                        RequestedPolicy.RequireEncryption = false;
                    }
                }

                TextBox MinPasswordLengthValue = outputFrame.FindName("MinPasswordLengthValue") as TextBox;
                if (MinPasswordLengthValue == null || MinPasswordLengthValue.Text.Length == 0)
                {
                    RequestedPolicy.MinPasswordLength = 0;
                }
                else
                {
                    RequestedPolicy.MinPasswordLength = Convert.ToByte(MinPasswordLengthValue.Text);
                }

                CheckBox DisallowConvenienceLogonValue = outputFrame.FindName("DisallowConvenienceLogonValue") as CheckBox;
                if (DisallowConvenienceLogonValue == null)
                {
                    RequestedPolicy.DisallowConvenienceLogon = false;
                }
                else
                {
                    if (DisallowConvenienceLogonValue.IsChecked == true)
                    {
                        RequestedPolicy.DisallowConvenienceLogon = true;
                    }
                    else
                    {
                        RequestedPolicy.DisallowConvenienceLogon = false;
                    }
                }

                TextBox MinPasswordComplexCharactersValue = outputFrame.FindName("MinPasswordComplexCharactersValue") as TextBox;
                if (MinPasswordComplexCharactersValue == null || MinPasswordComplexCharactersValue.Text.Length == 0)
                {
                    RequestedPolicy.MinPasswordComplexCharacters = 0;
                }
                else
                {
                    RequestedPolicy.MinPasswordComplexCharacters = Convert.ToByte(MinPasswordComplexCharactersValue.Text);
                }

                TextBox PasswordExpirationValue = outputFrame.FindName("PasswordExpirationValue") as TextBox;
                if (PasswordExpirationValue == null || PasswordExpirationValue.Text.Length == 0)
                {
                    RequestedPolicy.PasswordExpiration = TimeSpan.Parse("0");
                }
                else
                {
                    RequestedPolicy.PasswordExpiration = TimeSpan.FromDays(Convert.ToDouble(PasswordExpirationValue.Text));
                }

                TextBox PasswordHistoryValue = outputFrame.FindName("PasswordHistoryValue") as TextBox;
                if (PasswordHistoryValue == null || PasswordHistoryValue.Text.Length == 0)
                {
                    RequestedPolicy.PasswordHistory = 0;
                }
                else
                {
                    RequestedPolicy.PasswordHistory = Convert.ToByte(PasswordHistoryValue.Text);
                }

                TextBox MaxPasswordFailedAttemptsValue = outputFrame.FindName("MaxPasswordFailedAttemptsValue") as TextBox;
                if (MaxPasswordFailedAttemptsValue == null || MaxPasswordFailedAttemptsValue.Text.Length == 0)
                {
                    RequestedPolicy.MaxPasswordFailedAttempts = 0;
                }
                else
                {
                    RequestedPolicy.MaxPasswordFailedAttempts = Convert.ToByte(MaxPasswordFailedAttemptsValue.Text);
                }

                TextBox MaxInactivityTimeLockValue = outputFrame.FindName("MaxInactivityTimeLockValue") as TextBox;
                if (MaxInactivityTimeLockValue == null || MaxInactivityTimeLockValue.Text.Length == 0)
                {
                    RequestedPolicy.MaxInactivityTimeLock = TimeSpan.Parse("0");
                }
                else
                {
                    RequestedPolicy.MaxInactivityTimeLock = TimeSpan.FromSeconds(Convert.ToDouble(MaxInactivityTimeLockValue.Text));
                }

                ComplianceResult = RequestedPolicy.CheckCompliance();

                TextBox RequireEncryptionResult = outputFrame.FindName("RequireEncryptionResult") as TextBox;
                RequireEncryptionResult.Text = ComplianceResult.RequireEncryptionResult.ToString();

                TextBox MinPasswordLengthResult = outputFrame.FindName("MinPasswordLengthResult") as TextBox;
                MinPasswordLengthResult.Text = ComplianceResult.MinPasswordLengthResult.ToString();

                TextBox DisallowConvenienceLogonResult = outputFrame.FindName("DisallowConvenienceLogonResult") as TextBox;
                DisallowConvenienceLogonResult.Text = ComplianceResult.DisallowConvenienceLogonResult.ToString();

                TextBox MinPasswordComplexCharactersResult = outputFrame.FindName("MinPasswordComplexCharactersResult") as TextBox;
                MinPasswordComplexCharactersResult.Text = ComplianceResult.MinPasswordComplexCharactersResult.ToString();

                TextBox PasswordExpirationResult = outputFrame.FindName("PasswordExpirationResult") as TextBox;
                PasswordExpirationResult.Text = ComplianceResult.PasswordExpirationResult.ToString();

                TextBox PasswordHistoryResult = outputFrame.FindName("PasswordHistoryResult") as TextBox;
                PasswordHistoryResult.Text = ComplianceResult.PasswordHistoryResult.ToString();

                TextBox MaxPasswordFailedAttemptsResult = outputFrame.FindName("MaxPasswordFailedAttemptsResult") as TextBox;
                MaxPasswordFailedAttemptsResult.Text = ComplianceResult.MaxPasswordFailedAttemptsResult.ToString();

                TextBox MaxInactivityTimeLockResult = outputFrame.FindName("MaxInactivityTimeLockResult") as TextBox;
                MaxInactivityTimeLockResult.Text = ComplianceResult.MaxInactivityTimeLockResult.ToString();
            }
            catch (Exception Error)
            {
                //
                // Bad Parameter, COM Unavailable errors are to be handled here.
                //
                DebugPrint(Error.ToString());
            }
        }
        private void Launch_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                EasClientSecurityPolicy RequestedPolicy = new Windows.Security.ExchangeActiveSyncProvisioning.EasClientSecurityPolicy();
                EasComplianceResults ComplianceResult = null;


                CheckBox RequireEncryptionValue = rootPage.FindName("RequireEncryptionValue") as CheckBox;
                if (RequireEncryptionValue == null)
                    RequestedPolicy.RequireEncryption = false;
                else
                {
                    if (RequireEncryptionValue.IsChecked == true)
                        RequestedPolicy.RequireEncryption = true;
                    else
                        RequestedPolicy.RequireEncryption = false;
                }

                TextBox MinPasswordLengthValue = rootPage.FindName("MinPasswordLengthValue") as TextBox;
                if (MinPasswordLengthValue == null || MinPasswordLengthValue.Text.Length == 0)
                    RequestedPolicy.MinPasswordLength = 0;
                else
                {
                    RequestedPolicy.MinPasswordLength = Convert.ToByte(MinPasswordLengthValue.Text);
                }

                CheckBox DisallowConvenienceLogonValue = rootPage.FindName("DisallowConvenienceLogonValue") as CheckBox;
                if (DisallowConvenienceLogonValue == null)
                    RequestedPolicy.DisallowConvenienceLogon = false;
                else
                {
                    if (DisallowConvenienceLogonValue.IsChecked == true)
                        RequestedPolicy.DisallowConvenienceLogon = true;
                    else
                        RequestedPolicy.DisallowConvenienceLogon = false;
                }

                TextBox MinPasswordComplexCharactersValue = rootPage.FindName("MinPasswordComplexCharactersValue") as TextBox;
                if (MinPasswordComplexCharactersValue == null || MinPasswordComplexCharactersValue.Text.Length == 0)
                    RequestedPolicy.MinPasswordComplexCharacters = 0;
                else
                {
                    RequestedPolicy.MinPasswordComplexCharacters = Convert.ToByte(MinPasswordComplexCharactersValue.Text);
                }

                TextBox PasswordExpirationValue = rootPage.FindName("PasswordExpirationValue") as TextBox;
                if (PasswordExpirationValue == null || PasswordExpirationValue.Text.Length == 0)
                    RequestedPolicy.PasswordExpiration = TimeSpan.Parse("0");
                else
                {
                    RequestedPolicy.PasswordExpiration = TimeSpan.FromDays(Convert.ToDouble(PasswordExpirationValue.Text));
                }

                TextBox PasswordHistoryValue = rootPage.FindName("PasswordHistoryValue") as TextBox;
                if (PasswordHistoryValue == null || PasswordHistoryValue.Text.Length == 0)
                    RequestedPolicy.PasswordHistory = 0;
                else
                {
                    RequestedPolicy.PasswordHistory = Convert.ToByte(PasswordHistoryValue.Text);
                }

                TextBox MaxPasswordFailedAttemptsValue = rootPage.FindName("MaxPasswordFailedAttemptsValue") as TextBox;
                if (MaxPasswordFailedAttemptsValue == null || MaxPasswordFailedAttemptsValue.Text.Length == 0)
                    RequestedPolicy.MaxPasswordFailedAttempts = 0;
                else
                {
                    RequestedPolicy.MaxPasswordFailedAttempts = Convert.ToByte(MaxPasswordFailedAttemptsValue.Text);
                }

                TextBox MaxInactivityTimeLockValue = rootPage.FindName("MaxInactivityTimeLockValue") as TextBox;
                if (MaxInactivityTimeLockValue == null || MaxInactivityTimeLockValue.Text.Length == 0)
                    RequestedPolicy.MaxInactivityTimeLock = TimeSpan.Parse("0");
                else
                {
                    RequestedPolicy.MaxInactivityTimeLock = TimeSpan.FromSeconds(Convert.ToDouble(MaxInactivityTimeLockValue.Text));
                }

                ComplianceResult = RequestedPolicy.CheckCompliance();

                TextBox RequireEncryptionResult = rootPage.FindName("RequireEncryptionResult") as TextBox;
                RequireEncryptionResult.Text = ComplianceResult.RequireEncryptionResult.ToString();

                TextBox EncryptionProviderTypeResult = rootPage.FindName("EncryptionProviderTypeResult") as TextBox;
                EncryptionProviderTypeResult.Text = ComplianceResult.EncryptionProviderType.ToString();

                TextBox MinPasswordLengthResult = rootPage.FindName("MinPasswordLengthResult") as TextBox;
                MinPasswordLengthResult.Text = ComplianceResult.MinPasswordLengthResult.ToString();

                TextBox DisallowConvenienceLogonResult = rootPage.FindName("DisallowConvenienceLogonResult") as TextBox;
                DisallowConvenienceLogonResult.Text = ComplianceResult.DisallowConvenienceLogonResult.ToString();

                TextBox MinPasswordComplexCharactersResult = rootPage.FindName("MinPasswordComplexCharactersResult") as TextBox;
                MinPasswordComplexCharactersResult.Text = ComplianceResult.MinPasswordComplexCharactersResult.ToString();

                TextBox PasswordExpirationResult = rootPage.FindName("PasswordExpirationResult") as TextBox;
                PasswordExpirationResult.Text = ComplianceResult.PasswordExpirationResult.ToString();

                TextBox PasswordHistoryResult = rootPage.FindName("PasswordHistoryResult") as TextBox;
                PasswordHistoryResult.Text = ComplianceResult.PasswordHistoryResult.ToString();

                TextBox MaxPasswordFailedAttemptsResult = rootPage.FindName("MaxPasswordFailedAttemptsResult") as TextBox;
                MaxPasswordFailedAttemptsResult.Text = ComplianceResult.MaxPasswordFailedAttemptsResult.ToString();

                TextBox MaxInactivityTimeLockResult = rootPage.FindName("MaxInactivityTimeLockResult") as TextBox;
                MaxInactivityTimeLockResult.Text = ComplianceResult.MaxInactivityTimeLockResult.ToString();
            }
            catch (Exception Error)
            {
                //
                // Bad Parameter, COM Unavailable errors are to be handled here.
                //
                DebugPrint(Error.ToString());
            }

        }