Ejemplo n.º 1
0
 internal GalleryData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, string description, GalleryIdentifier identifier, GalleryProvisioningState?provisioningState, SharingProfile sharingProfile, SoftDeletePolicy softDeletePolicy, SharingStatus sharingStatus) : base(id, name, resourceType, systemData, tags, location)
 {
     Description       = description;
     Identifier        = identifier;
     ProvisioningState = provisioningState;
     SharingProfile    = sharingProfile;
     SoftDeletePolicy  = softDeletePolicy;
     SharingStatus     = sharingStatus;
 }
Ejemplo n.º 2
0
 protected async Task SetStatus(SharingStatus status)
 {
     await this.dispatcher.InvokeAsync(() =>
     {
         Debug.Assert((this.Viewer.Status & SharingStatus.Completed) == 0);
         if (status == SharingStatus.Running)
         {
             Debug.Assert(this.Viewer.Status != SharingStatus.Running);
             Debug.Assert(this.ticks.Count == 0);
             this.ticks.Add(new Tick {
                 TimeSpan = this.stopwatch.Elapsed
             });
         }
         this.viewer.SetStatus(status);
     });
 }
Ejemplo n.º 3
0
        internal static GalleryData DeserializeGalleryData(JsonElement element)
        {
            IDictionary <string, string> tags                     = default;
            AzureLocation                       location          = default;
            ResourceIdentifier                  id                = default;
            string                              name              = default;
            ResourceType                        type              = default;
            SystemData                          systemData        = default;
            Optional <string>                   description       = default;
            Optional <GalleryIdentifier>        identifier        = default;
            Optional <GalleryProvisioningState> provisioningState = default;
            Optional <SharingProfile>           sharingProfile    = default;
            Optional <SoftDeletePolicy>         softDeletePolicy  = default;
            Optional <SharingStatus>            sharingStatus     = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = new AzureLocation(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = new ResourceType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("description"))
                        {
                            description = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("identifier"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            identifier = GalleryIdentifier.DeserializeGalleryIdentifier(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new GalleryProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("sharingProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            sharingProfile = SharingProfile.DeserializeSharingProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("softDeletePolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            softDeletePolicy = SoftDeletePolicy.DeserializeSoftDeletePolicy(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("sharingStatus"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            sharingStatus = SharingStatus.DeserializeSharingStatus(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new GalleryData(id, name, type, systemData, tags, location, description.Value, identifier.Value, Optional.ToNullable(provisioningState), sharingProfile.Value, softDeletePolicy.Value, sharingStatus.Value));
        }