Exemple #1
0
        /// <summary>
        /// Assigns the description for the specified language.
        /// </summary>
        public void SetDescription(string description, int lcid)
        {
            // Validate the LCID
            CultureInfo.GetCultureInfo(lcid);

            ToolkitUtilities.ConfirmNotNull(description, "description");

            if (description.Contains('\t'))
            {
                throw new ArgumentException("The description cannot contain tab characters", "description");
            }

            if (description.Length > 0x3e8)
            {
                throw new ArgumentException("The description exceeds the maximum allowable length");
            }

            SharedData sharedData = this.GetSharedDataFromSourceTerm(exceptionIfMissing: true);

            if (description.Length == 0)
            {
                sharedData.DescriptionByLcid.Remove(lcid);
            }
            else
            {
                sharedData.DescriptionByLcid[lcid] = description;
            }
        }
Exemple #2
0
        public LocalTermStore(Guid id, string serviceName, int defaultLanguageLcid = LocalTermStore.EnglishLanguageLcid)
            : base(id, defaultLanguageLcid)
        {
            ToolkitUtilities.ConfirmNotNull(serviceName, "serviceName");

            this.serviceName = serviceName;
            this.SetAvailableLanguageLcids(new[] { defaultLanguageLcid });
        }
Exemple #3
0
        private LocalTerm(int defaultLanguageLcid, string termLinkSourcePath, bool isPinnedRoot)
            : base(Guid.Empty, defaultLanguageLcid)
        {
            ToolkitUtilities.ConfirmNotNull(termLinkSourcePath, "termLinkSourcePath");
            this.sharedDataIfSourceTerm = null;
            this.termLinkData           = new TermLinkData();
            this.termLinkData.TermLinkSourcePathParts = LocalTerm.ParseTermLinkSourcePath(termLinkSourcePath);

            Debug.Assert(this.TermKind == LocalTermKind.TermLinkUsingPath);
        }
Exemple #4
0
 protected void RemoveChildItem <T>(T child) where T : LocalTaxonomyItem
 {
     ToolkitUtilities.ConfirmNotNull(child, "child");
     if (child.ParentItem != this)
     {
         throw new InvalidOperationException("The " + child.Kind
                                             + " cannot be removed because it does not belong this container.");
     }
     child.ParentItem = null;
 }
Exemple #5
0
 protected T AddChildItem <T>(T child) where T : LocalTaxonomyItem
 {
     ToolkitUtilities.ConfirmNotNull(child, "child");
     if (child.ParentItem != null)
     {
         throw new InvalidOperationException("The " + child.Kind
                                             + " cannot be added because it already belongs to another container.");
     }
     child.ParentItem = this;
     return(child);
 }
        public Client15Connector(ClientContext clientContext)
        {
            ToolkitUtilities.ConfirmNotNull(clientContext, "clientContext");
            this.clientContext = clientContext;

            this.GetNewGuid = () => { return(Guid.NewGuid()); };

            if (this.clientContext.Tag != null)
            {
                throw new ArgumentException("The ClientContext is already tagged by another object");
            }
            this.clientContext.Tag = this;
        }
Exemple #7
0
        private LocalTerm(Guid id, int defaultLanguageLcid, string nameHint, bool isPinnedRoot)
            : base(id, defaultLanguageLcid)
        {
            ToolkitUtilities.ConfirmNotNull(nameHint, "nameHint");

            if (id == Guid.Empty)
            {
                throw new ArgumentException("The term link requires a non-empty Guid for the Id", "id");
            }

            this.sharedDataIfSourceTerm = null;
            this.termLinkData           = new TermLinkData();
            Debug.Assert(this.TermKind == LocalTermKind.TermLinkUsingId);
            this.TermLinkNameHint = nameHint;
            this.IsPinnedRoot     = isPinnedRoot;
        }
        public TaxonomyItemDownloader(TaxonomyItemDownloaderContext downloaderContext, TClient clientObject,
                                      int treeDepth)
        {
            ToolkitUtilities.ConfirmNotNull(downloaderContext, "downloaderContext");
            ToolkitUtilities.ConfirmNotNull(clientObject, "clientObject");

            if (clientObject.Context != downloaderContext.ClientConnector.ClientContext)
            {
                throw new ArgumentException("The specified clientObject is not associated with a Client15Connector",
                                            "clientObject");
            }

            this.downloaderContext = downloaderContext;
            this.clientObject      = clientObject;
            this.treeDepth         = treeDepth;
        }
Exemple #9
0
 internal LocalizedString(int lcid, string value)
 {
     ToolkitUtilities.ConfirmNotNull(value, "value");
     this.lcid  = lcid;
     this.value = value;
 }
Exemple #10
0
 public void AddStakeholder(string stakeholder)
 {
     ToolkitUtilities.ConfirmNotNull(stakeholder, "stakeholder");
     this.stakeholders.Add(stakeholder);
 }
 private static string GetNormalized(string keyOrValue)
 {
     ToolkitUtilities.ConfirmNotNull(keyOrValue, "keyOrValue");
     return(keyOrValue.Trim());
 }