示例#1
0
        public GroupsView()
        {
            InitializeComponent();
            BindingContext = viewModel = new GroupsViewModel(this);
            managerMode = Settings.OrganizerMode;

            ToolbarItems.Add(new ToolbarItem
                {
                    StyleId="Settings",
                    Icon = "ic_action_settings.png",
                    Text = "Settings",
                    Order = ToolbarItemOrder.Primary,
                    Command = viewModel.GoToAboutCommand
                });
            
            GroupsList.ItemSelected += (sender, e) => 
                {
                    var selected = GroupsList.SelectedItem as Group;
                    if(selected == null)
                        return;

                    viewModel.GoToGroupCommand.Execute(selected);
                    GroupsList.SelectedItem = null;
                };

            GroupsList.ItemAppearing += (sender, e) => 
                { 
                    if(viewModel.IsBusy || viewModel.Groups.Count == 0) 
                        return; 
                    //hit bottom! 
                    if(((Group)e.Item).Id == viewModel.Groups[viewModel.Groups.Count - 1].Id) 
                    { 
                        viewModel.LoadMoreCommand.Execute(null); 
                    } 
                }; 

            //ensure after first load that we scroll to the top.
            /*viewModel.FinishedFirstLoad = (index) =>
                {
                    if(viewModel.Groups.Count == 0)   
                        return;

                    Device.StartTimer(TimeSpan.FromMilliseconds(100), ()=>
                        {
                            Device.BeginInvokeOnMainThread(() =>
                                GroupsList.ScrollTo(viewModel.Groups[index], ScrollToPosition.MakeVisible, false));

                            return false;
                        });
                };*/
        }
示例#2
0
 public MySource(GroupsViewModel vm, UITableView tableView, NSString key, NSString cellId)
     : base(tableView, key, cellId)
 {
     this.vm = vm;
 }