Skip to content

Instantly share code, notes, and snippets.

View jfromaniello's full-sized avatar
😀
coding

José F. Romaniello jfromaniello

😀
coding
View GitHub Profile
//USAGE:
.SetResultTransformer(new DelegateTransformer<SomeNoSeQue>(m => new SomeNoSeQue((int)m[0],(string)m[1]){ Algo = m[3] });
[Serializable]
public class DelegateTransformer<TEntity> : IResultTransformer
{
private readonly Func<object[], TEntity> _transformFucntion;
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>
<log4net debug="false">
<appender name="trace"
type="log4net.Appender.TraceAppender, log4net">
<layout type="log4net.Layout.PatternLayout,log4net">
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
namespace Mantenimiento.ViewModels
{
/// <summary>
/// This class implements a disposable WaitCursor to
public void CreateNewView(Type viewModelType)
{
using(new WaitCursor()){
var viewModel = _viewModelFactory.CreateBrowseViewModel(viewModelType);
AddNewViewModel(viewModel);
}
}
public class Calculator
{
public bool CanDivide(double left, double right)
{
return right != 0;
}
[Preview("CanDivide")]
[AsyncAction(BlockInteraction = true)]
public double Divide(double left, double right)
<Button Content="Divide (Attachment w/ Defaults)"
cm:Message.Attach="Divide" />
<Button Content="Divide (Attachment w/ Default Trigger/Message and Explicit Parameters)"
cm:Message.Attach="Divide(left.Text, right.Text) : DivideResult.Text" />
<Button Content="Divide (Attachment w/ Inferred Parameters)"
cm:Message.Attach="[Event Click] = [Action Divide]" />
public class RelayCommand : ICommand
{
#region Fields
private readonly Predicate<object> _canExecute;
private readonly Action<object> _execute;
#endregion // Fields
#region Constructors
public class RelayCommand : RelayCommand<object>{
public RelayCommand(Action<object> execute) : base(execute)
{}
public RelayCommand(Action execute) : base(execute)
{}
public RelayCommand(Action execute, Func<bool> canExecute) : base(execute, canExecute)
{}
public ICommand Prueba
{
get
{
if (_prueba == null)
_prueba = new AsyncRelayCommand<object, int>(o => Proceso())
{
Preview = o => Descripcion = "procesando...",
Completed = (o, result) => Descripcion = "terminado.." + result,
BlockInteraction = true
private ICommand CreateCommand(DAOAction action)
{
if(action != DAOAction.Insert)
{
return new RelayCommand<IFormViewModel<T>>(vm =>
{
vm.Action = action;
OnRequestOpenNew(vm);
},
vm => vm != null);