egramtel/egram.tel

Prefer WhenActivated over IDisposable

worldbeater opened this issue · 2 comments

ReactiveUI guidelines recommend using WhenActivated to control the lifecycle of a ViewModel.
Let's prefer it over bare metal IDisposables.

WhenActivated is a way to track disposables. Besides that, it can be used to defer the setup of a ViewModel until it's truly required. WhenActivated also gives us an ability to start or stop reacting to hot observables, like a background task that periodically pings a network endpoint or an observable updating users current location.

Docs: https://reactiveui.net/docs/handbook/when-activated/
AvaloniaUI/Avalonia#1951

Done!