예제 #1
0
        private MessageBoxBase CreateMessageBox(string message)
        {
            var messageBoxLocator = new PartLocator <MessageBoxBase>(true)
                                    .WithDefaultGenerator(() => new MessageBoxBase());

            return(messageBoxLocator.GetPart().Start(message));
        }
예제 #2
0
 internal PartLocator(PartLocator <T> partLocator)
 {
     _compositionContextDelegate = partLocator._compositionContextDelegate;
     _useFactory                  = partLocator._useFactory;
     _defaultGenerator            = partLocator._defaultGenerator;
     Composition.ProviderChanged +=
         new EventHandler <EventArgs>(OnCompositionProviderChanged).MakeWeak(eh => Composition.ProviderChanged -= eh);
 }
예제 #3
0
 internal Dialog(object content, IEnumerable <IDialogUICommand <T> > commands, string title = null)
 {
     _windowManager     = Composition.GetInstance <IWindowManager>();
     _title             = title;
     _content           = content;
     _commands          = commands;
     _dialogHostLocator = new PartLocator <DialogHostBase>(true)
                          .WithDefaultGenerator(() => new DialogHostBase());
 }
예제 #4
0
        private static void OnEntityManagerCreated(object sender, EntityManagerCreatedEventArgs args)
        {
            if (!args.EntityManager.IsClient)
            {
                return;
            }

            var locator = new PartLocator <IAuthenticationService>(false, () => args.EntityManager.CompositionContext);

            if (locator.IsAvailable)
            {
                args.EntityManager.AuthenticationContext = locator.GetPart().AuthenticationContext;
            }
        }
예제 #5
0
        internal PartLocator <T> WithDefaultGenerator(Func <T> generator)
        {
            if (generator == null)
            {
                throw new ArgumentNullException();
            }

            var partLocator = new PartLocator <T>(this)
            {
                _defaultGenerator = generator
            };

            return(partLocator);
        }