/// <summary> /// Register <typeparamref name="TView"/> as the view for any instance of <typeparamref name="TViewModel"/>. /// </summary> /// <exception cref="InvalidOperationException"><typeparamref name="TViewModel"/> was previously registered.</exception> public void RegisterView <TViewModel, TView>() where TView : ViewBase <TViewModel> { if (modelViewMapping.ContainsKey(typeof(TViewModel))) { throw new InvalidOperationException($"Cannot register view for a view model '{typeof(TViewModel)}' that has previously been registered."); } Logger.Info($"Register view '{typeof(TView)}' for instances of '{typeof(TViewModel)}'."); modelViewMapping.Add(typeof(TViewModel), typeof(TView)); }
/// <summary> /// Registers a plugin, calling <see cref="IEditorPlugin.RegisterPlugin(IServiceRegistry)"/>. /// </summary> /// <param name="plugin"></param> public void Register(IEditorPlugin plugin) { if (activePlugins.ContainsKey(plugin.GetType())) { throw new InvalidOperationException($"Plugin of type '{plugin.GetType()}' is already registered."); } Logger.Debug($"Registering plugin '{plugin.GetType().FullName}'..."); plugin.RegisterPlugin(Services); activePlugins.Add(plugin.GetType(), plugin); Logger.Info($"Registered plugin '{plugin.GetType().FullName}'."); }