本文整理汇总了C#中Book.SetMetadata方法的典型用法代码示例。如果您正苦于以下问题:C# Book.SetMetadata方法的具体用法?C# Book.SetMetadata怎么用?C# Book.SetMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Book
的用法示例。
在下文中一共展示了Book.SetMetadata方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BloomLibraryPublishControl
public BloomLibraryPublishControl(PublishView parentView, BookTransfer bookTransferrer, LoginDialog login, Book.Book book)
{
_parentView = parentView;
_bookTransferrer = bookTransferrer;
_loginDialog = login;
_book = book;
InitializeComponent();
_originalLoginText = _loginLink.Text; // Before anything might modify it (but after InitializeComponent creates it).
_titleLabel.Text = book.BookInfo.Title;
_progressBox.ShowDetailsMenuItem = true;
_progressBox.ShowCopyToClipboardMenuItem = true;
_progressBox.LinkClicked += _progressBox_LinkClicked;
var metadata = book.GetLicenseMetadata();
// This is usually redundant, but might not be on old books where the license was set before the new
// editing code was written.
book.SetMetadata(metadata);
var license = metadata.License;
if (license == null || (license is NullLicense && string.IsNullOrWhiteSpace(metadata.CopyrightNotice)))
{
// A null license and no copyright indicates they never even opened the ClearShare dialog to choose a license.
_usingCcControls = false;
_usingNotesLabel = false;
_licenseSuggestion.Text = _pleaseSetThis;
_okToUpload = false;
}
else if (license is CreativeCommonsLicense)
{
_creativeCommonsLink.Text = license.Token.ToUpperInvariant();
_usingNotesSuggestion = false;
if (string.IsNullOrWhiteSpace(license.RightsStatement))
{
_licenseNotesLabel.Hide();
}
else
{
_licenseNotesLabel.Text = LocalizationManager.GetString("PublishTab.Upload.AdditionalRequests", "Additional Requests: ") + license.RightsStatement;
}
}
else if (license is NullLicense)
{
_usingCcControls = false;
_licenseNotesLabel.Text = LocalizationManager.GetString("PublishTab.Upload.AllReserved", "All rights reserved (Contact the Copyright holder for any permissions.)");
if (!string.IsNullOrWhiteSpace(license.RightsStatement))
{
_licenseNotesLabel.Text += Environment.NewLine + license.RightsStatement;
}
_licenseSuggestion.Text = LocalizationManager.GetString("PublishTab.Upload.SuggestAssignCC", "Suggestion: Assigning a Creative Commons License makes it easy for you to clearly grant certain permissions to everyone.");
}
else
{
// So far, this means it must be custom license (with non-blank rights...actually, currently, the palaso dialog will not allow a custom license with no rights statement).
_usingCcControls = false;
_licenseNotesLabel.Text = license.RightsStatement;
_licenseSuggestion.Text = LocalizationManager.GetString("PublishTab.Upload.SuggestChangeCC", "Suggestion: Creative Commons Licenses make it much easier for others to use your book, even if they aren't fluent in the language of your custom license.");
}
_copyrightLabel.Text = book.BookInfo.Copyright;
var allLanguages = book.AllLanguages;
foreach (var lang in allLanguages.Keys)
{
var checkBox = new CheckBox();
checkBox.Text = _book.PrettyPrintLanguage(lang);
if (allLanguages[lang])
checkBox.Checked = true;
else
{
checkBox.Text += @" " + LocalizationManager.GetString("PublishTab.Upload.Partial", "(partial)");
}
checkBox.Size = new Size(TextRenderer.MeasureText(checkBox.Text, checkBox.Font).Width + 50, checkBox.Height);
checkBox.Tag = lang;
checkBox.CheckStateChanged += delegate(object sender, EventArgs args)
{
bool someLangChecked = _languagesFlow.Controls.Cast<CheckBox>().Any(b => b.Checked);
_langsLabel.ForeColor = someLangChecked ? Color.Black : Color.Red;
if (_okToUploadDependsOnLangsChecked)
{
_okToUpload = someLangChecked;
UpdateDisplay();
}
};
_languagesFlow.Controls.Add(checkBox);
}
_creditsLabel.Text = book.BookInfo.Credits;
_summaryBox.Text = book.BookInfo.Summary;
try
{
_loginDialog.LogIn(); // See if saved credentials work.
}
catch (Exception e)
{
SIL.Reporting.ErrorReport.NotifyUserOfProblem(e,
LocalizationManager.GetString("PublishTab.Upload.LoginFailure",
"Bloom could not log in to BloomLibrary.org using your saved credentials. Please check your network connection."));
}
//.........这里部分代码省略.........