• Code
  • Tags
  • Users
  • Titles
  • Log in
  • Feedback
  • FAQ
Share Code
Welcome to ForkCan.com

ForkCan is all about sharing code in a social way.

Discuss, debate or argue with other devs about their or your own code.

Give other devs feedback or make a Fork (Make a better version of a shared code).

Rate the code, if you use the code mark it as used so others can see if the shared code is used by someone.

Help each other to be better devs and to be more productive.


Features not working yet:

Flag a post


QR Code

Tiny Url

http://4kcan.com/s/MTg3

Related Code
Strongly typed NotifyPropertyChanged
Silverlight RelayCommand to simplify using the ICommand interface
Fork of Strongly typed NotifyPropertyChanged

Default command implementation for Silverlight

Can be used for detaching view from the view model in silverlight

0
271 0 0 0 0 0

namespace Sra.SilverlightUtils {
  public interface ICommandNotifier:ICommand {
    event EventHandler CommandExecuted;
  }
  public class DefaultCommandNotifier: ICommandNotifier {

    public bool CanExecute(object parameter){
        return true;
    }

    public void Execute(object parameter){
        OnCommandExecuted(EventArgs.Empty);
    }

    private void OnCommandExecuted(EventArgs e){
        if( CommandExecuted != null ) {
            CommandExecuted(this, e);
        }
    }

    public event EventHandler CanExecuteChanged;
    public event EventHandler CommandExecuted;
  }
}

ICommandNotifier expands the ICommand interface by adding the CommandExecuted event. The default implementation of this interface doesn't execute any action from within the Execute method. Instead, it will simply fire the CommandExecuted event.

I can reuse this class in several view model instances and, at the same time, customize the code that should be "executed" in each command.


Share: twitter | facebook   Action: used | fork | flag

c#

Mark 'c#' tag as 'like'

Mark 'c#' tag as 'ignore'

commands

Mark 'commands' tag as 'like'

Mark 'commands' tag as 'ignore'

silverlight

Mark 'silverlight' tag as 'like'

Mark 'silverlight' tag as 'ignore'


 @luisabreu
248
July 13, 2010 11:07 AM

Fork

 Default command implementation for Silverlight -  @luisabreu Tuesday 13, 2010 11:07 AM


0 Feedback


You must log in before you can give any feedback


0 Discussion(s)

Newest Oldest

You must log in before you can post a comment

Squeed
Made by: Fredrik Normén 2010