Skip to content

IsBusy with increment/decrement counter #28

@thomasgalliker

Description

@thomasgalliker

Extend ViewModelBase IsBusy flag with increment/decrement counter.

public bool IsBusy
{
    get
    {
        var count = Interlocked.CompareExchange(ref _busyRefCount, 0, 0);
        return count > 0;
    }

    protected set
    {
        if (value)
        {
            Interlocked.Increment(ref _busyRefCount);
        }
        else
        {
            Interlocked.Decrement(ref _busyRefCount);
        }

        this.RaisePropertyChanged();
    }
}

Source:
https://github.com/epam/covid-resistance-mobile/blob/1152f1e432edc0ccca89ddad1ddb0d48c7e4f1f4/src/Covi/Features/!Base/ViewModelBase.cs

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions