• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# SimpleContainer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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


示例2: Configure

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

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


示例3: Configure

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

            container.Singleton<IWindowManager, WindowManager>();
            container.Singleton<IEventAggregator, EventAggregator>();
            container.PerRequest<IShell, ShellViewModel>();
        }
开发者ID:alaskaninja,项目名称:Overheads,代码行数:7,代码来源:AppBootstrapper.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: MDIViewModel

 public MDIViewModel(SimpleContainer container) {
     this.Master = container.GetInstance<SettingViewModel>();
     this.Detail = container.GetInstance<TabViewModel>();
     //var vm = container.GetInstance<JobDetailViewModel>();
     //vm.ID = 1178538;
     //this.Detail = vm;
 }
开发者ID:zhangcj,项目名称:Xamarin.Forms.Lagou,代码行数:7,代码来源:MDIViewModel.cs


示例6: NoResolvableConstructor

        public void NoResolvableConstructor()
        {
            var c = new SimpleContainer();

            // wyjątek, string nie ma konstruktora bezparametrowego i nie da się rozwikłać żadnego z konstruktorów
            c.Resolve<ConcreteWithStringParam>();
        }
开发者ID:solarplexus6,项目名称:Oop,代码行数:7,代码来源:L10Tests.cs


示例7: 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


示例8: HasHandler_returns_true_when_handler_exists

 public void HasHandler_returns_true_when_handler_exists() {
     var container = new SimpleContainer();
     container.RegisterPerRequest(typeof (object), "Object", typeof (object));
     
     Assert.True(container.HasHandler(typeof (object), null));
     Assert.True(container.HasHandler(null, "Object"));
 }
开发者ID:haoasqui,项目名称:Caliburn.Micro,代码行数:7,代码来源:SimpleContainerTests.cs


示例9: RegistModel

        private void RegistModel(SimpleContainer container) {

            var types = this.GetType().GetTypeInfo().Assembly.DefinedTypes
                .Select(t => new { T = t, Mode = t.GetCustomAttribute<RegistAttribute>()?.Mode })
                .Where(o => o.Mode != null && o.Mode != InstanceMode.None);

            foreach (var t in types) {
                var type = t.T.AsType();
                if (t.Mode == InstanceMode.Singleton) {
                    container.RegisterSingleton(type, null, type);
                } else if (t.Mode == InstanceMode.PreRequest) {
                    container.RegisterPerRequest(type, null, type);
                }
            }

            //container
            //    .Singleton<TabViewModel>()
            //    .Singleton<SettingViewModel>()
            //    .Singleton<MDIViewModel>()
            //    .Singleton<IndexViewModel>()
            //    .Singleton<SearchViewModel>()
            //    .Singleton<CompanyPositionsViewModel>()
            //    .Singleton<MyViewModel>()
            //    .Singleton<LoginViewModel>()
            //    .Singleton<FavoritesViewModel>()

            //    .PerRequest<CitySelectorViewModel>()
            //    .PerRequest<JobDetailViewModel>()
            //    .PerRequest<SearchedItemViewModel>()
            //    ;
        }
开发者ID:zhangcj,项目名称:Xamarin.Forms.Lagou,代码行数:31,代码来源:App.cs


示例10: EditSensorViewModel

        public EditSensorViewModel(IWindowManager windowManager, SimpleContainer container)
        {
            _windowManager = windowManager;
            _container = container;

            Templates = SensorTemplate.ImportAll();
        }
开发者ID:rwlamont,项目名称:AllItUp,代码行数:7,代码来源:EditSensorViewModel.cs


示例11: The_child_container_returned_contains_parent_entries

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


示例12: RegisterDependencies

 public void RegisterDependencies(SimpleContainer container)
 {
     container.Register<DefaultController>();
     container.Register<QuotesController>();
     container.Register<IClock, Clock>();
     container.Register<IQuotesRepository, QuotesRepository>();
 }
开发者ID:tomwscott,项目名称:blueprint,代码行数:7,代码来源:Infrastructure.cs


示例13: FinishedLaunching

        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init ();
            Xamarin.FormsMaps.Init ();
            // Code for starting up the Xamarin Test Cloud Agent
            #if ENABLE_TEST_CLOUD
            Xamarin.Calabash.Start();
            #endif

            MR.Gestures.iOS.Settings.LicenseKey = "6XZT-V54J-73E4-4VK8-RFAJ-ZBS8-Q8UB-Y3W7-BSGP-FETM-EYQ9-QEPP-WRTA";
            CachedImageRenderer.Init ();

            //ImageService.Initialize(
            //Necessary IOC Code To Get Device Properties
            var container = new SimpleContainer ();
            container.Register<IDevice> (t => AppleDevice.CurrentDevice);
            container.Register<IDisplay> (t => t.Resolve<IDevice> ().Display);
            if( !Resolver.IsSet )
                Resolver.SetResolver (container.GetResolver ());

            // Initialize the parse bluemart client
            try
            {
                ParseClient.Initialize("EUDL8rKwCc1JcL8tw5KsW1QB9ePSGx2dSBTobbE5","PNOG7XhRV8tuB907fQ0S0b5ShaIzYN0wVPZ3AyoN");
            }
            catch(ParseException e) {
                //Log.Warn("BlueMart",e.Message.ToString());
            }

            LoadApplication (new App ());

            return base.FinishedLaunching (app, options);
        }
开发者ID:jiletx,项目名称:Bluemart,代码行数:33,代码来源:AppDelegate.cs


示例14: SetIoc

        //  Inversion of control setup
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            var app = new XFormsAppiOS();
            app.Init(this);
            resolverContainer.Register<IXFormsApp>(app);

            var documents = app.AppDataDirectory;

            // UNEEDED CONTROLS FOR TEST
            //resolverContainer.Register<IGeolocator, Geolocator>();
            //resolverContainer.Register<IEmailService, EmailService>();
            //resolverContainer.Register<IMediaPicker, MediaPicker>();
            //resolverContainer.Register<IDevice>( t => AppleDevice.CurrentDevice);
            Resolver.SetResolver(resolverContainer.GetResolver());

            DependencyService.Register<Geolocator> ();

            //resolverContainer.Register<IDevice>(t => AndroidDevice.CurrentDevice);
            //Resolver.SetResolver(resolverContainer.GetResolver());

            //  Startup location services

            Util util = new Util ();
            util.EnableLocationServices ();
        }
开发者ID:bertbeck,项目名称:maptest,代码行数:28,代码来源:AppDelegate.cs


示例15: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            var resolverContainer = new SimpleContainer();

            resolverContainer.Register<IDevice>(t => AndroidDevice.CurrentDevice)
                .Register<IDisplay>(t => t.Resolve<IDevice>().Display)
                .Register<IFontManager>(t => new FontManager(t.Resolve<IDisplay>()))
                //.Register<IJsonSerializer, Services.Serialization.JsonNET.JsonSerializer>()
                //.Register<IJsonSerializer, JsonSerializer>()
                //.Register<IEmailService, EmailService>()
                .Register<IMediaPicker, MediaPicker>()
                .Register<ITextToSpeechService, TextToSpeechService>()
                .Register<IDependencyContainer>(resolverContainer)
                .Register<IAdvancedTimer>(t => new AdvancedTimer.Forms.Plugin.Droid.AdvancedTimerImplementation());
                //.Register<IXFormsApp>(app)
                //.Register<ISecureStorage>(t => new KeyVaultStorage(t.Resolve<IDevice>().Id.ToCharArray()))
                //.Register<ISimpleCache>(
                //    t => new SQLiteSimpleCache(new SQLitePlatformAndroid(),
                //        new SQLiteConnectionString(pathToDatabase, true), t.Resolve<IJsonSerializer>()));

            Resolver.SetResolver(resolverContainer.GetResolver());

            global::Xamarin.Forms.Forms.Init(this, bundle);
            AdvancedTimer.Forms.Plugin.Droid.AdvancedTimerImplementation.Init();
            LoadApplication(new App());
        }
开发者ID:xlent-bi,项目名称:XlentLock,代码行数:28,代码来源:MainActivity.cs


示例16: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            //initialising shared project variables
            App.screenWidth = (int)(Resources.DisplayMetrics.WidthPixels / Resources.DisplayMetrics.Density);
            App.screenHeight = (int)(Resources.DisplayMetrics.HeightPixels / Resources.DisplayMetrics.Density);
            App.cameraAccessGranted = true;

            base.OnCreate(bundle);

            //initialising the resolver for the devices camera
            //used in the CameraViewModel class for cross-platform
            //camera functionality
            #region Resolver Init
            SimpleContainer container = new SimpleContainer();
            container.Register<IDevice>(t => AndroidDevice.CurrentDevice);
            container.Register<IDisplay>(t => t.Resolve<IDevice>().Display);
            container.Register<INetwork>(t => t.Resolve<IDevice>().Network);

            Resolver.SetResolver(container.GetResolver());
            #endregion

            global::Xamarin.Forms.Forms.Init(this, bundle);
            global::Xamarin.FormsMaps.Init (this, bundle);
            LoadApplication(new App());
        }
开发者ID:EclipseSystems,项目名称:INB302-IT-Capstone-Unit,代码行数:25,代码来源:MainActivity.cs


示例17: CyclicDependencySimple

        public void CyclicDependencySimple()
        {
            var c = new SimpleContainer();

            c.RegisterType<ITypeToResolve, ConcreteWithSimpleCyclicDependency>();
            c.Resolve<ITypeToResolve>();
        }
开发者ID:solarplexus6,项目名称:Oop,代码行数:7,代码来源:L10Tests.cs


示例18: SetIoC

        private void SetIoC()
        {
            // Create the container
            var container = new SimpleContainer();

            var app = new XFormsAppWP();
            app.Init(this);
            DependencyService.Register<SecureStorage>();
            DependencyService.Register<Geolocator>();
            //DependencyService.Register<IRestClient>();
            //DependencyService.Register<JsonRestClient>();
            //DependencyService.Register<RestCoreClient>();
            DependencyService.Register<IWinAppMethods>();
            container.Register<IDevice>(t => WindowsPhoneDevice.CurrentDevice)
                .Register<ISecureStorage>(t => new SecureStorage())
                .Register<IGeolocator>(t => new Geolocator())
                .Register<IDependencyContainer>(container)
                .Register<IXFormsApp>(app);

            // Get the version number
            //Definitions.VersionNumber = Package.Current.Id.Version.ToString();
            

            // Resolve the container
            Resolver.SetResolver(container.GetResolver());

            // After downgrade to 8.0, scale was no longer available in xlabs implementation.
            Definitions.Scale = Application.Current.Host.Content.ScaleFactor / 100d;
            Definitions.ScreenWidth = Application.Current.Host.Content.ActualWidth;
            Definitions.ScreenHeight = Application.Current.Host.Content.ActualHeight;
            var integ = 1;
        }
开发者ID:os2indberetning,项目名称:OS2_Windows_Phone,代码行数:32,代码来源:App.xaml.cs


示例19: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            FontsOverride.setDefaultFont(this, "DEFAULT", "fonts/Arial-Rounded-MT-Bold.ttf");

            global::Xamarin.Forms.Forms.Init (this, bundle);
                Xamarin.FormsMaps.Init(this, bundle);

            MR.Gestures.Android.Settings.LicenseKey = "6XZT-V54J-73E4-4VK8-RFAJ-ZBS8-Q8UB-Y3W7-BSGP-FETM-EYQ9-QEPP-WRTA";
            CachedImageRenderer.Init ();

            //Necessary IOC Code To Get Device Properties
            var container = new SimpleContainer ();
            container.Register<IDevice> (t => AndroidDevice.CurrentDevice);
            container.Register<IDisplay> (t => t.Resolve<IDevice> ().Display);
            if( !Resolver.IsSet )
                Resolver.SetResolver (container.GetResolver ());

            // Initialize the parse bluemart client
            try
            {
                ParseClient.Initialize("EUDL8rKwCc1JcL8tw5KsW1QB9ePSGx2dSBTobbE5","PNOG7XhRV8tuB907fQ0S0b5ShaIzYN0wVPZ3AyoN");
            }
            catch(ParseException e) {
                Log.Warn("BlueMart",e.Message.ToString());
            }

            LoadApplication (new App ());
        }
开发者ID:jiletx,项目名称:Bluemart,代码行数:30,代码来源:MainActivity.cs


示例20: FinishedLaunching

        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();

            var resolverContainer = new SimpleContainer();

            resolverContainer.Register<IDevice>(t => AppleDevice.CurrentDevice)
                .Register<IDisplay>(t => t.Resolve<IDevice>().Display)
                .Register<IFontManager>(t => new FontManager(t.Resolve<IDisplay>()))
                //.Register<IJsonSerializer, XLabs.Serialization.ServiceStack.JsonSerializer>()
                //.Register<IJsonSerializer, Services.Serialization.SystemJsonSerializer>()
                .Register<ITextToSpeechService, TextToSpeechService>()
                .Register<IEmailService, EmailService>()
                .Register<IMediaPicker, MediaPicker>()
                //.Register<IXFormsApp>(app)
                .Register<ISecureStorage, SecureStorage>()
                .Register<IDependencyContainer>(t => resolverContainer);
            //.Register<ISimpleCache>(
            //    t => new SQLiteSimpleCache(new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(),
            //        new SQLite.Net.SQLiteConnectionString(pathToDatabase, true), t.Resolve<IJsonSerializer>()));

            Resolver.SetResolver(resolverContainer.GetResolver());
            LoadApplication(new App());
            return base.FinishedLaunching(app, options);
        }
开发者ID:erkj,项目名称:XlentLock,代码行数:32,代码来源:AppDelegate.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SimpleExpression类代码示例发布时间:2022-05-24
下一篇:
C# SimpleClass类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap