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;
        }
Пример #2
0
        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);
        }
Пример #3
0
 public RegisterCommand(RegisterViewModel rvm, Cell <bool> isEnabled) : base(isEnabled)
 {
     this.rvm = rvm;
 }
Пример #4
0
 public LoginViewModel()
 {
     this.IsBusy = Cell.Create(false);
 }