当前位置: 首页>>代码示例>>C#>>正文


C# SimpleContainer.Instance方法代码示例

本文整理汇总了C#中SimpleContainer.Instance方法的典型用法代码示例。如果您正苦于以下问题:C# SimpleContainer.Instance方法的具体用法?C# SimpleContainer.Instance怎么用?C# SimpleContainer.Instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimpleContainer的用法示例。


在下文中一共展示了SimpleContainer.Instance方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Configure

        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>();
        }
开发者ID:joemcbride,项目名称:react-native-wpf,代码行数:30,代码来源:SampleAppBootstrapper.cs

示例2: ConfigureContainer

        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();
        }
开发者ID:joemcbride,项目名称:outlander,代码行数:59,代码来源:Bootstrapper.cs

示例3: Configure

        protected override void Configure()
        {
            container = new SimpleContainer();
            container.Instance(container);

            container.Singleton<App>();
        }
开发者ID:mvermef,项目名称:Caliburn.Micro,代码行数:7,代码来源:Application.cs

示例4: Application

        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>();
        }
开发者ID:nigel-sampson,项目名称:talks,代码行数:25,代码来源:Application.cs

示例5: Application

        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>();
        }
开发者ID:nigel-sampson,项目名称:talks,代码行数:26,代码来源:Application.cs

示例6: Configure

        protected override void Configure()
        {
            container = new SimpleContainer();
            container.Instance(container);

            container
              .Singleton<ICredentialsService, UserDefaultsCredentialsService>();
        }
开发者ID:nigel-sampson,项目名称:talks,代码行数:8,代码来源:CaliburnAppDelegate.cs

示例7: Configure

        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>();
        }
开发者ID:upta,项目名称:LeagueTag,代码行数:18,代码来源:AppBootstrapper.cs

示例8: Configure

        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",
                });
        }
开发者ID:Geminior,项目名称:Caliburn.Micro.Extras,代码行数:14,代码来源:AppBootstrapper.cs

示例9: Configure

		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>();
		}
开发者ID:paulirwin,项目名称:Luke.Net,代码行数:16,代码来源:AppBootstrapper.cs

示例10: Configure

        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>();
        }
开发者ID:nigel-sampson,项目名称:talks,代码行数:18,代码来源:Application.cs

示例11: Configure

        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>();
        }
开发者ID:nigel-sampson,项目名称:talks,代码行数:20,代码来源:AppDelegate.cs

示例12: Configure

        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>();
        }
开发者ID:nigel-sampson,项目名称:talks,代码行数:21,代码来源:Application.cs

示例13: InstanceTest

		public void InstanceTest()
		{
			SimpleContainer sc = new SimpleContainer();
			ITest1 ti = new Test1();
			sc.Instance<ITest1, Test1>(ti);
			var result = sc.GetInstance<ITest1>();
			Assert.AreEqual(result, ti);
			var result2 = sc.GetInstance<Test1>();
			Assert.AreEqual(result2, ti);

			Test2 t2 = new Test2();
			sc.Instance(t2);
			var result3 = sc.GetInstance<Test2>();
			Assert.AreEqual(result3, t2);

			Test3 t3 = new Tests.Test3();
			sc.Instance<ITest3>(t3);
			var result4 = sc.GetInstance<ITest3>();
			Assert.AreEqual(result4, t3);
		}
开发者ID:holtsoftware,项目名称:House,代码行数:20,代码来源:SimpleContainerTests.cs


注:本文中的SimpleContainer.Instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。