/* * Experimental code! * Exploring the use of the Command pattern to wire up controls to * OnClick events, and have the controls enable/disable themselves using the * command's CanExecuteChanged() method. */ private void AttachCommands() { var maybeController = SharedResources.ConnectionManager.MaybeControllerInstance; if (!maybeController.Any()) { return; } var controller = maybeController.Single(); clickCommands = new List <ClickCommand> { OpenButton.AttachCommand(ExecuteOpenShutter, CanMoveShutterOrDome), CloseButton.AttachCommand(ExecuteCloseShutter, CanMoveShutterOrDome), StopCommand.AttachCommand(ExecuteStop, CanStop) }; }