Esempio n. 1
0
            internal bool mixed; // whether to pretty print the contents of this element.

            internal void Init( int nsTop ) {
                name = null;
                defaultNs = String.Empty;
                defaultNsState = NamespaceState.Uninitialized;
                xmlSpace = XmlSpace.None;
                xmlLang = null;
                prevNsTop = nsTop;
                prefixCount = 0;
                mixed = false;
            }
        internal static string ToSerializedValue(this NamespaceState value)
        {
            switch (value)
            {
            case NamespaceState.Unknown:
                return("Unknown");

            case NamespaceState.Creating:
                return("Creating");

            case NamespaceState.Created:
                return("Created");

            case NamespaceState.Activating:
                return("Activating");

            case NamespaceState.Enabling:
                return("Enabling");

            case NamespaceState.Active:
                return("Active");

            case NamespaceState.Disabling:
                return("Disabling");

            case NamespaceState.Disabled:
                return("Disabled");

            case NamespaceState.SoftDeleting:
                return("SoftDeleting");

            case NamespaceState.SoftDeleted:
                return("SoftDeleted");

            case NamespaceState.Removing:
                return("Removing");

            case NamespaceState.Removed:
                return("Removed");

            case NamespaceState.Failed:
                return("Failed");
            }
            return(null);
        }
        public NamespaceAttributes UpdateNamespace(string resourceGroupName, string namespaceName, string location, NamespaceState state, bool critical, Dictionary <string, string> tags)
        {
            var parameter = new NamespaceCreateOrUpdateParameters()
            {
                Location   = location,
                Properties = new NamespaceProperties()
                {
                    NamespaceType = NamespaceType.NotificationHub,
                    Status        = ((state == NamespaceState.Disabled) ? state : NamespaceState.Active).ToString(),
                    Enabled       = (state == NamespaceState.Disabled) ? false : true
                }
            };

            if (critical)
            {
                parameter.Properties.Critical = critical;
            }

            if (tags != null && tags.Count() > 0)
            {
                parameter.Tags = new Dictionary <string, string>(tags);
            }

            var response = Client.Namespaces.CreateOrUpdate(resourceGroupName, namespaceName, parameter);

            return(new NamespaceAttributes(resourceGroupName, response.Value));
        }
        public NamespaceAttributes UpdateNamespace(string resourceGroupName, string namespaceName, string location, NamespaceState state, bool critical, Dictionary<string, string> tags)
        {
            var parameter = new NamespaceCreateOrUpdateParameters()
                {
                    Location = location,
                    Properties = new NamespaceProperties()
                    {
                        NamespaceType = NamespaceType.NotificationHub,
                        Status = ((state == NamespaceState.Disabled) ? state : NamespaceState.Active).ToString(),
                        Enabled = (state == NamespaceState.Disabled ) ? false:true
                    }
                };
            
            if (critical)
            {
                parameter.Properties.Critical = critical;
            }

            if (tags != null && tags.Count() > 0)
            {
                parameter.Tags = new Dictionary<string, string>(tags);
            }

            var response = Client.Namespaces.CreateOrUpdate(resourceGroupName, namespaceName, parameter);
            return new NamespaceAttributes(resourceGroupName, response.Value);
        }