예제 #1
0
        protected override void Configure()
        {
            container = new SimpleContainer();

            container.Singleton <IWindowManager, AppWindowManager>();
            container.Singleton <IEventAggregator, EventAggregator>();
            container.PerRequest <IShell, ShellViewModel>();
            container.Singleton <IKanbanBoard, KanbanBoard>();
            container.PerRequest <IPersist, Persistency>();
            MessageBinder.SpecialValues.Add("$pressedkey", (context) =>
            {
                //http://stackoverflow.com/questions/16719496/caliburn-micro-enter-key-event
                // NOTE: IMPORTANT - you MUST add the dictionary key as lowercase as CM
                // does a ToLower on the param string you add in the action message, in fact ideally
                // all your param messages should be lowercase just in case. I don't really like this
                // behaviour but that's how it is!
                var keyArgs = context.EventArgs as KeyEventArgs;

                if (keyArgs != null)
                {
                    return(keyArgs.Key);
                }

                return(null);
            });
        }
예제 #2
0
        /// <summary>
        /// Configure() seting up Singletons and Instance
        ///
        /// Server connectionString can be found in appsettings.json
        /// </summary>
        protected override void Configure()
        {
            string connectionString = JObject.Parse(File.ReadAllText(@"appsettings.json"))["ConnectionStrings"]["DefaultConnection"].ToString();
            var    optionBuilder    = new DbContextOptionsBuilder <CalendarContext>();

            optionBuilder.UseSqlServer(connectionString);

            _container.Instance(_container);
            _container
            .Singleton <IWindowManager, WindowManager>()
            .Singleton <IEventAggregator, EventAggregator>()
            .RegisterInstance(typeof(DbContextOptions <CalendarContext>),
                              typeof(DbContextOptions <CalendarContext>).ToString(),
                              optionBuilder.Options);

            GetType().Assembly.GetTypes()
            .Where(type => type.IsClass)
            .Where(type => type.Name.EndsWith("ViewModel"))
            .ToList()
            .ForEach(viewModelType => _container.RegisterPerRequest(
                         viewModelType, viewModelType.ToString(), viewModelType));


            _container.PerRequest <CalendarContext, CalendarContext>();
            _container.PerRequest <ICalendarRepository, CalendarRepository>();
        }
예제 #3
0
        protected override void Configure()
        {
            MapperConfiguration config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <ProductModel, ProductDisplayModel>();
                cfg.CreateMap <CartItemModel, CartItemDisplayModel>();
            });
            IMapper mapper = config.CreateMapper();

            container.Instance(mapper);
            container.Instance(container);
            container.PerRequest <IProductEndpoint, ProductEndpoint>();
            container.PerRequest <ISaleEndpoint, SaleEndpoint>();

            container.
            Singleton <IWindowManager, WindowManager>()
            .Singleton <IEventAggregator, EventAggregator>()
            .Singleton <IAPIHelper, APIHelper>()
            .Singleton <ILoggedInUserModel, LoggedInUserModel>()
            .Singleton <IConfigHelper, ConfigHelper>();
            GetType().Assembly.GetTypes().Where(type => type.IsClass)
            .Where(type => type.Name.EndsWith("ViewModel"))
            .ToList()
            .ForEach(viewModelType => container.RegisterPerRequest(viewModelType, viewModelType.ToString(), viewModelType));
        }
예제 #4
0
        protected override void Configure()
        {
            Container = new SimpleContainer();

            //Container.Instance(Container);

            Container
            .Singleton <HookService>();

            Container
            .Singleton <IWindowManager, HWindowManager>()
            .Singleton <IEventAggregator, EventAggregator>()
            //.Singleton<ModuleService>()
            .Singleton <StorageService>()
            .Instance(Settings.Default);

            Container
            .PerRequest <CommandSettingsViewModel>()
            .PerRequest <ModuleSettingsViewModel>()
            .PerRequest <CommandsViewModel>()
            .Singleton <SettingsViewModel>()
            .Singleton <PopupViewModel>()
            .Singleton <MainViewModel>();

            Container
            .PerRequest <StaticModulesInitializer>();

            base.Configure();

            #region Add Visibility Name Convection

            ConventionManager.AddElementConvention <UIElement>(UIElement.VisibilityProperty, "Visibility", "VisibilityChanged");
 protected override void Configure()
 {
     _container = new SimpleContainer();
     _container.PerRequest <IWindowManager, WindowManager>();
     _container.PerRequest <IEventAggregator, EventAggregator>();
     _container.PerRequest <ProtocolViewModel>();
 }
예제 #6
0
 public InputServices(SimpleContainer container)
 {
     container.PerRequest <DebtViewModel>();
     container.PerRequest <IncomingViewModel>();
     container.PerRequest <OutcomingViewModel>();
     container.PerRequest <TransferViewModel>();
 }
예제 #7
0
 protected override void Configure()
 {
     _container.Singleton <IWindowManager, WindowManager>();
     _container.Singleton <IEventAggregator, EventAggregator>();
     _container.PerRequest <IDataIntegrityController, DataIntegrityController>();
     _container.PerRequest <IShellViewModel, ShellViewModel>();
     _container.Singleton <ITranslationCloudAdapter, TranslationCloudAdapter>();
 }
예제 #8
0
 protected override void Configure()
 {
     _container.Singleton <IWindowManager, WindowManager>();
     _container.Singleton <IEventAggregator, EventAggregator>();
     _container.PerRequest <IShell, ShellViewModel>();
     _container.PerRequest <ILogin, LoginViewModel>();
     _container.PerRequest <IUserPanel, UserPanelViewModel>();
 }
 protected override void Configure()
 {
     container = new SimpleContainer();
     container.Singleton <IWindowManager, WindowManager>();
     container.Singleton <IEventAggregator, EventAggregator>();
     container.PerRequest <ShellViewModel>();
     container.PerRequest <ModernWindowViewModel>();
 }
예제 #10
0
 protected override void Configure()
 {
     container.Singleton <IEventAggregator, EventAggregator>();
     container.Singleton <IWindowManager, WindowManager>();
     container.PerRequest <IFlashcardService, InMemoryFlashcardService>();
     container.PerRequest <IAnswerValidator, AnswerValidator>();
     container.PerRequest <FlashcardsService>();
     container.PerRequest <ShellViewModel>();
 }
예제 #11
0
        protected override void Configure() {
            container = new SimpleContainer();
            
            container.Singleton<IWindowManager, WindowManager>();
            container.Singleton<IEventAggregator, EventAggregator>();
            container.PerRequest<IShellViewModel, ShellViewModel>();

            container.PerRequest<ViewModels.IAllArtistsViewModel, ViewModels.AllArtistsViewModel>();
        }
예제 #12
0
 protected override void Configure()
 {
     container = new SimpleContainer();
     container.Singleton <IWindowManager, WindowManager>();
     container.Singleton <IEventAggregator, EventAggregator>();
     container.PerRequest <IShell, ShellViewModel>();
     container.PerRequest <IFrameViewModel, FrameViewModel>();
     container.PerRequest <IWelcomeViewModel, WelcomeViewModel>();
 }
예제 #13
0
        protected override void Configure()
        {
            container = new SimpleContainer();

            container.Singleton <IWindowManager, WindowManager>();
            container.Singleton <IEventAggregator, EventAggregator>();
            container.PerRequest <MainViewModel>();
            container.PerRequest <IMathService, MathService>();
        }
예제 #14
0
        protected override void Configure()
        {
            container = new SimpleContainer();

            container.Singleton<IWindowManager, WindowManager>();
            container.Singleton<IEventAggregator, EventAggregator>();
            container.PerRequest<IShell, ShellViewModel>();
            container.PerRequest<IMyScreen, MyScreenViewModel>();
        }
예제 #15
0
        protected override void Configure()
        {
            _Container.Instance <IWindowManager>(new WindowManager());
            _Container.Singleton <IEventAggregator, EventAggregator>();

            // Hook up your ViewModel and Contract here
            _Container.PerRequest <MainViewModel, MainViewModel>();
            _Container.PerRequest <FruitFactory, FruitFactory>();
        }
예제 #16
0
        protected override void Configure()
        {
            ViewModelLocator.AddNamespaceMapping(typeof(AppDelegate).Namespace, typeof(LoginViewModel).Namespace);

            container = new SimpleContainer();

            container.PerRequest<LoginViewModel>();
            container.PerRequest<TableViewModel>();
        }
예제 #17
0
        protected override void Configure()
        {
            _Container.Instance <IWindowManager>(new WindowManager());
            _Container.Singleton <IEventAggregator, EventAggregator>();

            // Hook up your ViewModel and Contract here
            _Container.PerRequest <ShellViewModel, ShellViewModel>();
            _Container.PerRequest <UserProfileViewModel, UserProfileViewModel>();
        }
        protected override void Configure()
        {
            _container = new SimpleContainer();

            _container.Singleton <IWindowManager, WindowManager>();
            _container.Singleton <IWindowManagerPortable, WindowManagerPortable>();
            _container.Singleton <IMessagePresenter, MessagePresenter>();
            _container.PerRequest <MainViewModel>();
            _container.PerRequest <ChildViewModel>();
        }
예제 #19
0
        protected override void Configure()
        {
            container = new SimpleContainer();

            container.Singleton <IWindowManager, WindowManager>();
            container.Singleton <IEventAggregator, EventAggregator>();
            container.PerRequest <IShell, HomeViewModel>();

            container.PerRequest <IModule, MessageViewModel>();
        }
예제 #20
0
        protected override void Configure()
        {
            _container.Singleton <IWindowManager, WindowManager>();
            _container.Singleton <IEventReader, EventReader>();
            _container.Singleton <IEventWriter, EventWriter>();

            _container.PerRequest <IEvent, Event>();
            _container.PerRequest <IShellViewModel, ShellViewModel>();
            _container.PerRequest <ISetupViewModel, SetupViewModel>();
        }
예제 #21
0
        protected override void Configure()
        {
            container = new SimpleContainer();

            container.Singleton <IWindowManager, WindowManager>();
            container.Singleton <IEventAggregator, EventAggregator>();
            container.PerRequest <IShellViewModel, ShellViewModel>();

            container.PerRequest <ViewModels.IAllArtistsViewModel, ViewModels.AllArtistsViewModel>();
        }
예제 #22
0
        protected override void Configure()
        {
            _container = new SimpleContainer();
            _container.Instance(_container);
            _container.Singleton <IWindowManager, WindowManager>();
            _container.Singleton <IEventAggregator, EventAggregator>();

            _container.Singleton <IUIManager, UIManager>();
            _container.Singleton <IEventDispatcher, EventDispatcher>();

            _container.Singleton <TextBlockViewManager>();
            _container.Singleton <ButtonViewManager>();
            _container.Singleton <ContainerViewManager>();
            _container.Singleton <StackPanelViewManager>();

            _container.Instance <IReactAssemblyProvider>(new ReactAssemblyProvider(SelectAssemblies));

//            _container.PerRequest<IJavaScriptExecutor, JavaScriptCoreExecutor>();
            _container.PerRequest <IJavaScriptExecutor, WebSocketExecutor>();
            _container.Singleton <IReactBridge, ReactBridgeImpl>();
            _container.PerRequest <IModuleLoader, ModuleLoader>();
            _container.PerRequest <ReactRootViewModel>();
            _container.PerRequest <ReactTextBlockViewModel>();
            _container.PerRequest <ReactButtonViewModel>();
            _container.PerRequest <ReactContainerViewModel>();

            _container.PerRequest <IShell, ShellViewModel>();
            _container.PerRequest <CefSampleViewModel>();
            _container.PerRequest <WebSocketSampleViewModel>();
        }
예제 #23
0
        protected override void Configure()
        {
            container = new SimpleContainer();

            container.Singleton <IWindowManager, WindowManager>();


            var settings = new RestClientSetting()
            {
                address = "http://localhost:5000"
            };

            container.RegisterInstance(typeof(RestClientSetting), null, settings);
            container.PerRequest <IRestClientApp, RestClientApp>();


            container.PerRequest <IMemeService, MemeService>();
            container.PerRequest <IAuthService, AuthService>();


            #region view models
            container.PerRequest <ShellViewModel>();
            container.PerRequest <LoginViewModel>();
            container.PerRequest <ConnectionViewModel>();
            container.PerRequest <RegisterViewModel>();
            container.PerRequest <MemeLibraryViewModel>();
            container.PerRequest <MemeCreatorViewModel>();
            #endregion
        }
예제 #24
0
        protected override void Configure()
        {
            container = new SimpleContainer();

            container.Singleton <IWindowManager, WindowManager>();
            container.Singleton <IEventAggregator, EventAggregator>();
            container.PerRequest <IShell, ShellViewModel>();
            container.Singleton <HomeViewModel, HomeViewModel>();

            container.Singleton <TerminalAdcpViewModel, TerminalAdcpViewModel>();
            var termAdcpVM = container.GetInstance <TerminalAdcpViewModel>();

            container.Instance <IDisposable>(termAdcpVM);                                // Dispose Interface

            // DataFormat VM with ICodecLayer
            container.Singleton <DataFormatViewModel, DataFormatViewModel>();
            var dataFormatVM = container.GetInstance <DataFormatViewModel>();

            container.Instance <ICodecLayer>(dataFormatVM);                              // Codec Layer Interface
            container.Instance <ILoadFilesLayer>(dataFormatVM);                          // File Playback Layer Interface
            container.Instance <IDisposable>(dataFormatVM);                              // Dispose Interface

            container.Singleton <DashboardViewModel, DashboardViewModel>();
            var dashVM = container.GetInstance <DashboardViewModel>();

            container.Instance <IProcessEnsLayer>(dashVM);                               // Process Ensemble Layer interface
            container.Instance <IProjectLayer>(dashVM);                                  // Project Layer interface
            container.Instance <IPlaybackLayer>(dashVM);                                 // Playback layer
            container.Instance <IDisposable>(dashVM);                                    // Disposable interface

            container.Singleton <StatusBarViewModel, StatusBarViewModel>();
            var statusVM = container.GetInstance <StatusBarViewModel>();

            container.Instance <IProcessEnsLayer>(statusVM);                             // Process Ensemble Layer interface
            container.Instance <IProjectLayer>(statusVM);                                // Project Layer interface
            container.Instance <IDisposable>(statusVM);                                  // Disposable interface

            container.PerRequest <HeatmapPlotViewModel, HeatmapPlotViewModel>();
            //var heatmapVM = container.GetInstance<HeatmapPlotViewModel>();
            //container.Instance<IPlotLayer>(heatmapVM);                                  // Plot Layer interface

            container.PerRequest <TimeSeriesViewModel, TimeSeriesViewModel>();
            //var timeseriesVM = container.GetInstance<TimeSeriesViewModel>();
            //container.Instance<IPlotLayer>(timeseriesVM);                               // Plot Layer interface

            container.PerRequest <ShipTrackGmapPlotViewModel, ShipTrackGmapPlotViewModel>();
            //var shiptrackVM = container.GetInstance<ShipTrackPlotViewModel>();
            //container.Instance<IPlotLayer>(shiptrackVM);                                // Plot Layer interface

            container.PerRequest <CompassRoseViewModel, CompassRoseViewModel>();
            //var compassVM = container.GetInstance<CompassRoseViewModel>();
            ////container.Instance<IPlotLayer>(compassVM);                                // Plot Layer interface
            //container.Instance<IDisposable>(compassVM);                                 // Dispose Interface

            container.PerRequest <ProfilePlot3dViewModel, ProfilePlot3dViewModel>();

            container.PerRequest <TabularViewModel, TabularViewModel>();
            container.PerRequest <ProfilePlotViewModel, ProfilePlotViewModel>();
            container.PerRequest <ShipTrackPlotViewModel, ShipTrackPlotViewModel>();
        }
        protected override void Configure()
        {
            _container = new SimpleContainer();
            _container.Instance(_container);
            _container.Singleton<IWindowManager, WindowManager>();
            _container.Singleton<IEventAggregator, EventAggregator>();

            _container.Singleton<IUIManager, UIManager>();
            _container.Singleton<IEventDispatcher, EventDispatcher>();

            _container.Singleton<TextBlockViewManager>();
            _container.Singleton<ButtonViewManager>();
            _container.Singleton<ContainerViewManager>();
            _container.Singleton<StackPanelViewManager>();

            _container.Instance<IReactAssemblyProvider>(new ReactAssemblyProvider(SelectAssemblies));

            //            _container.PerRequest<IJavaScriptExecutor, JavaScriptCoreExecutor>();
            _container.PerRequest<IJavaScriptExecutor, WebSocketExecutor>();
            _container.Singleton<IReactBridge, ReactBridgeImpl>();
            _container.PerRequest<IModuleLoader, ModuleLoader>();
            _container.PerRequest<ReactRootViewModel>();
            _container.PerRequest<ReactTextBlockViewModel>();
            _container.PerRequest<ReactButtonViewModel>();
            _container.PerRequest<ReactContainerViewModel>();

            _container.PerRequest<IShell, ShellViewModel>();
            _container.PerRequest<CefSampleViewModel>();
            _container.PerRequest<WebSocketSampleViewModel>();
        }
예제 #26
0
        protected override void Configure()
        {
            container = new SimpleContainer();

            container.Singleton<IWindowManager, WindowManager>();
            container.Singleton<IEventAggregator, EventAggregator>();
            container.PerRequest<IShell, MainViewModel>();
            container.PerRequest<IScreen, FieldsViewModel>();
            container.PerRequest<IScreen, ServicesViewModel>();
            container.PerRequest<IScreen, CommissionsViewModel>();
        }
예제 #27
0
 protected override void Configure()
 {
     _container.Singleton <IWindowManager, WindowManager>();
     _container.Singleton <IEventAggregator, EventAggregator>();
     _container.PerRequest <ShellViewModel, ShellViewModel>();
     _container.PerRequest <PermutationProvider, PermutationProvider>();
     _container.PerRequest <DataService, DataService>();
     _container.PerRequest <ExcelExporter, ExcelExporter>();
     _container.PerRequest <DrawScraper, DrawScraper>();
     base.Configure();
 }
예제 #28
0
        protected override void Configure()
        {
            container = new SimpleContainer();

            container.Singleton <IWindowManager, WindowManager>();
            container.Singleton <IEventAggregator, EventAggregator>();
            container.PerRequest <MainWindowViewModel>();
            container.PerRequest <LoginPageViewModel>();
            container.PerRequest <RegistrationPageViewModel>();
            container.PerRequest <StartUpViewModel>();
        }
예제 #29
0
 protected override void Configure()
 {
     Container.Singleton <IWindowManager, WindowManager>();
     Container.Singleton <IEventAggregator, EventAggregator>();
     Container.PerRequest <ShellViewModel>();
     Container.PerRequest <RemoteHelper>();
     Container.PerRequest <MessageViewModel>();
     Container.RegisterHandler(typeof(ICourseService), null, CreateCourseService);
     Container.RegisterHandler(typeof(IStudentService), null, CreateStudentService);
     Container.RegisterHandler(typeof(ITeacherService), null, CreateTeacherService);
 }
예제 #30
0
        protected override void Configure()
        {
            _container.Instance(new WindowManager());
            _container.Singleton <IWindowManager, WindowManager>();
            _container.Singleton <IEventAggregator, EventAggregator>();
            _container.PerRequest <MainViewModel, MainViewModel>();
            _container.PerRequest <IFormatParameterTransfer_ViewModel, FormatParameterTransfer_ViewModel>();
            _container.PerRequest <IReadWriteTab_ViewModel, ReadWriteTab_ViewModel>();

            base.Configure();
        }
예제 #31
0
        protected override void Configure()
        {
            container = new SimpleContainer();

            container.Singleton <IWindowManager, WindowManager>();
            container.Singleton <IEventAggregator, EventAggregator>();
            container.PerRequest <IShell, MainViewModel>();
            container.PerRequest <IScreen, FieldsViewModel>();
            container.PerRequest <IScreen, ServicesViewModel>();
            container.PerRequest <IScreen, CommissionsViewModel>();
        }
 protected override void Configure()
 {
     _container.Instance(_container);
     _container.Singleton <ShellViewModel>();
     _container.PerRequest <SocketClient>();
     _container.PerRequest <RobotCommand>();
     _container.PerRequest <ControllerClass>();
     _container
     .Singleton <IWindowManager, WindowManager>()
     .Singleton <IEventAggregator, EventAggregator>();
 }
예제 #33
0
        public App(SimpleContainer container)
        {
            _container = container;

            container.PerRequest <ListViewEmptyGroupViewModel>();
            container.PerRequest <MainViewModel>();

            InitializeComponent();

            DisplayRootView <Views.MainView>();
        }
예제 #34
0
 protected override void Configure()
 {
     _container.Singleton <IWindowManager, WindowManager>();
     _container.Singleton <IEventAggregator, EventAggregator>();
     _container.Singleton <IPdfRecordRepository, ExcelIndexPdfRecordRepository>();
     _container.Singleton <IPdfRecordReader, SystemDefaultPdfRecordReader>();
     _container.Instance <IDialogCoordinator>(DialogCoordinator.Instance);
     _container.PerRequest <ShellViewModel>();
     _container.Singleton <RecordsViewModelFactory>();
     _container.PerRequest <RecordsViewModel>();
 }
예제 #35
0
        protected override void Configure()
        {
            _container.Singleton <IWindowManager, WindowManager>();

            _container.PerRequest <ShellViewModel, ShellViewModel>();
            _container.PerRequest <FileReader>();
            _container.PerRequest <PanelCalculations>();
            _container.PerRequest <ZoneCalculations>();
            _container.PerRequest <Converter>();
            base.Configure();
        }
        protected override void Configure() {
            container = new SimpleContainer();

            container.Singleton<IWindowManager, WindowManager>();
            container.Singleton<IEventAggregator, EventAggregator>();
            container.PerRequest<ILogInPageViewModel, LogInPageViewModel>();
        }
예제 #37
0
        public Application(SimpleContainer container)
        {
            this.container = container;

            Initialize();

            ViewModelLocator.AddNamespaceMapping("NDC.Build.Forms.Core.Views", "NDC.Build.Core.ViewModels");
            ViewLocator.AddNamespaceMapping("NDC.Build.Core.ViewModels", "NDC.Build.Forms.Core.Views");

            MessageBinder.SpecialValues.Add("$tappedItem", GetTappedItem);

            container.Instance<FormsApplication>(this);

            container
               .Singleton<ITeamServicesClient, OfflineTeamServicesClient>()
               .Singleton<IAuthenticationService, OfflineAuthenticationService>()
               .Singleton<IApplicationNavigationService, ApplicationNavigationService>()
               .Singleton<IDialogService, ActionSheetDialogService>();

            container
                .PerRequest<LoginViewModel>()
                .PerRequest<ProjectsViewModel>()
                .PerRequest<BuildsViewModel>();

            DisplayRootView<LoginView>();
        }
        public void The_child_container_returned_contains_parent_entries() {
            var container = new SimpleContainer();
            container.PerRequest<object>();
            var childContainer = container.CreateChildContainer();

            Assert.NotNull(childContainer.GetInstance(typeof (object), null));
        }
예제 #39
0
		protected override void Configure()
		{
			container = new SimpleContainer();

            container.Instance(container);
			
            container.Singleton<IWindowManager, WindowManager>();
			container.Singleton<IEventAggregator, EventAggregator>();
            container.Singleton<IIndexService, IndexService>();
            
            container.PerRequest<ShellViewModel>();
            container.PerRequest<OverviewViewModel>();

            container.PerRequest<IFolderBrowser, FolderBrowser>();
            container.PerRequest<IMessageBox, Luke.Net.Lib.UI.MessageBox>();
		}
예제 #40
0
        public Application(SimpleContainer container)
        {
            this.container = container;

            ConventionManager.AddElementConvention<SearchBar>(SearchBar.TextProperty, "Text", "SearchButtonPressed");

            ViewModelLocator.AddNamespaceMapping("Hubb.Forms.Core.Views", "Hubb.Core.ViewModels");
            ViewLocator.AddNamespaceMapping("Hubb.Core.ViewModels", "Hubb.Forms.Core.Views");

            Initialize();

            container
                .Instance<IGitHubClient>(new GitHubClient(new ProductHeaderValue("hubb-forms", "1.0.0")));

            container
                .Singleton<IAuthenticationService, AuthenticationService>()
                .Singleton<IRepositoryService, RepositoryService>()
                .Singleton<IAppNavigationService, AppNavigationService>();

            container
                .PerRequest<LoginViewModel>()
                .PerRequest<RepositorySearchViewModel>();

            DisplayRootView<LoginView>();
        }
예제 #41
0
        protected override void Configure()
        {
            _container = new SimpleContainer();

            _container.Singleton<IWindowManager, WindowManager>();
            _container.Singleton<IEventAggregator, EventAggregator>();
            _container.PerRequest<IShell, ShellViewModel>();
            _container.PerRequest<MainViewModel>();
            _container.PerRequest<WidgetViewModel>();
            _container.PerRequest<SettingViewModel>();
            _container.PerRequest<Widget2ViewModel>();
            _container.PerRequest<SiteRealtimeViewModel>();
            _container.PerRequest<SponsorViewModel>();
            _container.PerRequest<TrackAnalysisReportViewModel>();
            _container.PerRequest<TrackRealtimeViewModel>();
            _container.PerRequest<BenchmarkViewModel>();
        }
        public void Instances_registered_PerRequest_returns_a_different_instance_for_each_call() {
            var container = new SimpleContainer();
            container.PerRequest<object>();

            var instanceA = container.GetInstance(typeof (object), null);
            var instanceB = container.GetInstance(typeof (object), null);

            Assert.NotSame(instanceA, instanceB);
        }
예제 #43
0
        protected override void Configure()
        {
            ViewModelLocator.AddNamespaceMapping("Hello.Xamarin.iOS", "Hello.Xamarin.Core.ViewModels");

            container = new SimpleContainer();

            container
                .PerRequest<LoginViewModel>();
        }
예제 #44
0
        public void SetUp()
        {
            theContainer = new SimpleContainer();
            theContainer.PerRequest<ILog, NullLog>();

            IoC.BuildUp = theContainer.BuildUp;
            IoC.GetInstance = theContainer.GetInstance;
            IoC.GetAllInstances = theContainer.GetAllInstances;
        }
예제 #45
0
		public void PerRequestTest()
		{
			SimpleContainer sc = new SimpleContainer();
			sc.PerRequest<Test1>();
			var result1 = sc.GetInstance<Test1>();
			Assert.IsNotNull(result1);

			var result1a = sc.GetInstance<Test1>();
			Assert.IsNotNull(result1a);
			Assert.AreNotEqual(result1, result1a);

			bool thrown = false;
			try
			{
				var result2 = sc.GetInstance<Test2>();
			}
			catch(TypeLoadException)
			{
				thrown = true;
			}
			Assert.IsTrue(thrown);


			sc.PerRequest<ITest3, Test3>();
			var result3 = sc.GetInstance<ITest3>();
			Assert.IsNotNull(result3);
			Assert.IsInstanceOfType(result3, typeof(ITest3));
			Assert.IsInstanceOfType(result3, typeof(Test3));

			var result4 = sc.GetInstance<Test3>();
			Assert.IsNotNull(result4);
			Assert.IsInstanceOfType(result4, typeof(ITest3));
			Assert.IsInstanceOfType(result4, typeof(Test3));

			sc.PerRequest<ITest4, Test4>();
			var result5 = sc.GetInstance<ITest4>();
			Assert.IsNotNull(result5);
			Assert.IsInstanceOfType(result5, typeof(ITest4));
			Assert.IsInstanceOfType(result5, typeof(Test4));
			Assert.IsNotNull(result5.Test3);
			Assert.IsInstanceOfType(result5.Test3, typeof(ITest3));
			Assert.IsInstanceOfType(result5.Test3, typeof(Test3));

		}
예제 #46
0
        private void ConfigureContainer()
        {
            _container = new SimpleContainer();

            var appSettings = new AppSettings();

            var services = new ServiceLocator(_container);

            _container.Instance<AppSettings>(appSettings);
            _container.Singleton<IFileSystem, FileSystem>();
            _container.Singleton<IDirectorySystem, DirectorySystem>();
            _container.Instance<IServiceLocator>(services);
            _container.PerRequest<IAsyncSocket, AsyncSocket>();
            _container.PerRequest<IAuthenticationServer, AuthenticationServer>();
            _container.Singleton<IGameParser, NewGameParser>();
            _container.Singleton<IGameState, SimpleGameState>();
            _container.Singleton<IGameServer, SimpleGameServer>();
            _container.Singleton<IScriptLoader, ScriptLoader>();
            _container.Singleton<IScriptRunner, ScriptRunner>();
            _container.Singleton<IRoundtimeHandler, RoundtimeHandler>();
            _container.Singleton<WaitForTokenHandler>();
            _container.Singleton<WaitForReTokenHandler>();
            _container.Singleton<MatchWaitTokenHandler>();

            _container.PerRequest<ITagTransformer, ComponentTagTransformer>();
            _container.PerRequest<ITagTransformer, StreamWindowTagTransformer>();

            _container.PerRequest<IIfBlockExecuter, IfBlockExecuter>();
            _container.Singleton<IIfBlocksParser, IfBlocksParser>();

            _container.PerRequest<IScript, Script>();
            _container.Singleton<IScriptLog, ScriptLog>();

            _container.PerRequest<IVariableReplacer, VariableReplacer>();
            _container.Singleton<ICommandProcessor, CommandProcessor>();

            _container.Singleton<IGameStream, GameStream>();

            _container.Singleton<ISendQueue, SendQueue>();

            _container.Singleton<IConfigLoader, ConfigLoader>();
            _container.Singleton<IVariablesLoader, VariablesLoader>();
            _container.Singleton<IHighlightsLoader, HighlightsLoader>();
            _container.Singleton<IAppDirectoriesBuilder, AppDirectoriesBuilder>();
            _container.Singleton<IAppSettingsLoader, AppSettingsLoader>();
            _container.Singleton<IProfileLoader, ProfileLoader>();

            var now = DateTime.Now.ToString("s");
            var logFileName = string.Format("{0}-log.txt", now);
            var errorsFileName = string.Format("{0}-errors.txt", now);

            var logger = new SimpleFileLogger(logFileName, errorsFileName, services);

            var compositeLog = new CompositeLog(new ILog[]{ logger });

            _container.Instance<ILog>(compositeLog);

            SetupHighlights();
        }
예제 #47
0
        public App(SimpleContainer container)
        {
            this.container = container;

            container.PerRequest<MainViewModel>();

            Initialize();

            DisplayRootView<MainView>();
        }
        protected override void Configure()
        {
            container = new SimpleContainer();

            container.Singleton<IWindowManager, WindowManager>();
            container.Singleton<IEventAggregator, EventAggregator>();
            container.PerRequest<IShell, ShellViewModel>();
            container.Singleton<ISearchService, SearchService>();
            container.Singleton<MainViewModel>();

            AddCustomConventions();
        }
예제 #49
0
		protected override void Configure()
		{
			container = new SimpleContainer();

			container.Singleton<IWindowManager, WindowManager>();
			container.Singleton<IEventAggregator, EventAggregator>();
			container.PerRequest<IShell, ShellViewModel>();

            // Services registrations.
            container.Singleton<IFileSelector, FileSelector>();
            container.Singleton<FileHashGenerator>();
		}
예제 #50
0
        protected override void Configure()
        {
            _container = new SimpleContainer();

            _container.Singleton<IWindowManager, WindowManager>();
            _container.Singleton<IEventAggregator, EventAggregator>();

            _container.Singleton<IShell, ShellViewModel>();

            _container.Singleton<ConfigurationStore>();

            _container.Singleton<CreateAccountViewModel>();
            _container.Singleton<AccountsViewModel>();
            _container.Singleton<SessionsViewModel>();
            _container.Singleton<FooterViewModel>();
            _container.Singleton<LoggedOutViewModel>();

            _container.PerRequest<DetailsViewModel>();
            _container.PerRequest<CharacterViewModel>();
            _container.PerRequest<CharacterDetailsViewModel>();
            _container.PerRequest<HallOfFameCrawlerViewModel>();
            _container.Singleton<NoCharacterSelectedViewModel>();
            _container.PerRequest<ScrapbookViewModel>();
            _container.PerRequest<ScrapbookItemViewModel>();
        }
        protected override void Configure() {
            container = new SimpleContainer();

            container.Singleton<IWindowManager, WindowManager>();
            container.Singleton<IEventAggregator, EventAggregator>();
            container.PerRequest<IShell, ShellViewModel>();

            container.Instance(new Company
                {
                    Name = "The Company",
                    Address = "Some Road",
                    Website = "http://thecompany.com",
                });
        }
예제 #52
0
        protected override void Configure()
        {
            var savePath = System.IO.Path.Combine( Environment.GetFolderPath( Environment.SpecialFolder.ApplicationData ), "LeagueTag" );
            var config = new JsonConfigHandler( savePath );
            config.Load();

            //var config = new TestConfigHandler();

            container = new SimpleContainer();

            container.Singleton<IWindowManager, WindowManager>();
            container.Singleton<IEventAggregator, EventAggregator>();
            container.Instance<IConfigHandler>( config );
            container.Instance<ITimerHandler>( new TimerHandler( config ) );
            container.Singleton<IPlaybackHandler, PlaybackHandler>();
            container.Singleton<ICommandHandler, VoiceCommandHandler>();
            container.PerRequest<IShell, ShellViewModel>();
        }
예제 #53
0
        protected override void Configure()
        {
            ViewModelLocator.AddNamespaceMapping("Hubb.App.Android.Activities", "Hubb.Core.ViewModels");

            container = new SimpleContainer();

            container
                .Instance<IGitHubClient>(new GitHubClient(new ProductHeaderValue("hubb-android", "1.0.0")))
                .Instance<IAppNavigationService>(new AppNavigationService(this));

            container
                .Singleton<IAuthenticationService, NoNetworkAuthenticationService>()
                .Singleton<IRepositoryService, NoNetworkRepositoryService>();

            container
                .PerRequest<LoginViewModel>()
                .PerRequest<RepositorySearchViewModel>();
        }
예제 #54
0
        protected override void Configure()
        {
            ViewModelLocator.AddNamespaceMapping("NDC.Build.App.iOS", "NDC.Build.Core.ViewModels");

            container = new SimpleContainer();

            container.Instance(this);

            container
                .Singleton<ITeamServicesClient, TeamServicesClient>()
                .Singleton<IAuthenticationService, AuthenticationService>()
                .Singleton<IApplicationNavigationService, StoryboardNavigationService>()
                .Singleton<ICredentialsService, UserDefaultsCredentialsService>()
                .Singleton<IDialogService, ActionSheetDialogService>();

            container
                .PerRequest<LoginViewModel>()
                .PerRequest<ProjectsViewModel>()
                .PerRequest<BuildsViewModel>();
        }
예제 #55
0
        protected override void Configure()
        {
            ViewModelLocator.AddNamespaceMapping("Spending.App.Android.Activities", "Spending.Core.ViewModels");

            container = new SimpleContainer();

            container
                .Instance<IMobileServiceClient>(new MobileServiceClient("https://spending.azurewebsites.net"))
                .Instance(this);

            container
                .Singleton<IAuthenticationService, AuthenticationService>()
                .Singleton<IApplicationNavigationService, ApplicationNavigationService>()
                .Singleton<IExpenseService, ExpenseService>()
                .Singleton<INotificationsService, NotificationsService>();

            container
                .PerRequest<LoginViewModel>()
                .PerRequest<CurrentExpensesViewModel>()
                .PerRequest<AddExpenseViewModel>();
        }
        public void An_instance_is_returned_for_the_type_specified_if_found() {
            var container = new SimpleContainer();
            container.PerRequest<object>();

            Assert.NotNull(container.GetInstance(typeof(object), null));
        }