Exemplo n.º 1
0
        /// <summary>
        /// Registers a view model to keep in memory.
        /// </summary>
        /// <param name="viewModel">The view model to register.</param>
        internal void RegisterViewModel(IAccountDataViewModel viewModel)
        {
            Arguments.NotNull(viewModel, nameof(viewModel));

            viewModel.IsEditing = IsEditing;
            _viewModels.Add(viewModel);
            OnViewModelListChanged?.Invoke(this, EventArgs.Empty);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Unregisters the specific view model.
        /// </summary>
        /// <param name="viewModel">The view model to unregister.</param>
        internal void UnregisterViewModel(IAccountDataViewModel viewModel)
        {
            Arguments.NotNull(viewModel, nameof(viewModel));

            _viewModels.Remove(viewModel);
            viewModel.UnloadingAsync().ForgetSafely();

            OnViewModelListChanged?.Invoke(this, EventArgs.Empty);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Registers a view model to a list of account data to delete.
 /// This is used in the scenario where the user delete an account data in editing mode then
 /// save the changes. When this happens, we will want to iterate through these view models
 /// to call the <see cref="IAccountDataViewModel.DeleteAsync(System.Threading.CancellationToken)"/> method.
 /// </summary>
 /// <param name="viewModel">The view model to register.</param>
 internal void RegisterViewModelForDeletion(IAccountDataViewModel viewModel)
 {
     Arguments.NotNull(viewModel, nameof(viewModel));
     _viewModels.Remove(viewModel);
     _viewModelsForDeletion.Add(viewModel);
 }