21 lines
		
	
	
		
			463 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			463 B
		
	
	
	
		
			C#
		
	
	
	
	
	
| using Microsoft.Extensions.Logging;
 | |
| using Microsoft.AspNetCore.Components;
 | |
| 
 | |
| namespace OI.Metrology.View.Pages;
 | |
| 
 | |
| public partial class Counter
 | |
| {
 | |
| 
 | |
|     [Inject] protected ILogger<Counter>? Logger { get; set; }
 | |
| 
 | |
|     private int _CurrentCount = 0;
 | |
| 
 | |
|     private void IncrementCount()
 | |
|     {
 | |
|         if (Logger is null)
 | |
|             throw new NullReferenceException(nameof(Logger));
 | |
|         Logger.LogWarning("Someone has clicked me!");
 | |
|         _CurrentCount++;
 | |
|     }
 | |
| 
 | |
| } |