/// <summary> /// Event handler of the <see cref="ModulesLoadedEvent"/> /// Gets all the <see cref="ISkylineRectAndPointPicker"/> that were loaded by the PaunPacker.GUI and passes them /// to the <see cref="SkylineAlgorithmViewModel"/> so that the user could select it via the view of this plugin /// </summary> /// <param name="payload">The payload of the event</param> private void OnModulesLoaded(ModulesLoadedPayload payload) { var view = new SkylineAlgorithmView() { DataContext = new SkylineAlgorithmViewModel(payload.GetLoadedTypes <ISkylineRectAndPointPicker>() .Concat(unityContainer.Registrations.Select(x => x.RegisteredType).Where(x => typeof(ISkylineRectAndPointPicker).IsAssignableFrom(x) && !x.IsAbstract && !x.IsInterface)) .Distinct(), unityContainer) }; unityContainer.RegisterInstance <UserControl>(PluginViewWiring.GetViewName(typeof(SkylineAlgorithm)), view); }
/// <summary> /// Event handler of the <see cref="ModulesLoadedEvent"/> /// Gets all the Guillotine algorithm's dependencies that were loaded by the PaunPacker.GUI and passes them /// to the <see cref="GuillotineAlgorithmViewModel"/> so that the user could select it via the view of this plugin /// </summary> /// <param name="payload">The payload of the event</param> private void OnModulesLoaded(ModulesLoadedPayload payload) { var view = new GuillotineAlgorithmView() { DataContext = new GuillotineAlgorithmViewModel( payload.GetLoadedTypes <IFreeRectangleExtractor>() .Concat(unityContainer.Registrations.Select(x => x.RegisteredType).Where(x => typeof(IFreeRectangleExtractor).IsAssignableFrom(x) && !x.IsAbstract && !x.IsInterface)), payload.GetLoadedTypes <IFreeRectangleSplitter>() .Concat(unityContainer.Registrations.Select(x => x.RegisteredType).Where(x => typeof(IFreeRectangleSplitter).IsAssignableFrom(x) && !x.IsAbstract && !x.IsInterface)), payload.GetLoadedTypes <IFreeRectangleMerger>() .Concat(unityContainer.Registrations.Select(x => x.RegisteredType).Where(x => typeof(IFreeRectangleMerger).IsAssignableFrom(x) && !x.IsAbstract && !x.IsInterface)), payload.GetLoadedTypes <IRectOrientationSelector>() .Concat(unityContainer.Registrations.Select(x => x.RegisteredType).Where(x => typeof(IRectOrientationSelector).IsAssignableFrom(x) && !x.IsAbstract && !x.IsInterface)), payload.GetLoadedTypes <IFreeRectanglePostProcessor>() .Concat(unityContainer.Registrations.Select(x => x.RegisteredType).Where(x => typeof(IFreeRectanglePostProcessor).IsAssignableFrom(x) && !x.IsAbstract && !x.IsInterface)) .Distinct(), unityContainer) }; unityContainer.RegisterInstance <UserControl>(PluginViewWiring.GetViewName(typeof(GuillotinePlacementAlgorithm)), view); }