public PaymentViewModel() { Service = new PaymentService(); Payment p = new Payment(); this.Name = Cell.Create(p.name); this.Date = Cell.Create(p.date); this.Category = Cell.Create(p.category); this.Amount = Cell.Create(p.amount.ToString()); this.NameError = Cell.Derived(Name, ValidateName); this.DateError = Cell.Derived(Date, ValidateDate); this.CategoryError = Cell.Derived(Category, ValidateCategory); this.AmountError = Cell.Derived(Amount, ValidateAmount); this.ImageUri = Cell.Create(new Uri("http://cdn.entropiaplanets.com/w/images/4/4b/Replace-me.png")); this.ImageVisible = Cell.Create(true); this.LoadingVisible = Cell.Derived(ImageVisible, i => !i); Category.ValueChanged += PlayCategorySound; Name.ValueChanged += () => { Namechanged = true; }; MakeImageRequest(); var enabled = Cell.Derived(new List <Cell <string> > { NameError, DateError, CategoryError, AmountError }, cs => cs.All(c => c == "")); this.AddPaymentCommand = new AddPaymentCommand(this, enabled); player = CrossSimpleAudioPlayer.Current; }
public RegisterViewModel() { _apiServices = new ApiServices(); this.Email = Cell.Create("*****@*****.**"); this.Password = Cell.Create("testt"); // this.ConfirmPassword = Cell.Create("testt"); this.EmailError = Cell.Derived(Email, validateEmail); this.PasswordError = Cell.Derived(Password, validatePassword); // this.ConfirmPassword = Cell.Derived(Password, validateConfirmPassword); var enabled = Cell.Derived(new List <Cell <string> > { EmailError, PasswordError }, cs => cs.All(c => c == "")); this.RegisterCommand = new RegisterCommand(this, enabled); this.IsBusy = Cell.Create(false); }
public static Cell <bool> Or(this Cell <bool> left, Cell <bool> right) { return(Cell.Derived(left, right, (x, y) => x || y)); }
public static Cell <R> Map <T, R>(this Cell <T> cell, Func <T, R> func) { return(Cell.Derived(cell, func)); }
public static ICell <TResult> Derive <T, TResult>(this ICell <T> cell, Func <T, TResult> func) { return(Cell.Derived(cell, func)); }