protected BaseViewModel(string urlPathSegment, IMainViewModel mainVM) { _clearNotification = () => mainVM.ClearNotification(); _showErrorAction = mainVM.ShowError; _setNotification = mainVM.SetNotification; UrlPathSegment = urlPathSegment; ThrownExceptions.Subscribe(ErrorHandler(nameof(BaseViewModel))); }
public BaseViewModel([CanBeNull] IBaseViewModel parent) { context = this; InitValidator(); using (SuppressChangeNotifications()) { Parent = parent; if (Window == null && parent is BaseViewModel parentVM) { context = parentVM; Window = parent.Window; dialogCoordinator = parentVM.dialogCoordinator; } PropertyChanged += BaseViewModel_PropertyChanged; ThrownExceptions.Subscribe(CommandException); } }
public ViewModelBase() { ThrownExceptions .Subscribe(async ex => await Application.Current.MainPage.DisplayAlert("Error", ex.Message, "OK")) .DisposeWith(Disposables); }