private MessageBoxBase CreateMessageBox(string message) { var messageBoxLocator = new PartLocator <MessageBoxBase>(true) .WithDefaultGenerator(() => new MessageBoxBase()); return(messageBoxLocator.GetPart().Start(message)); }
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); }
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()); }
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; } }
internal PartLocator <T> WithDefaultGenerator(Func <T> generator) { if (generator == null) { throw new ArgumentNullException(); } var partLocator = new PartLocator <T>(this) { _defaultGenerator = generator }; return(partLocator); }