Exemplo n.º 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;
            }
        }
Exemplo n.º 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 });
        }
Exemplo n.º 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);
        }
Exemplo n.º 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;
 }
Exemplo n.º 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);
 }
Exemplo n.º 6
0
        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;
        }
Exemplo n.º 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;
        }
Exemplo n.º 9
0
 internal LocalizedString(int lcid, string value)
 {
     ToolkitUtilities.ConfirmNotNull(value, "value");
     this.lcid  = lcid;
     this.value = value;
 }
Exemplo n.º 10
0
 public void AddStakeholder(string stakeholder)
 {
     ToolkitUtilities.ConfirmNotNull(stakeholder, "stakeholder");
     this.stakeholders.Add(stakeholder);
 }
Exemplo n.º 11
0
 private static string GetNormalized(string keyOrValue)
 {
     ToolkitUtilities.ConfirmNotNull(keyOrValue, "keyOrValue");
     return(keyOrValue.Trim());
 }