Ejemplo n.º 1
0
 public void RegisterTool(IKeyCombination keyCombination, ITool tool)
 {
     this.keyCombinationSubjects.Add(KeyCombinationSubject.Builder(keyCombination)
                                     .OnActivate(() => this.SelectedTool = tool)
                                     .Build());
     this.tools.Add(tool);
 }
Ejemplo n.º 2
0
        public Tools(Func <IToolApplier> toolApplierProvider, IMousePositionProvider mousePositionProvider, IKeyCombination escape, IKeyCombination activator)
        {
            Debug.Assert(toolApplierProvider != null);
            Debug.Assert(mousePositionProvider != null);
            this.toolApplierProvider   = toolApplierProvider;
            this.mousePositionProvider = mousePositionProvider;

            this.keyCombinationSubjects.Add(KeyCombinationSubject.Builder(escape)
                                            .OnActivate(() => this.SelectedTool = null)
                                            .Build());
            this.keyCombinationSubjects.Add(KeyCombinationSubject.Builder(activator)
                                            .OnActivate(() => this.ActiveTool = this.SelectedTool)
                                            .OnContinuous(() => this.ContinueTool())
                                            .OnDeactivate(() => this.EnactTool())
                                            .Build());
        }