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


C# IKernel.Get方法代码示例

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


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

示例1: SetupCharacter

        private static ICharacter SetupCharacter(IKernel kernel)
        {
            ICharacter adventurer = null;
            do
            {
                ConsoleKeyInfo option = Console.ReadKey();
                switch (option.Key)
                {
                    case ConsoleKey.Escape:
                        Environment.Exit(0);
                        break;
                    case ConsoleKey.A:
                        adventurer = kernel.Get<Warrior>();
                        Console.WriteLine("You are a Warrior");
                        break;
                    case ConsoleKey.B:
                        adventurer = kernel.Get<Elf>();
                        Console.WriteLine("You are a Elf");
                        break;
                    case ConsoleKey.C:
                        adventurer = kernel.Get<Wizard>();
                        Console.WriteLine("You are a Wizard");
                        break;
                }
            } while (adventurer == null);

            Console.WriteLine("Give a new name to your character\nName:");
            adventurer.Name = Console.ReadLine();

            return adventurer;
        }
开发者ID:jcrey,项目名称:Scio.CSharp.Training,代码行数:31,代码来源:Game.cs

示例2: ClassInit

        public static void ClassInit(TestContext context)
        {
            Debug.WriteLine("ClassInit " + context.TestName);
            kernel = Helper.CreateKernel(new TestModule(), new BusinessIoc(), new DalIoc());

            var auth = kernel.Get<IAuthenticationService>();
            var uh = kernel.Get<IUtilisateurBusinessHelper<Utilisateur>>();
            uh.DeleteAll().Wait();

            uh.Create("999", "jcambert", "korben90", "Ambert", "Jean-Christophe", "[email protected]")

                .ContinueWith(x =>
                {
                    uh.AddRole(x.Result, "Administrateur");
                })
                .ContinueWith(x =>
                {
                    uh.Save();
                }).ContinueWith(x =>
                {
                    var islogin = auth.Login("999", "jcambert", "korben90");
                    Assert.IsTrue(islogin.Result);

                }).Wait()
                ;
            Helper.CreateStandardPParametres(true).Wait();
            Helper.CreateStandardParametres(true).Wait();

        }
开发者ID:jcambert,项目名称:Webcorp.Erp,代码行数:29,代码来源:TestCommandes.cs

示例3: SetupAuth

        private static void SetupAuth(IAppBuilder app, IKernel kernel)
        {
            app.UseFormsAuthentication(new FormsAuthenticationOptions
            {
                LoginPath = "/account/login",
                LogoutPath = "/account/logout",
                CookieHttpOnly = true,
                AuthenticationType = Constants.JabbRAuthType,
                CookieName = "jabbr.id",
                ExpireTimeSpan = TimeSpan.FromDays(30),
                DataProtection = kernel.Get<IDataProtection>(),
                Provider = kernel.Get<IFormsAuthenticationProvider>()
            });

            //var config = new FederationConfiguration(loadConfig: false);
            //config.WsFederationConfiguration.Issuer = "";
            //config.WsFederationConfiguration.Realm = "http://localhost:16207/";
            //config.WsFederationConfiguration.Reply = "http://localhost:16207/wsfederation";
            //var cbi = new ConfigurationBasedIssuerNameRegistry();
            //cbi.AddTrustedIssuer("", "");
            //config.IdentityConfiguration.AudienceRestriction.AllowedAudienceUris.Add(new Uri("http://localhost:16207/"));
            //config.IdentityConfiguration.IssuerNameRegistry = cbi;
            //config.IdentityConfiguration.CertificateValidationMode = X509CertificateValidationMode.None;
            //config.IdentityConfiguration.CertificateValidator = X509CertificateValidator.None;

            //app.UseFederationAuthentication(new FederationAuthenticationOptions
            //{
            //    ReturnPath = "/wsfederation",
            //    SigninAsAuthenticationType = Constants.JabbRAuthType,
            //    FederationConfiguration = config,
            //    Provider = new FederationAuthenticationProvider()
            //});

            app.Use(typeof(WindowsPrincipalHandler));
        }
开发者ID:sachin303,项目名称:JabbR,代码行数:35,代码来源:Startup.cs

示例4: OnClick

        public override void OnClick(IKernel kernel)
        {
            Item.Server.Favorite = true;

            kernel.Get<IStorageService>().SaveChanges();
            kernel.Get<IShellController>().CurrentView = Views.FavoritesServers;
        }
开发者ID:jeffboulanger,项目名称:connectuo,代码行数:7,代码来源:AddToFavoritesShardListItemButton.cs

示例5: ShellForm

        public ShellForm(IKernel kernel)
        {
            Asserter.AssertIsNotNull(kernel, "kernel");

            _kernel = kernel;
            _applicationService = _kernel.Get<IApplicationService>();
            _storageService = _kernel.Get<IStorageService>();
            _settingsService = _kernel.Get<ISettingsService>();
            _siteService = _kernel.Get<ISiteService>();
            _controller = _kernel.Get<ShellController>();

            Asserter.AssertIsNotNull(_applicationService, "_applicationService");
            Asserter.AssertIsNotNull(_storageService, "_storageService");
            Asserter.AssertIsNotNull(_settingsService, "_settingsService");
            Asserter.AssertIsNotNull(_siteService, "_siteService");

            InitializeComponent();

            _siteService.Register(SiteNames.ContentSite, contentPanel);
            _siteService.Register(SiteNames.NavigationSite, navigationPanel);
            _siteService.Register(SiteNames.ContentActionsSite, contentActionPanel);

            SetStyle(ControlStyles.OptimizedDoubleBuffer |
                     ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.ResizeRedraw, true);
        }
开发者ID:jeffboulanger,项目名称:connectuo,代码行数:26,代码来源:ShellForm.cs

示例6: Form1

        public Form1(IKernel kernel)
        {
            #region Splash screen Start
            //this.Hide();
            //Thread splashthread = new Thread(new ThreadStart(SplashScreen.ShowSplashScreen));

            //splashthread.IsBackground = true;
            //splashthread.Start();

            #endregion

            Kernel = kernel;
            UserRepository = Kernel.Get<UserRepository>();
            SystemRepository = Kernel.Get<SystemRepository>();
            UserDesktopRepository = Kernel.Get<UserDesktopRepository>();

            InitializeComponent();
            var details = UserRepository.GetSessionDetails(AppSettings.Instance.LiveUserAccount.Username);
            if (details.GoDaddyAccount == null && !string.IsNullOrEmpty(Settings.Default.GDUsername))
            {
                details.GoDaddyAccount = new GoDaddyAccount()
                {
                    AccountId =  Guid.NewGuid(), AccountUsername = details.Username, Password = Settings.Default.GDPassword,
                    Username = Settings.Default.GDUsername, UserID = AppSettings.Instance.LiveUserAccount.AccountID
                };
                SystemRepository.SaveGodaddyAccount(details.GoDaddyAccount);
            }
           
            AppSettings.Instance.SessionDetails = details;
            AppSettings.Instance.GoDaddy = new GoDaddyAuctionSniper(AppSettings.Instance.SessionDetails.Username, Kernel.Get<IUserRepository>());

            LoadAuctions();
            Instance = this;
            //Login();
        }
开发者ID:Alchemy86,项目名称:DAS-Desktop,代码行数:35,代码来源:Form1.cs

示例7: MyClassInitialize

        public static void MyClassInitialize(TestContext testContext)
        {
            kernel = new StandardKernel(new TestModule(), new DalIoc(), new BusinessIoc());

            var auth = kernel.Get<IAuthenticationService>();
            var uh = kernel.Get<IUtilisateurBusinessHelper<Utilisateur>>();
            uh.DeleteAll().Wait();

            uh.Create("999", "jcambert", "korben90", "Ambert", "Jean-Christophe", "[email protected]")

                .ContinueWith(x =>
                {
                    uh.AddRole(x.Result, "Administrateur");
                })
                .ContinueWith(x =>
                {
                    uh.Save();
                }).ContinueWith(x =>
                {
                    var islogin = auth.Login("999", "jcambert", "korben90");
                    Assert.IsTrue(islogin.Result);

                }).Wait()
                ;
            ah = kernel.Get<ArticleBusinessHelper<Article>>();
            ctx = kernel.Get<IDbContext>();
        }
开发者ID:jcambert,项目名称:Webcorp.Erp,代码行数:27,代码来源:TestArticles.cs

示例8: RegisterGlobalFilters

		public static void RegisterGlobalFilters(GlobalFilterCollection filters, IKernel kernel)
		{
			filters.Add(new CustomHandleErrorAttribute(kernel.Get<ILog>()));

			filters.Add(new CultureFilterAttribute(CompositionRootHelper.GetLanguage(kernel)));

			filters.Add(new AccessAuthorizationFilter(() => kernel.Get<IIdentityService>()));
		}
开发者ID:UHgEHEP,项目名称:test,代码行数:8,代码来源:FilterConfig.cs

示例9: DataGenerator

 public DataGenerator()
 {
     _ninjectKernel = new StandardKernel(new Modules.MockRepositoryModule());
     _ninjectKernel.Bind<IClientService>().To<ClientService>();
     _ninjectKernel.Bind<IUserAccountService>().To<UserAccountService>();
     _clientService = _ninjectKernel.Get<IClientService>();
     _userAccountService = _ninjectKernel.Get<IUserAccountService>();
 }
开发者ID:NadavNaeh,项目名称:Experimental,代码行数:8,代码来源:DataGenerator.cs

示例10: SplashScreen

        public SplashScreen(IKernel kernel)
        {
            InitializeComponent();

            _kernel = kernel;
            _applicationService = kernel.Get<IApplicationService>();
            _storageService = kernel.Get<IStorageService>();
        }
开发者ID:jeffboulanger,项目名称:connectuo,代码行数:8,代码来源:SplashScreen.cs

示例11: Init

        public void Init()
        {
            ninject = new StandardKernel(new BindingsModule());

            movementHandler = ninject.Get<IMovementHandler>();

            player = ninject.Get<IPlayer>();
        }
开发者ID:jonsavage,项目名称:Monopoly-Kata,代码行数:8,代码来源:MovementHandlerIntegrationTests.cs

示例12: Patcher

        public Patcher(IKernel kernel)
        {
            _kernel = kernel;
            _storageService = kernel.Get<IStorageService>();
            _settingsService = kernel.Get<ISettingsService>();

            if (string.IsNullOrEmpty(_settingsService.UltimaOnlineDirectory))
                throw new Exception("ConnectUO was unable to find the directory that Ultima Online is installed to.");
        }
开发者ID:jeffboulanger,项目名称:connectuo,代码行数:9,代码来源:Patcher.cs

示例13: Configure

		protected override void Configure()
		{
			_kernel = new Ninject.StandardKernel();

			_kernel.Bind<IEventAggregator>().To<EventAggregator>().InSingletonScope();
			_eventAggregator = _kernel.Get<IEventAggregator>();

			// Singletons
			_kernel.Bind<Settings>().ToSelf().InSingletonScope();
			_kernel.Bind<PumpController>().ToSelf().InSingletonScope();
			_kernel.Bind<ElementController>().ToSelf().InSingletonScope();
			_kernel.Bind<Hardware>().ToSelf().InSingletonScope();
			_kernel.Bind<HardwareInitializer>().ToSelf().InSingletonScope();
			var settings = _kernel.Get<Settings>();

			// Use real hardware if we have a GpioController - else use fakeys
			var shouldUseRealHardware = (GpioController.GetDefault() != null);

			if (shouldUseRealHardware)
			{
				// Configure the ADC for inputs
//				_kernel.Bind<IAnalogToDigitalConvertor>().To<Mcp3208>();
				_kernel.Bind<IAnalogToDigitalConvertor>().To<Mcp3008>().InSingletonScope();

				// Configure the GPIO for outputs
				var gpioController = GpioController.GetDefault();
				var pumpGpioPin = gpioController.OpenPin(settings.PumpGpioPin);
				var elementGpioPin = gpioController.OpenPin(settings.ElementGpioPin);

				// Use real inputs/outputs where requested
				_kernel.Bind<IOutputConnection>().To<GpioOutputConnection>();
				_kernel.Bind<ITemperatureReader>().To<ThermistorTemperatureReader>();

				// Get and configure the hardware object with correct pins etc
				var hardware = _kernel.Get<Hardware>();
				// - GPIO Outputs
				(hardware.PumpOutputConnection as GpioOutputConnection)?.Configure(pumpGpioPin);
				(hardware.ElementOutputConnection as GpioOutputConnection)?.Configure(elementGpioPin);
				// - ADC inputs
				((ThermistorTemperatureReader) hardware.RoofTemperatureReader).PinNumber = settings.RoofThermistorAdcPin;
				((ThermistorTemperatureReader) hardware.TankTemperatureReader).PinNumber = settings.TankThermistorAdcPin;
				((ThermistorTemperatureReader) hardware.InletTemperatureReader).PinNumber = settings.InletThermistorAdcPin;

			} else {
				// Use fake inputs / outputs where requested
				_kernel.Bind<IOutputConnection>().To<FakeOutputConnection>();
				_kernel.Bind<ITemperatureReader>().To<FakeTemperatureReader>();
				// Setup some initial values for fake readings
				var hardware = _kernel.Get<Hardware>();
				((FakeTemperatureReader) hardware.RoofTemperatureReader).FakeTemperatureDegC = 50;
				((FakeTemperatureReader) hardware.InletTemperatureReader).FakeTemperatureDegC = 40;
				((FakeTemperatureReader) hardware.TankTemperatureReader).FakeTemperatureDegC = 30;
				((FakeOutputConnection) hardware.PumpOutputConnection).State = false;
				((FakeOutputConnection) hardware.ElementOutputConnection).State = false;
			}

		}
开发者ID:dbruning,项目名称:SmartSolarDevice,代码行数:57,代码来源:App.xaml.cs

示例14: SetUp

        public void SetUp()
        {
            _view = MockRepository.GenerateMock<ICradiatorView>();
            _configSettings = MockRepository.GenerateMock<IConfigSettings>();
            _configSettings.Expect(c => c.ProjectNameRegEx).Return(".*").Repeat.Any();

            _kernel = new StandardKernel(new CradiatorNinjaModule(_view, _configSettings));
            _factory = _kernel.Get<IWebClientFactory>();
            _kernel.Get<BuildDataTransformer>();
        }
开发者ID:manuviswam,项目名称:Cradiator-Go_CD,代码行数:10,代码来源:BuildStatusFetcher_IntegrationTests.cs

示例15: CreateWith

        public static IArmorGenerator CreateWith(IKernel kernel)
        {
            var collectionsSelector = kernel.Get<ICollectionsSelector>();
            var percentileSelector = kernel.Get<IPercentileSelector>();
            var mundaneWeaponGenerator = kernel.Get<MundaneItemGenerator>(ItemTypeConstants.Armor);
            var magicalWeaponGenerator = kernel.Get<MagicalItemGenerator>(ItemTypeConstants.Armor);
            var generator = kernel.Get<Generator>();

            return new ArmorGenerator(collectionsSelector, percentileSelector, mundaneWeaponGenerator,
                magicalWeaponGenerator, generator);
        }
开发者ID:DnDGen,项目名称:CharacterGen,代码行数:11,代码来源:ArmorGeneratorFactory.cs


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