/// <summary> /// Removes the registration of view by viewmodel's key /// </summary> /// <param name="viewModel"></param> /// <param name="view"></param> public static void UnregisterView(this ITCoreViewModel viewModel, ITCoreView view) { var viewType = view.GetType(); var viewModelName = nameof(viewModel); var key = viewType.Name + viewModelName; _registeredViews = _registeredViews.Where(x => x.Key != key) .ToDictionary(x => x.Key, x => x.Value); }
/// <summary> /// Registers a viewType for a viewModel /// </summary> /// <param name="viewModel"></param> /// <param name="view"></param> public static void RegisterView(this ITCoreViewModel viewModel, ITCoreView view) { var viewType = view.GetType(); var stringKey = viewModel.ViewKey.ToString(); if (!_registeredViews.TryGetValue(stringKey, out Type registeredView)) { _registeredViews.Add(stringKey, viewType); } }