Microsoft.ApplicationInsights.Extensibility.Implementation.TaskTimerInternal.Cancel()

Here are the examples of the csharp api class Microsoft.ApplicationInsights.Extensibility.Implementation.TaskTimerInternal.Cancel() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

1. Example

Project: ApplicationInsights-dotnet
Source File: TaskTimer.cs
public void Cancel()
        {
            this.internalTimer.Cancel();
        }

2. Example

Project: ApplicationInsights-dotnet
Source File: TaskTimerInternal.cs
private void Dispose(bool disposing)
        {
            if (disposing)
            {
                this.Cancel();
            }
        }

3. Example

Project: ApplicationInsights-dotnet
Source File: TaskTimerInternalTest.cs
[TestMethod]
            public void AbortsPreviousAction()
            {
                AsyncTest.Run(async () =>
                {
                    var timer = new TaskTimerInternal { Delay = TimeSpan.FromMilliseconds(1) };

                    bool actionInvoked = false;
                    timer.Start(() => Task.Factory.StartNew(() => actionInvoked = true));
                    timer.Cancel();
        
                    await TaskEx.Delay(TimeSpan.FromMilliseconds(20));
        
                    Assert.IsFalse(actionInvoked);
                });
            }