예제 #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();
                    });
                }
            });
        }
예제 #2
0
 public void NewTransaction(HomeItemViewModel item)
 {
     ScreenCoordinator.NavigateToCustomer(item.Customer);
 }
예제 #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();
                            });
                    }
                });
        }
예제 #4
0
 public void NewTransaction(HomeItemViewModel item)
 {
     ScreenCoordinator.NavigateToCustomer(item.Customer);
 }