Ejemplo n.º 1
0
        private void requestLocationButton_Click( object sender, EventArgs e )
        {
            Cursor currCursor = Cursor;
              Cursor = Cursors.WaitCursor;

              try
              {
            string feedId = this.feedIdTextBox.Text.Trim( );

            string appFolder = Path.GetDirectoryName( Assembly.GetExecutingAssembly( ).CodeBase ).Replace( "file:\\", "" );

            LocationRequest locationRequest;
            if ( this.inetSourceRadioButton.Checked )
            {
              RequestParams requestParams = default( RequestParams );
              requestParams.Id = feedId;

              locationRequest =
            new SpotLocationRequest( requestParams, appFolder, null );
            }
            else
            {
              string sampleXml = this.sampleXml;
              if ( sampleXml == null )
            sampleXml = ( new SampleXmlForm( ) ).SampleXml; // bad, bad style :)

              RequestParams requestParams = default( RequestParams );
              requestParams.Id = "testxml";

              locationRequest = new TestLocationRequest( requestParams, sampleXml );
            }

            if ( this.resultTextBox.Text.Length > 0 )
            {
              AddResultText( "\r\n" ); // 0uhmDCNY4d1mUHv9A5FZdLbRFMLFVN3Gr
              AddResultText( "-------------------------------------------------\r\n" );
            }
            AddResultText( string.Format( "Requesting {0}...\r\n", feedId ) );

            locationRequest.BeginReadLocation( LocationRequestAsyncCallback, locationRequest );
              }
              catch ( Exception exc )
              {
            AddResultText( exc.ToString( ) + "\r\n" );
              }

              AddResultText( "OnClick: DONE\r\n" );

              Cursor = currCursor;
        }
        public override LocationRequest CreateRequest( RequestParams requestParams )
        {
            LocationRequest locationRequest =
            new SpotLocationRequest(
              requestParams,
              this.appAuxLogFolder,
              this.consequentErrorsCounter
            );

              locationRequest.ReadLocationFinished += locationRequest_ReadLocationFinished;

              return locationRequest;
        }