コード例 #1
0
ファイル: MainForm.cs プロジェクト: new-mikha/flytrace
        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;
        }
コード例 #2
0
        public override LocationRequest CreateRequest( RequestParams requestParams )
        {
            LocationRequest locationRequest =
            new SpotLocationRequest(
              requestParams,
              this.appAuxLogFolder,
              this.consequentErrorsCounter
            );

              locationRequest.ReadLocationFinished += locationRequest_ReadLocationFinished;

              return locationRequest;
        }