${iServer6_SetLayerStatusParameter_Title}

${iServer6_SetLayerStatusParameter_Description}

        private async void isVisible_Click(object sender, RoutedEventArgs e)
        {
            SetLayerStatusParameters parameters = new SetLayerStatusParameters
            {
                HoldTime = 30,
                LayerStatusList = layersStatus,
                ResourceID = tempLayerID
            };
            //与服务端交互
            try
            {
                SetLayerStatusService setLayersStatus = new SetLayerStatusService(url);
                var result = await setLayersStatus.ProcessAsync(parameters);
                if (result.IsSucceed)
                {
                    tempLayerID = result.NewResourceID;
                    layer.LayersID = result.NewResourceID;
                    layer.Refresh();

                }
            }
            //交互失败
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        internal static string ToJson(SetLayerStatusParameters parameters)
        {
            string json = "{";
            var list = new List<string>();
            foreach (var item in parameters.LayerStatusList)
            {
                list.Add(LayerStatus.ToJson(item));
            }

            json += string.Format("\"layers\":[{0}]", string.Join(",", list.ToArray()));
            json += "}";

            return json;
        }
        /// <summary>${iServer6_SetLayerStatusService_method_processAsync_D}</summary>
        /// <param name="parameters">${iServer6_SetLayerStatusService_method_processAsync_param_parameters}</param>
        /// <param name="state">${iServer6_SetLayerStatusService_method_processAsync_param_state}</param>
        public async Task<SetLayerResult> ProcessAsync(SetLayerStatusParameters parameters)
        {
            mapUrl = this.Url;

            requestParameters = parameters;
            ValidationUrlAndParametres();
            resourceID = requestParameters.ResourceID;
            GetMapName();

            if (!string.IsNullOrEmpty(resourceID))//直接put
            {
                var json = await base.SubmitRequest(GetPutRequestUrl(), GetDictionaryParameters(), true, false, true);
                SetLayerResult setLayerResult = SetLayerResult.FromJson(json);
                setLayerResult.NewResourceID = resourceID.ToString();
                return setLayerResult;
            }
            else   //先post再put
            {
                string getTempLayerSetUrl = Url;
                getTempLayerSetUrl += "/tempLayersSet.json";
                HttpWebRequest request = HttpWebRequest.CreateHttp(getTempLayerSetUrl);
                request.Method = "POST";
                request.ContentType = "application/x-www-form-urlencoded;charset=UTF-8";
                try
                {
                    HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync();
                    StreamReader reader = new StreamReader(response.GetResponseStream());
                    string result = await reader.ReadToEndAsync();
                    reader.Dispose();
                    return await PostRequest_Complated(result);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }