当前位置: 首页>>代码示例>>C#>>正文


C# Book.GetLicenseMetadata方法代码示例

本文整理汇总了C#中Book.GetLicenseMetadata方法的典型用法代码示例。如果您正苦于以下问题:C# Book.GetLicenseMetadata方法的具体用法?C# Book.GetLicenseMetadata怎么用?C# Book.GetLicenseMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Book的用法示例。


在下文中一共展示了Book.GetLicenseMetadata方法的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."));
            }
//.........这里部分代码省略.........
开发者ID:BloomBooks,项目名称:BloomDesktop,代码行数:101,代码来源:BloomLibraryPublishControl.cs


注:本文中的Book.GetLicenseMetadata方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。