コード例 #1
0
        private bool CreateFeatureService()
        {
            this.Cursor = Cursors.WaitCursor;

              string formattedRequest = string.Empty;
              string jsonResponse = string.Empty;

              string serviceURL = string.Format("{0}sharing/content/users/{1}/createService", _arcgGISOnlineOrganizationEndpoint, txtAGOUserName.Text);

              _featureServiceCreationResponse = RequestAndResponseHandler.CreateNewFeatureService(_tableName, serviceURL, _arcgGISOnlineOrganizationToken, _arcgGISOnlineOrganizationEndpoint + "home/content.html", out formattedRequest, out jsonResponse);
              if (_featureServiceCreationResponse == null)
              {
            _featureserviceErrors++;
            label16.Text = "Errors: " + _featureserviceErrors.ToString();
            return false;
              }

              lblCreateFSSuccess.Text = "Success: " + _featureServiceCreationResponse.Success.ToString();
              lblFeatureServiceURL.Text = "URL: " + _featureServiceCreationResponse.ServiceUrl;
              _arcgGISOnlineFeatureServiceURL = _featureServiceCreationResponse.ServiceUrl;
              lblItemID.Text = "ID: " + _featureServiceCreationResponse.ServiceItemId;

              try
              {
            btnAddDefinitionToLayer.Enabled = true;
            groupBox8.Enabled = _featureServiceCreationResponse.Success;
            btnCreateFeatureService.Enabled = false;
              }
              catch (Exception ex)
              {
            Console.WriteLine(ex.Message);
            return false;
              }
              this.Cursor = Cursors.Default;
              return true;
        }
コード例 #2
0
        private void CreateFeatureService()
        {
            this.Cursor = Cursors.WaitCursor;
              string orgEndPoint = txtOrg.Text;
              if (!orgEndPoint.EndsWith("/"))
            orgEndPoint += "/";

              _featureServiceCreationResponse = RequestAndResponseHandler.CreateNewFeatureService(txtFeatureServiceName.Text, orgEndPoint + "sharing/content/users/" + txtUserName.Text + "/createService", _token, txtOrg.Text + "home/content.html"); //"http://ebgtest.maps.arcgis.com/home/content.html");
              if (_featureServiceCreationResponse == null)
            return;

              string data = txtOrg.Text + "sharing/content/items/" + _featureServiceCreationResponse.ItemId + "/data?f=json&token=" + _token;
              HttpWebResponse httpResponse = RequestAndResponseHandler.HttpWebGetRequest(data, "");
              //get the JSON representation from the response
              string json = RequestAndResponseHandler.DeserializeResponse(httpResponse.GetResponseStream());

              try
              {
            groupBoxAddDef.Enabled = true;
            btnAddDefinitionToLayer.Enabled = true;
            rdbtnEveryone.Enabled = rdbtnGroup.Enabled = rdbtnOrg.Enabled = true;
            label12.Enabled = label16.Enabled = true;
            btnCreateFeatureService.Enabled = false;
              }
              catch (Exception ex)
              {
            Console.WriteLine(ex.Message);
              }
              this.Cursor = Cursors.Default;
        }