本文整理匯總了C#中System.IO.Packaging.RightsManagementInformation.LoadPublishLicense方法的典型用法代碼示例。如果您正苦於以下問題:C# RightsManagementInformation.LoadPublishLicense方法的具體用法?C# RightsManagementInformation.LoadPublishLicense怎麽用?C# RightsManagementInformation.LoadPublishLicense使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.IO.Packaging.RightsManagementInformation
的用法示例。
在下文中一共展示了RightsManagementInformation.LoadPublishLicense方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ShowStatus
ShowStatus(" Opening the encrypted Package.");
EncryptedPackageEnvelope ePackage =
EncryptedPackageEnvelope.Open(xpsFile, FileAccess.ReadWrite);
RightsManagementInformation rmi =
ePackage.RightsManagementInformation;
ShowStatus(" Looking for an embedded UseLicense for user:\n " +
currentUserId + " [" + _authentication + "]");
UseLicense useLicense =
rmi.LoadUseLicense(
new ContentUser(currentUserId, _authentication));
ReadOnlyCollection<ContentGrant> grants;
if (useLicense == null)
{
ShowStatus(" No Embedded UseLicense found.\n " +
"Attempting to acqure UseLicnese\n " +
"from the PublishLicense.");
PublishLicense pubLicense = rmi.LoadPublishLicense();
ShowStatus(" Referral information:");
if (pubLicense.ReferralInfoName == null)
ShowStatus(" Name: (null)");
else
ShowStatus(" Name: " + pubLicense.ReferralInfoName);
if (pubLicense.ReferralInfoUri == null)
ShowStatus(" Uri: (null)");
else
ShowStatus(" Uri: " +
pubLicense.ReferralInfoUri.ToString());
useLicense = pubLicense.AcquireUseLicense(_secureEnv);
if (useLicense == null)
{
ShowStatus(" User DOES NOT HAVE RIGHTS\n " +
"to access this document!");
return false;
}
}// end:if (useLicense == null)
ShowStatus(" UseLicense acquired.");