Ejemplo n.º 1
0
        private MessageBoxBase CreateMessageBox(string message)
        {
            var messageBoxLocator = new PartLocator <MessageBoxBase>(true)
                                    .WithDefaultGenerator(() => new MessageBoxBase());

            return(messageBoxLocator.GetPart().Start(message));
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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());
 }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 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);
        }