Beispiel #1
0
        private void RegisterMessageQueue()
        {
            ITinyThreadPool threadPool = TinyThreadPool.Create(x =>
            {
                x.MaxThreads             = 3;
                x.MultiThreadingCapacity = MultiThreadingCapacity.PerProcessor;
            });

            IMessageQueue inputQueue = QueueConfiguration.Create()
                                       .Configure(config =>
            {
                config.DataSerializer = KernelInstance.Get <IDataSerializer>();
                config.QueueUrl       = _settings.InputTweetQueueUrl;
            }).CreateLocalQueue();

            IMessageQueue outputQueue = QueueConfiguration.Create()
                                        .Configure(config =>
            {
                config.DataSerializer = KernelInstance.Get <IDataSerializer>();
                config.QueueUrl       = _settings.OutputTweetQueueUrl;
            }).CreateLocalQueue();

            Bind <StopWordsProcessor>().ToConstructor(x => new StopWordsProcessor(inputQueue, outputQueue, threadPool, x.Inject <IDataSerializer>()))
            .InSingletonScope();
        }
 public override void Load()
 {
     base.Load();
     KernelInstance.Bind <IPrincipal, IPrincipal <IMember> >().To <ProjectPrincipal>().InRequestScope();
     KernelInstance.Bind <IMember>().To <WindowsMember>().When(r => Thread.CurrentPrincipal.Identity.GetType() == typeof(WindowsIdentity)).InRequestScope();
     KernelInstance.Bind <IMember>().To <ClaimMember>().When(r => Thread.CurrentPrincipal.Identity.GetType() == typeof(ClaimsIdentity)).InRequestScope();
 }
Beispiel #3
0
 private IEnumerable <IMenuItem> GetFormDesignerContextMenuItems()
 {
     return(new IMenuItem[]
     {
         KernelInstance.Get <FormDesignerRefactorRenameCommandMenuItem>()
     });
 }
Beispiel #4
0
 /// <summary>Releases the kernel on application end.</summary>
 public void ShutDown()
 {
     if (KernelInstance != null)
     {
         KernelInstance.Components.GetAll <INinjectHttpApplicationPlugin>().Map(c => c.Stop());
         KernelInstance.Dispose();
         KernelInstance = null;
     }
 }
        public override void Load()
        {
            Bind <RoleManager <IdentityRole> >().To <ApplicationRoleManager>();
            Bind <UserManager <ApplicationUser> >().To <ApplicationUserManager>();

            Bind <RoleStore <IdentityRole> >().ToSelf().WithConstructorArgument("context", context =>
                                                                                KernelInstance.Get <ApplicationDbContext>());
            Bind <UserStore <ApplicationUser> >().ToSelf().WithConstructorArgument("context", context =>
                                                                                   KernelInstance.Get <ApplicationDbContext>());
        }
Beispiel #6
0
 private IEnumerable <IMenuItem> GetProjectWindowContextMenuItems()
 {
     return(new IMenuItem[]
     {
         KernelInstance.Get <ProjectExplorerRefactorRenameCommandMenuItem>(),
         KernelInstance.Get <FindSymbolCommandMenuItem>(),
         KernelInstance.Get <FindAllReferencesCommandMenuItem>(),
         KernelInstance.Get <FindAllImplementationsCommandMenuItem>()
     });
 }
Beispiel #7
0
        private IMenuItem GetToolsParentMenu()
        {
            var items = new IMenuItem[]
            {
                KernelInstance.Get <ShowSourceControlPanelCommandMenuItem>(),
                KernelInstance.Get <RegexAssistantCommandMenuItem>(),
                KernelInstance.Get <ToDoExplorerCommandMenuItem>()
            };

            return(new ToolsParentMenu(items));
        }
Beispiel #8
0
 private IEnumerable <IMenuItem> GetCodePaneContextMenuItems()
 {
     return(new[]
     {
         GetRefactoringsParentMenu(),
         GetSmartIndenterParentMenu(),
         KernelInstance.Get <FindSymbolCommandMenuItem>(),
         KernelInstance.Get <FindAllReferencesCommandMenuItem>(),
         KernelInstance.Get <FindAllImplementationsCommandMenuItem>()
     });
 }
Beispiel #9
0
        public static IField Copy(this IField field)
        {
            IField newField = KernelInstance.Get <IField>();

            newField.Pawn  = field.Pawn;
            newField.Heigh = field.Heigh;
            newField.Width = field.Width;
            newField.ID    = field.ID;

            return(newField);
        }
Beispiel #10
0
        private IMenuItem GetSmartIndenterParentMenu()
        {
            var items = new IMenuItem[]
            {
                KernelInstance.Get <IndentCurrentProcedureCommandMenuItem>(),
                KernelInstance.Get <IndentCurrentModuleCommandMenuItem>(),
                KernelInstance.Get <IndentCurrentProjectCommandMenuItem>(),
                KernelInstance.Get <NoIndentAnnotationCommandMenuItem>()
            };

            return(new SmartIndenterParentMenu(items));
        }
Beispiel #11
0
        public static IBoard FullCopy(this IBoard board)
        {
            IBoard newBoard = KernelInstance.Get <IBoard>();

            newBoard.MaxHeight = board.MaxHeight;
            newBoard.MinHeight = board.MinHeight;
            newBoard.MaxWidth  = board.MaxWidth;
            newBoard.MinWidth  = board.MinWidth;
            newBoard.FieldList = board.FieldList.CopyList();

            return(newBoard);
        }
Beispiel #12
0
        private IMenuItem GetNavigateParentMenu()
        {
            var items = new IMenuItem[]
            {
                KernelInstance.Get <CodeExplorerCommandMenuItem>(),
                //KernelInstance.Get<RegexSearchReplaceCommandMenuItem>(),
                KernelInstance.Get <FindSymbolCommandMenuItem>(),
                KernelInstance.Get <FindAllReferencesCommandMenuItem>(),
                KernelInstance.Get <FindAllImplementationsCommandMenuItem>()
            };

            return(new NavigateParentMenu(items));
        }
Beispiel #13
0
        private IMenuItem GetUnitTestingParentMenu()
        {
            var items = new IMenuItem[]
            {
                KernelInstance.Get <RunAllTestsCommandMenuItem>(),
                KernelInstance.Get <TestExplorerCommandMenuItem>(),
                KernelInstance.Get <AddTestModuleCommandMenuItem>(),
                KernelInstance.Get <AddTestMethodCommandMenuItem>(),
                KernelInstance.Get <AddTestMethodExpectedErrorCommandMenuItem>()
            };

            return(new UnitTestingParentMenu(items));
        }
Beispiel #14
0
        private IEnumerable <ICommandMenuItem> GetRubberduckCommandBarItems()
        {
            return(new ICommandMenuItem[]
            {
                KernelInstance.Get <ReparseCommandMenuItem>(),
                KernelInstance.Get <ShowParserErrorsCommandMenuItem>(),
                KernelInstance.Get <ContextSelectionLabelMenuItem>(),
                KernelInstance.Get <ReferenceCounterLabelMenuItem>(),
#if DEBUG
                KernelInstance.Get <SerializeDeclarationsCommandMenuItem>()
#endif
            });
        }
Beispiel #15
0
        private IBoard SetBoard()
        {
            IBoard board = KernelInstance.Get <IBoard>();

            board.MaxHeight = maxHeight;
            board.MaxWidth  = maxWidth;
            board.MinHeight = 1;
            board.MinWidth  = 1;

            board.SetStartBoard();

            return(board);
        }
Beispiel #16
0
 private void BindAmbientObjects()
 {
     KernelInstance.Bind <IDependencyResolver>().To <NinjectDependencyResolver>().InSingletonScope();
     KernelInstance.Bind <IUnitOfWork, IDbUnitOfWork>().To <EntityFrameworkUnitOfWork>().InTransientScope();
     KernelInstance.Bind <DbContext>().To <ProjectContext>().InTransientScope().WithConstructorArgument("configuration", nameof(ProjectContext));
     KernelInstance.Bind <ProjectContext>().ToSelf().InTransientScope().WithConstructorArgument("configuration", nameof(ProjectContext));
     KernelInstance.Bind <ProjectFilesContext>().ToSelf().InTransientScope().WithConstructorArgument("configuration", nameof(ProjectFilesContext));
     KernelInstance.Bind <ILogger>().To <TraceLog>().InSingletonScope();
     KernelInstance.Bind <ICache>().To <InMemoryCache>().InSingletonScope();
     KernelInstance.Bind <IGuidProvider>().To <GuidProvider>().InSingletonScope();
     KernelInstance.Bind <IDateTimeProvider>().To <LocalDateTimeProvider>().InSingletonScope();
     KernelInstance.Bind <IDateTimeOffsetProvider>().To <LocalDateTimeOffsetProvider>().InSingletonScope();
     KernelInstance.Bind <AC>().ToSelf().InSingletonScope();
 }
Beispiel #17
0
 private IEnumerable <IMenuItem> GetRubberduckMenuItems()
 {
     return(new[]
     {
         KernelInstance.Get <AboutCommandMenuItem>(),
         KernelInstance.Get <SettingsCommandMenuItem>(),
         KernelInstance.Get <InspectionResultsCommandMenuItem>(),
         GetUnitTestingParentMenu(),
         GetSmartIndenterParentMenu(),
         GetToolsParentMenu(),
         GetRefactoringsParentMenu(),
         GetNavigateParentMenu()
     });
 }
Beispiel #18
0
        public static void SetStartBoard(this IBoard board)
        {
            int idIncrementation = 0;

            for (int i = board.MinHeight; i <= board.MaxHeight; i++)
            {
                for (int j = board.MinWidth; j <= board.MaxWidth; j++)
                {
                    IField field = KernelInstance.Get <IField>();
                    field.Heigh = i;
                    field.Width = j;
                    field.ID    = ++idIncrementation;
                    board.FieldList.Add(field);
                }
            }
        }
Beispiel #19
0
        //Refaktor, metoda jest już nie czytelna
        public void PawnMove(IField fieldCurrent, IField fieldNew)
        {
            bool canPlayerPlayThisPaw = fieldCurrent.Pawn.Color == PlayerTurn.Color;

            if (!canPlayerPlayThisPaw)
            {
                return;
            }

            bool isMoveDone = Rules.PawnMove(fieldCurrent, fieldNew);

            if (!isMoveDone)
            {
                Alert(MessageContents.IncorrectMovement);
                return;
            }



            //Pomyśl. Zamisat mieć dwie moetody, gdzie szachmat musi wywolać szach. Przez co wołamy dwa razy tą samą metodę
            //Lepiej było by sprawdzić czy jest szach, zanotować tą informację (np. w Enum?), a potem sprawdzić czy jest szachmat.

            if (CheckGameStatus())
            {
                return;
            }


            if (Rules.IsPawnUpgrade(fieldNew))
            {
                PawChess pawChosed = ChosePawUpgrade(pawToChoseList);
                fieldNew.Pawn.Type = (PawType)pawChosed;
            }


            IPawnHistory history = KernelInstance.Get <IPawnHistory>();

            history.Turn           = Turn;
            history.PreviusFiledID = fieldCurrent.ID;
            history.CurrentFiledID = fieldNew.ID;
            history.PawID          = fieldNew.Pawn.ID;

            PawnHistoriesList.Add(history); //Myśę że można by zrobić extensiona

            Turn++;
            PlayerTurn = PlayerList.First(p => p.ID != PlayerTurn.ID);
        }
Beispiel #20
0
        private IMenuItem GetToolsParentMenu()
        {
            var items = new List <IMenuItem> ()
            {
                KernelInstance.Get <RegexAssistantCommandMenuItem>(),
                KernelInstance.Get <ToDoExplorerCommandMenuItem>(),
                KernelInstance.Get <ExportAllCommandMenuItem>()
            };


            if (KernelInstance.Get <IGeneralConfigService>().LoadConfiguration().UserSettings.GeneralSettings.SourceControlEnabled == true)
            {
                items.Add(KernelInstance.Get <SourceControlCommandMenuItem>());
            }

            return(new ToolsParentMenu(items.ToArray()));
        }
Beispiel #21
0
        public override void Load()
        {
            KernelInstance.Bind <IBatteryInfo>()
            .To <BatteryInfo>();

            KernelInstance.Bind <IBatteryParameters>()
            .To <BatteryParameters>();

            KernelInstance.Bind <IBatteryParametersFactory>()
            .ToFactory()
            .InSingletonScope();

            KernelInstance.Bind <IBatteryDetailPresenter>()
            .To <BatteryDetailPresenter>()
            .InSingletonScope();

            KernelInstance.Bind <IBatteryDetail>()
            .To <BatteryDetail>()
            .InSingletonScope();

            KernelInstance.Bind <IBatteryIcon>()
            .To <BatteryIcon>()
            .InSingletonScope()
            .WithConstructorArgument("batteryTemplate", Properties.Resources.BattLevel)
            .WithConstructorArgument("batteryLevelMask", new Rectangle(5, 10, 20, 10))
            .WithConstructorArgument("batteryOrientation", BatteryIcon.BatteryOrientation.HorizontalL)
            .WithPropertyValue("BatteryLevel", 0);

            KernelInstance.Bind <IBatteryDataRetriever>()
            .To <BatteryDataRetriever>()
            .InSingletonScope();

            KernelInstance.Bind <IRdpServerVirtualChannel>()
            .To <RdpServerVirtualChannel>()
            .InSingletonScope()
            .WithConstructorArgument("channelName", "BATTMON");

            KernelInstance.Bind <ILog>().ToMethod(context =>
                                                  LogManager.GetLogger(context.Request.Target.Member.ReflectedType));

            KernelInstance.Bind <System.Timers.Timer>()
            .ToSelf()
            .InSingletonScope()
            .WithPropertyValue("AutoReset", true)
            .WithPropertyValue("Interval", Properties.Settings.Default.PollingInterval * 1000.0);
        }
Beispiel #22
0
        public override void Load()
        {
            //Configure the log here because this section will
            //get called once on startup, before the ILog instance
            //gets created.
            //
            //The client will only log if there is a log4net.config
            //file in the same folder as the DLL.
            string path          = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
            string log4NetConfig = Path.Combine(path, Properties.Resources.Log4NetConfig);

            if (File.Exists(log4NetConfig))
            {
                XmlConfigurator.Configure(new FileInfo(log4NetConfig));
            }
            else
            {
                //No config file.  Turn logging off.
                Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository();
                hierarchy.Root.Level = Level.Off;
            }
            KernelInstance.Bind <IRdpClientVirtualChannel>()
            .To <RdpClientVirtualChannel>()
            .InSingletonScope()
            .WithConstructorArgument("channelName", "BATTMON");

            KernelInstance.Bind <IBatteryDataReporter>()
            .To <BatteryDataReporter>()
            .InSingletonScope();

            KernelInstance.Bind <IBatteryDataCollector>()
            .To <Win32BatteryManagementObjectSearcher>()
            .InSingletonScope()
            .WithConstructorArgument("query", "SELECT * FROM Win32_Battery");

            KernelInstance.Bind <IBatteryInfoFactory>()
            .ToFactory()
            .InSingletonScope();

            KernelInstance.Bind <Program>()
            .ToSelf();

            KernelInstance.Bind <ILog>().ToMethod(context =>
                                                  LogManager.GetLogger(context.Request.Target.Member.ReflectedType));
        }
Beispiel #23
0
        public CheckerGame(CheckerGameBulider bulider)
        {
            //Tutaj zrobić refaktor
            Board             = KernelInstance.Get <IBoard>();
            Rules             = new RulesChecker(Board);
            PawnHistoriesList = new List <IPawnHistory>();
            Alert             = bulider.Alert;

            Board.MaxHeight = 8;
            Board.MaxWidth  = 8;
            Board.MinHeight = 1;
            Board.MinWidth  = 1;
            Turn            = 1;
            Board.SetStartBoard();
            Rules.SetStartPositionOnBoard();
            PlayerList = bulider.PlayerList;
            SetColorAndStartPlayer();
        }
Beispiel #24
0
        public void SetStartPositionOnBoard()
        {
            int idIncrementation = 0;

            IEnumerable <IField> pawnToSet = board.FieldList.Where(field =>
                                                                   (field.Heigh != 4 && field.Heigh != 5) &&
                                                                   ((field.Heigh % 2 == 1 && field.Width % 2 == 1) ||
                                                                    (field.Heigh % 2 == 0 && field.Width % 2 == 0))
                                                                   );

            foreach (IField field in pawnToSet)
            {
                field.Pawn       = KernelInstance.Get <IPawn>();
                field.Pawn.Type  = PawType.PawnCheckers;
                field.Pawn.Color = (field.Heigh == 8 || field.Heigh == 7 || field.Heigh == 6) ? PawColors.Black : PawColors.White;
                field.Pawn.ID    = ++idIncrementation;
            }
        }
Beispiel #25
0
        private IMenuItem GetRefactoringsParentMenu()
        {
            var items = new IMenuItem[]
            {
                KernelInstance.Get <CodePaneRefactorRenameCommandMenuItem>(),
#if DEBUG
                KernelInstance.Get <RefactorExtractMethodCommandMenuItem>(),
#endif
                KernelInstance.Get <RefactorReorderParametersCommandMenuItem>(),
                KernelInstance.Get <RefactorRemoveParametersCommandMenuItem>(),
                KernelInstance.Get <RefactorIntroduceParameterCommandMenuItem>(),
                KernelInstance.Get <RefactorIntroduceFieldCommandMenuItem>(),
                KernelInstance.Get <RefactorEncapsulateFieldCommandMenuItem>(),
                KernelInstance.Get <RefactorMoveCloserToUsageCommandMenuItem>(),
                KernelInstance.Get <RefactorExtractInterfaceCommandMenuItem>(),
                KernelInstance.Get <RefactorImplementInterfaceCommandMenuItem>()
            };

            return(new RefactoringsParentMenu(items));
        }
Beispiel #26
0
        public ChessBoardBulider SetPawn(PawChess pawnType, int height, int width, PawColors color)
        {
            //Przydała by się walidacja
            var pawn = KernelInstance.Get <IPawn>();

            pawn.Color = color;
            pawn.ID    = pawId;
            pawn.Type  = (PawType)pawnType;

            IField field = KernelInstance.Get <IField>();

            field.Heigh = height;
            field.Width = width;
            field.Pawn  = pawn;

            fieldList.Add(field);

            pawId++;

            return(this);
        }
Beispiel #27
0
        public override void Load()
        {
            string connectionString = ConfigurationManager.ConnectionStrings["Hms.Database"].ConnectionString;

            this.Bind <IGadgetKeysInfoRepository>().ToConstructor(_ => new GadgetKeysInfoRepository(connectionString));
            this.Bind <IUserRepository>().ToConstructor(_ => new UserRepository(connectionString));
            this.Bind <IUserRoleRepository>().ToConstructor(_ => new UserRoleRepository(connectionString));
            this.Bind <IMedicalCardRepository>().ToConstructor(_ => new MedicalCardRepository(connectionString));
            this.Bind <IProfileRepository>().ToConstructor(_ => new ProfileRepository(connectionString));
            this.Bind <IHealthcareInstitutionRepository>().ToConstructor(_ => new HealthcareInstitutionRepository(connectionString));
            this.Bind <IMedicalSpecializationRepository>().ToConstructor(_ => new MedicalSpecializationRepository(connectionString));
            this.Bind <IAttachmentRepository>().ToConstructor(_ => new AttachmentRepository(connectionString));
            this.Bind <IUserSessionRepository>().ToConstructor(_ => new UserSessionRepository(connectionString));
            this.Bind <IAppointmentRepository>().ToConstructor(_ => new AppointmentRepository(connectionString));

            this.Bind <IDoctorRepository>().ToConstructor(_ => new DoctorRepository(connectionString, KernelInstance.Get <IHealthcareInstitutionRepository>(), KernelInstance.Get <IMedicalSpecializationRepository>()));
            this.Bind <IPolyclinicRegionRepository>().ToConstructor(_ => new PolyclinicRegionRepository(connectionString, KernelInstance.Get <IDoctorRepository>()));
            this.Bind <IPolyclinicRepository>().ToConstructor(_ => new PolyclinicRepository(connectionString, KernelInstance.Get <IPolyclinicRegionRepository>(), this.KernelInstance.Get <IBuildingRepository>()));
            this.Bind <IBuildingRepository>().ToConstructor(_ => new BuildingRepository(connectionString, KernelInstance.Get <IPolyclinicRegionRepository>()));
        }
Beispiel #28
0
 private void BindRepositories()
 {
     KernelInstance.Bind <IBinaryMetaRepository>().To <BinaryMetaRepository>().InTransientScope();
     KernelInstance.Bind <IUserRepository>().To <UserRepository>().InTransientScope();
 }
Beispiel #29
0
 private void ConfigureBusinessLayerInfrastructure()
 {
     KernelInstance.Bind <IJsonConverter>().To <JsonConverter>().InSingletonScope();
 }
 public override void Load()
 {
     KernelInstance.Bind <IApplicationManager>().To <ApplicationManager>();
     KernelInstance.Bind <IUsuarioService>().To <UsuarioService>();
     KernelInstance.Bind <IMovimentacaoService>().To <MovimentacaoService>();
 }