michaellperry / Assisticant

MIT License
36 stars 19 forks source link

Pass command parameter to view model method if it accepts one #6

Closed robertvazan closed 10 years ago

robertvazan commented 10 years ago

I didn't modify MakeCommand, because I do not use it and I am afraid I could break it if I don't test it. So this patch is only for MethodCommand for now.

michaellperry commented 10 years ago

Make sure that CanExecute takes a dependency upon the parameter. It seems like the way it's written now, it will cache the value and not recompute if only the parameter changes. Maybe _lastParameter should be an observable that holds the last parameter, and CanExecute uses that instead of passing it in.

robertvazan commented 10 years ago

CanExecute doesn't pass the parameter to downstream code. It can thus ignore changes in the parameter, because downstream code has no way to access (and depend on) that parameter anyway.

michaellperry commented 10 years ago

Ah, of course. OK, let's keep this in mind for when we do pass parameters to CanExecute.