@@ -129,7 +129,8 @@ public void Install(IWindsorContainer container, IConfigurationStore store)
129
129
. LifestyleSingleton ( ) ) ;
130
130
container . Register ( Component . For < SearchResultPresenterInstanceManager > ( )
131
131
. LifestyleSingleton ( ) ) ;
132
-
132
+
133
+ RefactoringDialogRefactor ( container ) ;
133
134
RegisterDockablePresenters ( container ) ;
134
135
RegisterDockableUserControls ( container ) ;
135
136
@@ -602,6 +603,76 @@ private Type[] ToolsMenuItems()
602
603
return items . ToArray ( ) ;
603
604
}
604
605
606
+ private void RefactoringDialogRefactor ( IWindsorContainer container )
607
+ {
608
+ container . Register ( Types
609
+ . FromAssemblyInThisApplication ( )
610
+ . IncludeNonPublicTypes ( )
611
+ . BasedOn ( typeof ( IRefactoringView < > ) )
612
+ . LifestyleTransient ( )
613
+ . WithServiceSelect ( ( type , types ) =>
614
+ {
615
+ var face = type . GetInterfaces ( ) . FirstOrDefault ( i =>
616
+ i . IsGenericType && i . GetGenericTypeDefinition ( ) == typeof ( IRefactoringView < > ) ) ;
617
+
618
+ return face == null ? new [ ] { type } : new [ ] { type , face } ;
619
+ } )
620
+ ) ;
621
+ container . Register ( Types
622
+ . FromAssemblyInThisApplication ( )
623
+ . IncludeNonPublicTypes ( )
624
+ . BasedOn ( typeof ( IRefactoringViewModel < > ) )
625
+ . LifestyleSingleton ( )
626
+ . WithServiceSelect ( ( type , types ) =>
627
+ {
628
+ var face = type . GetInterfaces ( ) . FirstOrDefault ( i =>
629
+ i . IsGenericType && i . GetGenericTypeDefinition ( ) == typeof ( IRefactoringViewModel < > ) ) ;
630
+
631
+ return face == null ? new [ ] { type } : new [ ] { type , face } ;
632
+ } )
633
+ ) ;
634
+ container . Register ( Types
635
+ . FromAssemblyInThisApplication ( )
636
+ . IncludeNonPublicTypes ( )
637
+ . BasedOn ( typeof ( IRefactoringDialog < , , > ) )
638
+ . LifestyleTransient ( )
639
+ . WithServiceSelect ( ( type , types ) =>
640
+ {
641
+ var face = type . GetInterfaces ( ) . FirstOrDefault ( i =>
642
+ i . IsGenericType && i . GetGenericTypeDefinition ( ) == typeof ( IRefactoringDialog < , , > ) ) ;
643
+
644
+ if ( face == null )
645
+ {
646
+ return new [ ] { type } ;
647
+ }
648
+
649
+ var model = face . GenericTypeArguments [ 0 ] ;
650
+
651
+ var view = face . GenericTypeArguments [ 1 ] ;
652
+ var interfaceView = view . GetInterfaces ( ) . FirstOrDefault ( i =>
653
+ i . IsGenericType && i . GetGenericTypeDefinition ( ) == typeof ( IRefactoringView < > ) ) ;
654
+
655
+ if ( interfaceView == null )
656
+ {
657
+ return new [ ] { type } ;
658
+ }
659
+
660
+ var viewModel = face . GenericTypeArguments [ 2 ] ;
661
+ var interfaceViewModel = viewModel . GetInterfaces ( ) . FirstOrDefault ( i =>
662
+ i . IsGenericType && i . GetGenericTypeDefinition ( ) == typeof ( IRefactoringViewModel < > ) ) ;
663
+
664
+ if ( interfaceViewModel == null )
665
+ {
666
+ return new [ ] { type } ;
667
+ }
668
+
669
+ var closedFace = typeof ( IRefactoringDialog < , , > ) . MakeGenericType ( model , interfaceView , interfaceViewModel ) ;
670
+
671
+ return new [ ] { type , closedFace } ;
672
+ } )
673
+ ) ;
674
+ }
675
+
605
676
private void RegisterCommandMenuItems ( IWindsorContainer container )
606
677
{
607
678
//note: The name of a registration is the full name of the implementation if not specified otherwise.
0 commit comments