Exemplo n.º 1
0
        protected override void OnInitialize()
        {
            base.OnInitialize();

            IsLoading = true;

            Task.Factory.StartNew(() =>
            {
                Items.Add("ACCOUNT");
                Items.Add("VISITOR");

                var customers = CustomerService.GetCustomers().Where(o => !o.Name.IsMatch("Cash"));

                var previousGroup = "";
                foreach (var customer in customers)
                {
                    var item = new HomeItemViewModel {
                        Customer = customer
                    };

                    if (item.Group != previousGroup)
                    {
                        item.IsFirstInGroup = true;
                        previousGroup       = item.Group;
                    }

                    Accounts.Add(item);
                }

                Visitors.AddRange(CustomerService.GetCustomers().Where(o => o.Name.IsMatch("Cash")).Select(o => new HomeItemViewModel {
                    Customer = o
                }));
            })
            .ContinueWith(task =>
            {
                if (task.IsFaulted)
                {
                    ScreenCoordinator.HandleFault(task.Exception);
                }
                else
                {
                    Execute.OnUIThread(() =>
                    {
                        IsLoading    = false;
                        SelectedItem = Items.First();
                    });
                }
            });
        }
Exemplo n.º 2
0
 public void NewTransaction(HomeItemViewModel item)
 {
     ScreenCoordinator.NavigateToCustomer(item.Customer);
 }
Exemplo n.º 3
0
        protected override void OnInitialize()
        {
            base.OnInitialize();

            IsLoading = true;

            Task.Factory.StartNew(() =>
                {
                    Items.Add("ACCOUNT");
                    Items.Add("VISITOR");

                    var customers = CustomerService.GetCustomers().Where(o => !o.Name.IsMatch("Cash"));

                    var previousGroup = "";
                    foreach (var customer in customers)
                    {
                        var item = new HomeItemViewModel { Customer = customer };

                        if (item.Group != previousGroup)
                        {
                            item.IsFirstInGroup = true;
                            previousGroup = item.Group;
                        }

                        Accounts.Add(item);
                    }

                    Visitors.AddRange(CustomerService.GetCustomers().Where(o => o.Name.IsMatch("Cash")).Select(o => new HomeItemViewModel { Customer = o }));
                })
            .ContinueWith(task =>
                {
                    if (task.IsFaulted)
                    {
                        ScreenCoordinator.HandleFault(task.Exception);
                    }
                    else
                    {
                        Execute.OnUIThread(() =>
                            {
                                IsLoading = false;
                                SelectedItem = Items.First();
                            });
                    }
                });
        }
Exemplo n.º 4
0
 public void NewTransaction(HomeItemViewModel item)
 {
     ScreenCoordinator.NavigateToCustomer(item.Customer);
 }