Beispiel #1
0
        private void SetTypeMemberTemplateProperty(string domainID, string memberName, TypeMemberProperties propertyName, object value)
        {
            var template       = this.GetDomainHost <ITypeTemplate>(domainID);
            var authentication = this.Context.GetAuthentication(this);

            template.Dispatcher.Invoke(() =>
            {
                var member = template[memberName];
                if (member == null)
                {
                    throw new ItemNotFoundException(memberName);
                }
                if (propertyName == TypeMemberProperties.Name)
                {
                    member.SetName(authentication, (string)value);
                }
                else if (propertyName == TypeMemberProperties.Value)
                {
                    member.SetValue(authentication, Convert.ToInt64(value));
                }
                else if (propertyName == TypeMemberProperties.Comment)
                {
                    member.SetComment(authentication, (string)value);
                }
                else
                {
                    throw new NotImplementedException();
                }
            });
        }
        private object GetTypeTemplateMemberProperty(string domainID, string memberName, TypeMemberProperties propertyName)
        {
            var template = this.GetDomainHost <ITypeTemplate>(domainID);

            return(template.Dispatcher.Invoke(() =>
            {
                var member = template[memberName];
                if (member == null)
                {
                    throw new ItemNotFoundException(memberName);
                }
                if (propertyName == TypeMemberProperties.Name)
                {
                    return (object)member.Name;
                }
                else if (propertyName == TypeMemberProperties.Value)
                {
                    return (object)member.Value;
                }
                else if (propertyName == TypeMemberProperties.Comment)
                {
                    return (object)member.Comment;
                }

                throw new NotImplementedException();
            }));
        }