public void InitCommands() {
            DependencyPropertyDescriptor descriptor = DependencyPropertyDescriptor.FromProperty(SelectedProfileProperty, typeof(ProfilesViewModel));
            descriptor.AddValueChanged(this, (obj, evarg) => {
                delete.CanExecuteDelegate(null);
                select.CanExecuteDelegate(null);
            });

            select = new SimpleCommand(canexecute => {
                return CanSelect();
            }, execute => {
                SelectProfile(SelectedProfile.token);
            });
            delete = new SimpleCommand(canexecute => {
                return CanDelete();
            }, execute => {
                DeleteProfile(SelectedProfile.token);
            });
            create = new SimpleCommand(canexecute => {
                return true;
            }, execute => {
                NewProfile(ProfileName);
            });
        }
Exemplo n.º 2
0
 void InitCommands() {
     buttonClick = new SimpleCommand(execute => {
         if(close != null)
             close();
     });
 }