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(); }
private IEnumerable <IMenuItem> GetFormDesignerContextMenuItems() { return(new IMenuItem[] { KernelInstance.Get <FormDesignerRefactorRenameCommandMenuItem>() }); }
private IEnumerable <IMenuItem> GetProjectWindowContextMenuItems() { return(new IMenuItem[] { KernelInstance.Get <ProjectExplorerRefactorRenameCommandMenuItem>(), KernelInstance.Get <FindSymbolCommandMenuItem>(), KernelInstance.Get <FindAllReferencesCommandMenuItem>(), KernelInstance.Get <FindAllImplementationsCommandMenuItem>() }); }
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>()); }
private IMenuItem GetToolsParentMenu() { var items = new IMenuItem[] { KernelInstance.Get <ShowSourceControlPanelCommandMenuItem>(), KernelInstance.Get <RegexAssistantCommandMenuItem>(), KernelInstance.Get <ToDoExplorerCommandMenuItem>() }; return(new ToolsParentMenu(items)); }
private IEnumerable <IMenuItem> GetCodePaneContextMenuItems() { return(new[] { GetRefactoringsParentMenu(), GetSmartIndenterParentMenu(), KernelInstance.Get <FindSymbolCommandMenuItem>(), KernelInstance.Get <FindAllReferencesCommandMenuItem>(), KernelInstance.Get <FindAllImplementationsCommandMenuItem>() }); }
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); }
private IMenuItem GetSmartIndenterParentMenu() { var items = new IMenuItem[] { KernelInstance.Get <IndentCurrentProcedureCommandMenuItem>(), KernelInstance.Get <IndentCurrentModuleCommandMenuItem>(), KernelInstance.Get <IndentCurrentProjectCommandMenuItem>(), KernelInstance.Get <NoIndentAnnotationCommandMenuItem>() }; return(new SmartIndenterParentMenu(items)); }
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); }
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 }); }
private IBoard SetBoard() { IBoard board = KernelInstance.Get <IBoard>(); board.MaxHeight = maxHeight; board.MaxWidth = maxWidth; board.MinHeight = 1; board.MinWidth = 1; board.SetStartBoard(); return(board); }
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)); }
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)); }
private IEnumerable <IMenuItem> GetRubberduckMenuItems() { return(new[] { KernelInstance.Get <AboutCommandMenuItem>(), KernelInstance.Get <SettingsCommandMenuItem>(), KernelInstance.Get <InspectionResultsCommandMenuItem>(), GetUnitTestingParentMenu(), GetSmartIndenterParentMenu(), GetToolsParentMenu(), GetRefactoringsParentMenu(), GetNavigateParentMenu() }); }
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); } } }
//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); }
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())); }
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; } }
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(); }
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)); }
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); }
public override void Load() { // bind VBE and AddIn dependencies to host-provided instances. Bind <IVBE>().ToConstant(_vbe); Bind <IAddIn>().ToConstant(_addin); Bind <App>().ToSelf().InSingletonScope(); Bind <RubberduckParserState>().ToSelf().InSingletonScope(); Bind <ISelectionChangeService>().To <SelectionChangeService>().InSingletonScope(); Bind <ISourceControlProvider>().To <GitProvider>(); //Bind<GitProvider>().ToSelf().InSingletonScope(); Bind <TestExplorerModel>().ToSelf().InSingletonScope(); Bind <IOperatingSystem>().To <WindowsOperatingSystem>().InSingletonScope(); Bind <CommandBase>().To <VersionCheckCommand>().WhenInjectedExactlyInto <App>(); BindCodeInspectionTypes(); var assemblies = new[] { Assembly.GetExecutingAssembly(), Assembly.GetAssembly(typeof(IHostApplication)), Assembly.GetAssembly(typeof(IParseCoordinator)), Assembly.GetAssembly(typeof(IIndenter)) }; ApplyDefaultInterfacesConvention(assemblies); ApplyConfigurationConvention(assemblies); ApplyAbstractFactoryConvention(assemblies); Rebind <IFolderBrowserFactory>().To <DialogFactory>().InSingletonScope(); BindCommandsToMenuItems(); Rebind <IIndenter>().To <Indenter>().InSingletonScope(); Rebind <IIndenterSettings>().To <IndenterSettings>(); Bind <Func <IIndenterSettings> >().ToMethod(t => () => KernelInstance.Get <IGeneralConfigService>().LoadConfiguration().UserSettings.IndenterSettings); BindCustomDeclarationLoadersToParser(); Rebind <IParseCoordinator>().To <ParseCoordinator>().InSingletonScope().WithConstructorArgument("serializedDeclarationsPath", (string)null); Bind <Func <IVBAPreprocessor> >().ToMethod(p => () => new VBAPreprocessor(double.Parse(_vbe.Version, CultureInfo.InvariantCulture))); Rebind <ISearchResultsWindowViewModel>().To <SearchResultsWindowViewModel>().InSingletonScope(); Bind <SourceControlViewViewModel>().ToSelf().InSingletonScope(); Bind <IControlView>().To <ChangesView>().InCallScope(); Bind <IControlView>().To <BranchesView>().InCallScope(); Bind <IControlView>().To <UnsyncedCommitsView>().InCallScope(); Bind <IControlView>().To <SettingsView>().InCallScope(); Bind <IControlViewModel>().To <ChangesViewViewModel>().WhenInjectedInto <ChangesView>().InCallScope(); Bind <IControlViewModel>().To <BranchesViewViewModel>().WhenInjectedInto <BranchesView>().InCallScope(); Bind <IControlViewModel>().To <UnsyncedCommitsViewViewModel>().WhenInjectedInto <UnsyncedCommitsView>().InCallScope(); Bind <IControlViewModel>().To <SettingsViewViewModel>().WhenInjectedInto <SettingsView>().InCallScope(); Bind <SearchResultPresenterInstanceManager>() .ToSelf() .InSingletonScope(); Bind <IDockablePresenter>().To <SourceControlDockablePresenter>() .WhenInjectedInto( typeof(ShowSourceControlPanelCommand), typeof(CommitCommand), typeof(UndoCommand)) .InSingletonScope(); Bind <IDockablePresenter>().To <TestExplorerDockablePresenter>() .WhenInjectedInto( typeof(RunAllTestsCommand), typeof(TestExplorerCommand)) .InSingletonScope(); Bind <IDockablePresenter>().To <CodeInspectionsDockablePresenter>() .WhenInjectedInto <InspectionResultsCommand>() .InSingletonScope(); Bind <IDockablePresenter>().To <CodeExplorerDockablePresenter>() .WhenInjectedInto <CodeExplorerCommand>() .InSingletonScope(); Bind <IDockablePresenter>().To <ToDoExplorerDockablePresenter>() .WhenInjectedInto <ToDoExplorerCommand>() .InSingletonScope(); Bind <IAssignedByValParameterQuickFixDialogFactory>().To <AssignedByValParameterQuickFixDialogFactory>() .WhenInjectedInto <AssignedByValParameterInspection>(); BindDockableToolwindows(); BindCommandsToCodeExplorer(); ConfigureRubberduckCommandBar(); ConfigureRubberduckMenu(); ConfigureCodePaneContextMenu(); ConfigureFormDesignerContextMenu(); ConfigureFormDesignerControlContextMenu(); ConfigureProjectExplorerContextMenu(); BindWindowsHooks(); }
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>())); }