Beispiel #1
0
        /// <summary>
        /// Sets the data source public setting as either public or non-public.
        /// </summary>
        /// <param name="accessId">A unique id used by the Bing Spatial Data Services to identify a data source.</param>
        /// <param name="dataSourceName">The name of a data source.</param>
        /// <param name="masterKey">A Bing Maps key that has full control of the data source.</param>
        /// <param name="makePublic">A boolean indicating if the data source should be made public or not.</param>
        /// <returns>A data flow job which contains the status of the job setting the public flag of a data source.</returns>
        public async Task <DataServiceJob> SetPublicSetting(string accessId, string dataSourceName, string masterKey, bool makePublic)
        {
            var result = new DataServiceJob();

            try
            {
                ValidateProperties(accessId, dataSourceName, masterKey);

                string request = string.Format("http://spatial.virtualearth.net/REST/v1/data/{0}/{1}/$updatedatasource?setPublic={2}&o=json&key={3}", accessId, dataSourceName, (makePublic) ? 1 : 0, masterKey);

                var jobs = await DownloadDataServiceJobs(request);

                if (jobs != null && jobs.Count > 0)
                {
                    result = jobs[0];
                }
            }
            catch (Exception ex)
            {
                result.ErrorMessage = ex.Message;
                result.Status       = "Aborted";
            }

            return(result);
        }
 /// <summary>
 /// An object that represents a single data flow job.
 /// </summary>
 /// <param name="job">A data service job to convert into a DataflowJob.</param>
 public DataflowJob(DataServiceJob job)
 {
     this.Id            = job.Id;
     this.Links         = job.Links;
     this.ErrorMessage  = job.ErrorMessage;
     this.CompletedDate = job.CompletedDate;
     this.CreatedDate   = job.CreatedDate;
     this.Description   = job.Description;
     this.Status        = job.Status;
     this.Type          = job.Type;
 }