コード例 #1
0
ファイル: TrackingProvider.cs プロジェクト: dox0/DotNet471RS3
            bool PostTrackingRecord(TrackingParticipant participant, RuntimeTrackingProfile runtimeProfile)
            {
                TrackingRecord originalRecord = this.provider.pendingTrackingRecords[this.currentRecord];

                this.currentRecord++;
                bool isSuccessful = false;

                try
                {
                    TrackingRecord preparedRecord = null;
                    bool           shouldClone    = this.provider.trackingParticipants.Count > 1;
                    if (runtimeProfile == null)
                    {
                        preparedRecord = shouldClone ? originalRecord.Clone() : originalRecord;
                    }
                    else
                    {
                        preparedRecord = runtimeProfile.Match(originalRecord, shouldClone);
                    }

                    if (preparedRecord != null)
                    {
                        IAsyncResult result = participant.BeginTrack(preparedRecord, this.timeoutHelper.RemainingTime(), PrepareAsyncCompletion(trackingCompleteCallback), this);
                        if (TD.TrackingRecordRaisedIsEnabled())
                        {
                            TD.TrackingRecordRaised(preparedRecord.ToString(), participant.GetType().ToString());
                        }
                        if (result.CompletedSynchronously)
                        {
                            participant.EndTrack(result);
                        }
                        else
                        {
                            isSuccessful = true;
                            return(false);
                        }
                    }
                    isSuccessful = true;
                }
                finally
                {
                    if (!isSuccessful)
                    {
                        this.provider.ClearPendingRecords();
                    }
                }
                return(true);
            }
コード例 #2
0
            private bool PostTrackingRecord(TrackingParticipant participant, RuntimeTrackingProfile runtimeProfile)
            {
                TrackingRecord record = this.provider.pendingTrackingRecords[this.currentRecord];

                this.currentRecord++;
                bool flag = false;

                try
                {
                    TrackingRecord record2     = null;
                    bool           shouldClone = this.provider.trackingParticipants.Count > 1;
                    if (runtimeProfile == null)
                    {
                        record2 = shouldClone ? record.Clone() : record;
                    }
                    else
                    {
                        record2 = runtimeProfile.Match(record, shouldClone);
                    }
                    if (record2 != null)
                    {
                        IAsyncResult result = participant.BeginTrack(record2, this.timeoutHelper.RemainingTime(), base.PrepareAsyncCompletion(trackingCompleteCallback), this);
                        if (TD.TrackingRecordRaisedIsEnabled())
                        {
                            TD.TrackingRecordRaised(record2.ToString(), participant.GetType().ToString());
                        }
                        if (!result.CompletedSynchronously)
                        {
                            flag = true;
                            return(false);
                        }
                        participant.EndTrack(result);
                    }
                    flag = true;
                }
                finally
                {
                    if (!flag)
                    {
                        this.provider.ClearPendingRecords();
                    }
                }
                return(true);
            }
コード例 #3
0
            private static bool OnTrackingComplete(IAsyncResult result)
            {
                TrackingProvider.FlushPendingRecordsAsyncResult asyncState = (TrackingProvider.FlushPendingRecordsAsyncResult)result.AsyncState;
                TrackingParticipant participant = asyncState.provider.trackingParticipants[asyncState.currentParticipant];
                bool flag = false;

                try
                {
                    participant.EndTrack(result);
                    flag = true;
                }
                finally
                {
                    if (!flag)
                    {
                        asyncState.provider.ClearPendingRecords();
                    }
                }
                return(asyncState.RunLoop());
            }
コード例 #4
0
ファイル: TrackingProvider.cs プロジェクト: dox0/DotNet471RS3
            static bool OnTrackingComplete(IAsyncResult result)
            {
                Fx.Assert(!result.CompletedSynchronously, "TrackingAsyncResult.OnTrackingComplete should not get called with a result that is CompletedSynchronously");

                FlushPendingRecordsAsyncResult thisPtr     = (FlushPendingRecordsAsyncResult)result.AsyncState;
                TrackingParticipant            participant = thisPtr.provider.trackingParticipants[thisPtr.currentParticipant];
                bool isSuccessful = false;

                try
                {
                    participant.EndTrack(result);
                    isSuccessful = true;
                }
                finally
                {
                    if (!isSuccessful)
                    {
                        thisPtr.provider.ClearPendingRecords();
                    }
                }
                return(thisPtr.RunLoop());
            }
コード例 #5
0
            bool PostTrackingRecord(TrackingParticipant participant, RuntimeTrackingProfile runtimeProfile)
            {
                TrackingRecord originalRecord = this.provider.pendingTrackingRecords[this.currentRecord];
                this.currentRecord++;
                bool isSuccessful = false;

                try
                {
                    TrackingRecord preparedRecord = null;
                    bool shouldClone = this.provider.trackingParticipants.Count > 1;
                    if (runtimeProfile == null)
                    {
                        preparedRecord = shouldClone ? originalRecord.Clone() : originalRecord;
                    }
                    else
                    {
                        preparedRecord = runtimeProfile.Match(originalRecord, shouldClone);
                    }

                    if (preparedRecord != null)
                    {
                        IAsyncResult result = participant.BeginTrack(preparedRecord, this.timeoutHelper.RemainingTime(), PrepareAsyncCompletion(trackingCompleteCallback), this);
                        if (TD.TrackingRecordRaisedIsEnabled())
                        {
                            TD.TrackingRecordRaised(preparedRecord.ToString(), participant.GetType().ToString());
                        }
                        if (result.CompletedSynchronously)
                        {
                            participant.EndTrack(result);
                        }
                        else
                        {
                            isSuccessful = true;
                            return false;
                        }
                    }
                    isSuccessful = true;
                }
                finally
                {
                    if (!isSuccessful)
                    {
                        this.provider.ClearPendingRecords();
                    }
                }
                return true;
            }
 private bool PostTrackingRecord(TrackingParticipant participant, RuntimeTrackingProfile runtimeProfile)
 {
     TrackingRecord record = this.provider.pendingTrackingRecords[this.currentRecord];
     this.currentRecord++;
     bool flag = false;
     try
     {
         TrackingRecord record2 = null;
         bool shouldClone = this.provider.trackingParticipants.Count > 1;
         if (runtimeProfile == null)
         {
             record2 = shouldClone ? record.Clone() : record;
         }
         else
         {
             record2 = runtimeProfile.Match(record, shouldClone);
         }
         if (record2 != null)
         {
             IAsyncResult result = participant.BeginTrack(record2, this.timeoutHelper.RemainingTime(), base.PrepareAsyncCompletion(trackingCompleteCallback), this);
             if (TD.TrackingRecordRaisedIsEnabled())
             {
                 TD.TrackingRecordRaised(record2.ToString(), participant.GetType().ToString());
             }
             if (!result.CompletedSynchronously)
             {
                 flag = true;
                 return false;
             }
             participant.EndTrack(result);
         }
         flag = true;
     }
     finally
     {
         if (!flag)
         {
             this.provider.ClearPendingRecords();
         }
     }
     return true;
 }