ZoeUserCounter 1.0.0

dotnet add package ZoeUserCounter --version 1.0.0
                    
NuGet\Install-Package ZoeUserCounter -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ZoeUserCounter" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZoeUserCounter" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ZoeUserCounter" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ZoeUserCounter --version 1.0.0
                    
#r "nuget: ZoeUserCounter, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ZoeUserCounter@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ZoeUserCounter&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ZoeUserCounter&version=1.0.0
                    
Install as a Cake Tool

Açıklama

Sitede online olan kullanıcıları göstermek için kullanılan bir bileşen olan ZoeCounter'ın belgeleri.

ZoeCounter Bileşeni

@page "/online-users"
@inject ZoeUserCounter.WhoIsOnline WhoIsOnline
@inject ZoeUserCounter.UserTracker Tracker

<h3>Aktif kullanıcı sayısı: @count</h3>

@if (users.Count == 0)
{
    <p>Şu anda çevrimiçi kullanıcı bulunmuyor.</p>
}
else
{
    <h3 class="mb-3 text-primary">Online Kullanıcılar (@users.Count)</h3>
    <ul class="list-group">
        @foreach (var user in users)
        {
            <li class="list-group-item">@user</li>
        }
    </ul>
}

@code {
    private int count;
    private List<string> users = new();

    protected override void OnInitialized()
    {
        count = Tracker.OnlineCount;
        Tracker.OnCountChanged += UpdateCount;

        // Başlangıçta mevcut kullanıcıları al
        users = WhoIsOnline.OnlineUsers.ToList();

        // Gerçek zamanlı değişiklikleri dinle
        WhoIsOnline.OnUsersChanged += RefreshUsers;
    }

    private void RefreshUsers()
    {
        // Arka planda gelen event UI thread'ine taşınıyor
        InvokeAsync(() =>
        {
            users = WhoIsOnline.OnlineUsers.ToList();
            StateHasChanged();
        });
    }

    public void Dispose()
    {
        // Bellek sızıntısını önlemek için event'ten çık
        WhoIsOnline.OnUsersChanged -= RefreshUsers;

        Tracker.OnCountChanged -= UpdateCount;
    }

    private void UpdateCount()
    {
        InvokeAsync(() =>
        {
            count = Tracker.OnlineCount;
            StateHasChanged();
        });
    }
}

Özellikler

  • UserTracker: buradan online sayısı gelir. Burada her sayfa için ekleme olur kişi distinct değil.
  • WhoIsOnlie: Burada kişi distinct olur login olmayan ise hepsi için Anonim olur.

Uyarı

! AuthenticationStateProvider kullanıyor User.Identity.Name bilgisiyle User alınıyor.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 169 11/8/2025

online kullanıcı sayacı