/// <summary>
 ///     Initializes the current bootstraper.
 /// </summary>
 protected override void OnInitialize()
 {
     base.OnInitialize();
     _navigationService = CreateNavigationService(_window);
     if (_navigationService != null)
     {
         IocContainer.BindToConstant(_navigationService);
     }
 }
Beispiel #2
0
 protected virtual void OnInitialize(IList <Assembly> assemblies)
 {
     LoadModules(assemblies);
     if (!IocContainer.TryGet(out _viewModelSettings))
     {
         _viewModelSettings = CreateViewModelSettings();
         IocContainer.BindToConstant(_viewModelSettings);
     }
 }
        /// <summary>
        ///     Initializes the current bootstraper.
        /// </summary>
        protected virtual void OnInitialize()
        {
            LoadModules();
            IViewModelSettings settings = CreateViewModelSettings();

            if (!IocContainer.CanResolve <IViewModelSettings>())
            {
                IocContainer.BindToConstant(settings);
            }
            ServiceProvider.Initialize(IocContainer, Platform);
        }
Beispiel #4
0
        protected override bool LoadInternal()
        {
            IocContainer.BindToConstant <IRepository>(new FileRepository());

#if !XAMARINFORMS
            IBindingMemberProvider memberProvider = BindingServiceProvider.MemberProvider;
            memberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembersEx.UIView.IsBusy, IsBusyChanged));
            memberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembersEx.UIView.BusyMessage, BusyMessageChanged));
#endif
            return(true);
        }
        protected override bool LoadInternal()
        {
            if (Mode != LoadMode.Design)
            {
                IocContainer.BindToConstant <IRepository>(new FileRepository());
            }
            IBindingMemberProvider memberProvider = BindingServiceProvider.MemberProvider;

            memberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembersEx.Control.IsBusy, IsBusyChanged));
            memberProvider.Register(AttachedBindingMember.CreateAutoProperty(AttachedMembersEx.Control.BusyMessage, BusyMessageChanged));
            return(true);
        }
        protected override void InitializeInternal()
        {
            base.InitializeInternal();
            ServiceProvider.EventAggregator.Subscribe(this);
            IocContainer.Get <IViewModelPresenter>().DynamicPresenters.Add(this);
            var navigationService = CreateNavigationService(_window);

            if (navigationService != null)
            {
                IocContainer.BindToConstant(navigationService);
            }
        }
Beispiel #7
0
        protected override void InitializeInternal()
        {
            base.InitializeInternal();

            if (WrapToNavigationController)
            {
                var result = CreateNavigationService();
                if (result != null)
                {
                    IocContainer.BindToConstant(result);
                }
            }

            var rootPresenter = GetRootPresenter();

            if (rootPresenter != null)
            {
                IocContainer.Get <IViewModelPresenter>().DynamicPresenters.Add(rootPresenter);
            }
            _backgroundObserver = UIApplication.Notifications.ObserveDidEnterBackground(OnApplicationDidEnterBackground);
            _foregroundObserver = UIApplication.Notifications.ObserveDidBecomeActive(OnApplicationDidBecomeActive);
        }
Beispiel #8
0
        /// <summary>
        ///     Starts the current bootstrapper.
        /// </summary>
        public virtual void Start(IDataContext context = null)
        {
            context = context.ToNonReadOnly();
            context.AddOrUpdate(NavigationConstants.IsDialog, false);
            Initialize();
            Type             viewModelType = GetMainViewModelType();
            NavigationWindow rootWindow    = null;
            var mappingProvider            = IocContainer.Get <IViewMappingProvider>();
            IViewMappingItem mapping       = mappingProvider.FindMappingForViewModel(viewModelType, context.GetData(NavigationConstants.ViewName), true);

            if (typeof(Page).IsAssignableFrom(mapping.ViewType))
            {
                rootWindow = CreateNavigationWindow();
                var service = CreateNavigationService(rootWindow);
                IocContainer.BindToConstant(service);
            }
            var vm = CreateMainViewModel(viewModelType, context);

            vm.ShowAsync((model, result) =>
            {
                model.Dispose();
                if (ShutdownOnMainViewModelClose)
                {
                    Application app = Application.Current;
                    if (app != null)
                    {
                        Action action = app.Shutdown;
                        app.Dispatcher.BeginInvoke(action);
                    }
                }
            }, context: context);
            if (rootWindow != null)
            {
                IWindowViewMediator mediator = new WindowViewMediator(rootWindow, vm, IocContainer.Get <IThreadManager>(),
                                                                      IocContainer.Get <IViewManager>(), IocContainer.Get <IOperationCallbackManager>());
                mediator.UpdateView(new ViewManagerEx.WindowView(rootWindow), true, context);
                rootWindow.Show();
            }
        }