public void Attach(IController controller) { _controller = controller; var updateMenus = new Action(UpdateMenus); var invokeUpdateMenus = new Action(() => Invoke(updateMenus)); _controller.OnBuildStarted += invokeUpdateMenus; _controller.OnBuildFinished += invokeUpdateMenus; _controller.OnProjectLoading += invokeUpdateMenus; _controller.OnProjectLoaded += invokeUpdateMenus; var updateUndoRedo = new CanUndoRedoChanged(UpdateUndoRedo); var invokeUpdateUndoRedo = new CanUndoRedoChanged((u, r) => Invoke(updateUndoRedo, u, r)); _controller.OnCanUndoRedoChanged += invokeUpdateUndoRedo; _controller.Selection.Modified += OnSelectionModified; }