Esempio n. 1
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
			var licenseContent = @"<License>
                                    <Id>77d4c193-6088-4c64-9663-ed7398ae8c1a</Id>
                                    <Type>Trial</Type>
                                    <Expiration>Thu, 31 Dec 2009 23:00:00 GMT</Expiration>
                                    <Quantity>1</Quantity>
                                    <Customer>
                                    <Name>John Doe</Name>
                                    <Email>[email protected]</Email>
                                    </Customer>
                                    <LicenseAttributes />
                                    <ProductFeatures />
                                    <Signature>MEUCIQDdDpq/Ddt4hZJlird/BcR6FVKLdWF/DENnd6r/0LuB3gIgVm7RSQx5mcjC32JjCoHNdoL8C+etXOtWKiYGLCT4q6w=</Signature>
                                </License>";

			var license = License.Load(licenseContent);
			
			var validationFailures =
				license.Validate()
					.ExpirationDate()
						.When(lic => lic.Type == LicenseType.Trial)
					.And()
					.Signature(licensePublicKey)
					.AssertValidLicense().ToList();
			
			if (validationFailures.Any())
			{
				var messageBuilder = new StringBuilder();
				foreach (var validationFailure in validationFailures)
				{
					messageBuilder.AppendLine("Failure:");
					messageBuilder.AppendLine(validationFailure.Message);
					messageBuilder.AppendLine(" ");
					messageBuilder.AppendLine("Resolve issue by:");
					messageBuilder.AppendLine(validationFailure.HowToResolve);
					messageBuilder.AppendLine(" ");
					messageBuilder.AppendLine(" ");
				}
				
				new UIAlertView ("License validation failure!", messageBuilder.ToString(), null, "Cancel").Show();
			}

            window = new UIWindow(UIScreen.MainScreen.Bounds);

            viewController = new MyViewController();
            window.RootViewController = viewController;

            window.MakeKeyAndVisible();

            return true;
        }
Esempio n. 2
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            var licenseContent = @"<License>
                                    <Id>77d4c193-6088-4c64-9663-ed7398ae8c1a</Id>
                                    <Type>Trial</Type>
                                    <Expiration>Thu, 31 Dec 2009 23:00:00 GMT</Expiration>
                                    <Quantity>1</Quantity>
                                    <Customer>
                                    <Name>John Doe</Name>
                                    <Email>[email protected]</Email>
                                    </Customer>
                                    <LicenseAttributes />
                                    <ProductFeatures />
                                    <Signature>MEUCIQDdDpq/Ddt4hZJlird/BcR6FVKLdWF/DENnd6r/0LuB3gIgVm7RSQx5mcjC32JjCoHNdoL8C+etXOtWKiYGLCT4q6w=</Signature>
                                </License>";

            var license = License.Load(licenseContent);

            var validationFailures =
                license.Validate()
                .ExpirationDate()
                .When(lic => lic.Type == LicenseType.Trial)
                .And()
                .Signature(licensePublicKey)
                .AssertValidLicense().ToList();

            if (validationFailures.Any())
            {
                var messageBuilder = new StringBuilder();
                foreach (var validationFailure in validationFailures)
                {
                    messageBuilder.AppendLine("Failure:");
                    messageBuilder.AppendLine(validationFailure.Message);
                    messageBuilder.AppendLine(" ");
                    messageBuilder.AppendLine("Resolve issue by:");
                    messageBuilder.AppendLine(validationFailure.HowToResolve);
                    messageBuilder.AppendLine(" ");
                    messageBuilder.AppendLine(" ");
                }

                new UIAlertView("License validation failure!", messageBuilder.ToString(), null, "Cancel").Show();
            }

            window = new UIWindow(UIScreen.MainScreen.Bounds);

            viewController            = new MyViewController();
            window.RootViewController = viewController;

            window.MakeKeyAndVisible();

            return(true);
        }