public static object GetInstance(PhoneContainer container, System.Type service, string key)
        {
            var instance = container.GetInstance(service, key);

            if (instance != null)
                return instance;

            if (!service.Name.EndsWith("ViewModel"))
                return null;
                
            StaticViewModelLocator.InitializeViewModelsAssembly(service);

            return container.GetInstance(service, key);
        }
Exemple #2
0
        protected override object GetInstance(Type service, string key)
        {
            var instance = _container.GetInstance(service, key);

            InitializeInstance(instance);

            return(instance);
        }
Exemple #3
0
 protected override object GetInstance(Type service, string key)
 {
     //NOTE: initialize the assembly (module)
     if (service != null)
     {
         ModuleConventions.InitializeAssembly(service.Assembly);
     }
     return(container.GetInstance(service, key));
 }
Exemple #4
0
        public static object GetInstance(PhoneContainer container, System.Type service, string key)
        {
            var instance = container.GetInstance(service, key);

            if (instance != null)
            {
                return(instance);
            }

            if (!service.Name.EndsWith("ViewModel"))
            {
                return(null);
            }

            StaticViewModelLocator.InitializeViewModelsAssembly(service);

            return(container.GetInstance(service, key));
        }
Exemple #5
0
        protected override object GetInstance(Type service, string key)
        {
            var instance = container.GetInstance(service, key);

            if (instance != null)
            {
                return(instance);
            }

            throw new Exception("Could not locate any instances.");
        }
        protected override object GetInstance(Type service, string key)
        {
            object instance  = null;
            var    stopwatch = Stopwatch.StartNew();

            //App.Log("  Bootstrapper.GetInstance start " + (service != null ? service.ToString() : "null") + " " + stopwatch.Elapsed);
            instance = _container.GetInstance(service, key);
            //App.Log("  Bootstrapper.GetInstance stop " + (service != null ? service.ToString() : "null") + " " + stopwatch.Elapsed);

            return(instance);
        }
Exemple #7
0
        private void RegisterServices(PhoneContainer container)
        {
            container.RegisterHandler(typeof(IGlobalBusyIndicatorManager), string.Empty,
                                      c => GlobalBusyIndicatorManager.Create((PhoneApplicationPage)RootFrame.Content));

            container.Singleton <IServiceConfiguration, ServiceConfiguration>();
            container.Singleton <IWebConfiguration, WebConfiguration>();
            container.PerRequest <IApplicationConfiguration, ApplicationConfiguration>();

            container.PerRequest <IRequestBodyBuilder, RequestBodyBuilder>();
            container.PerRequest <IWebChannel, ZabbixWebChannel>();

            container.PerRequest <IUserProxyServer, ZabbixUserProxyServer>();
            container.PerRequest <IUserManagmentFacade, UserManagmentFacade>();
            container.PerRequest <IHostGroupProxyServer, ZabbixHostGroupProxyServer>();
            container.PerRequest <IHostProxyServer, ZabbixHostProxyServer>();
            container.PerRequest <ITriggerProxyServer, ZabbixTriggerProxyServer>();
            container.PerRequest <IEventProxyServer, ZabbixEventProxyServer>();
            container.PerRequest <IServerChecker, ZabbixServerChecker>();
            container.PerRequest <IGraphsProxyServer, ZabbixGraphsProxyServer>();
            container.PerRequest <IDataProxyServer, ZabbixDataProxyServer>();

            container.PerRequest <IDeviceManagementService, DeviceManagementService>();
            container.Singleton <IPushChannelService, PushChannelService>();

            container.Singleton <IApplicationSettings, ApplicationSettings>();
            container.PerRequest <ISettingsStorage, SettingsStorage>();
            container.PerRequest <IErrorHandler, ErrorHandler>();
            container.PerRequest <IErrorReporter, ErrorReporter>();
            container.PerRequest <IMessagingService, MessagingService>();
            container.PerRequest <IDeviceInformationManager, DeviceInformationManager>();
            container.PerRequest <INetworkStateManager, NetworkStateManager>();

            container.Singleton <IFavoritesStorage <Trigger>, FavoritesStorage <Trigger> >();
            container.Singleton <IFavoritesStorage <Graph>, FavoritesStorage <Graph> >();
            container.PerRequest <IIsolatedStorageFactory, IsolatedStorageFactory>();

            container.Singleton <IAnalyticsService, FlurryAnalytics>();

            var navigationServiceResolver = new NavigationServiceResolver(RootFrame);

            container.RegisterInstance(typeof(INavigationServiceResolver), null, navigationServiceResolver);

            container.Singleton <AnaliticsNavigationPageLogger>();
            container.GetInstance(typeof(AnaliticsNavigationPageLogger), null);
        }
        private void StartBookDownloading()
        {
            var downloadController = (DownloadController)_phoneContainer.GetInstance(typeof(DownloadController), null);

            downloadController.StartDownload();
        }
 protected override object GetInstance(Type service, string key)
 {
     return(container.GetInstance(service, key));
 }