Sha256: 0a339a412bdfbfc96740922a5bf4e1ae4ea5d6d396f39860a9eee3ea8231aef4

Contents?: true

Size: 842 Bytes

Versions: 2

Compression:

Stored size: 842 Bytes

Contents

module IronNails

  module View

    class BehaviorCommand < Command

      def to_clr_command
        # I have to wrap the method calls into blocks because .to_proc hasn't been implemented yet on method
        # the Func's have to be wrapped in lambda's to preserve the return statement.
        unless asynchronous?
          delegate_command.new(Action.new { execute }, Func[System::Boolean].new(&lambda{ can_execute? } ))
        else
          async_delegate_command.new(Action.new { execute }, Action.new { refresh_view },
                                     Func[System::Boolean].new(&lambda{ can_execute? }))
        end
      end

      def delegate_command
        IronNails::Library::DelegateCommand
      end

      def async_delegate_command
        IronNails::Library::AsynchronousDelegateCommand
      end
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ironnails-0.0.3 lib/ironnails/view/commands/behavior_command.rb
ironnails-0.0.1 lib/ironnails/view/commands/behavior_command.rb