コード例 #1
0
        private void SetupTable()
        {
            _refreshControl = new MvxUIRefreshControl();
            var tableViewSource = new GenericTableviewSourceWithHeight <AccessControlItemViewModel>(TableView)
            {
                GetIdentifierFunc = (model, path) => LockItemView.Identifier,
                ModifyCellFunc    = (cell, path, item) =>
                {
                    var lockItemView = cell as LockItemView;
                    lockItemView?.SetupStyle();
                },
                GetCellHeightFunc      = (view, path, item) => 150,
                GetEstimatedHeightFunc = (view, path, item) => 150,
            };

            var set = this.CreateBindingSet <AccessControlView, AccessControlViewModel>();

            set.Bind(tableViewSource).To(vm => vm.Items);
            set.Bind(_refreshControl).For(r => r.RefreshCommand).To(vm => vm.RefreshCommand);
            set.Bind(_refreshControl).For(r => r.IsRefreshing).To(vm => vm.IsRefreshing);
            set.Apply();

            TableView.RefreshControl  = _refreshControl;
            TableView.AllowsSelection = false;
            TableView.BackgroundColor = Appearance.Colors.BackgroundColor;
            TableView.SeparatorStyle  = UITableViewCellSeparatorStyle.None;
            TableView.RegisterNibForCellReuse(UINib.FromName("LockItemView", NSBundle.MainBundle), LockItemView.Identifier);
            TableView.Source = tableViewSource;
            TableView.ReloadData();
        }
コード例 #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var timePickerTableViewSource = new GenericTableviewSourceWithHeight <TimePickerItemViewModel>(tvTimePicker)
            {
                GetIdentifierFunc = (model, path) => TimePickerItemView.Identifier,
                GetCellHeightFunc = (view, path, item) => 80,
                ModifyCellFunc    = (cell, path, item) =>
                {
                    var timePickerCell = cell as TimePickerItemView;
                    timePickerCell?.InitStyle();
                },
                AutoDeselect     = true,
                RowSelectionFunc = (view, path, item) =>
                {
                    ViewModel.SelectItem(path.Row);
                }
            };

            tvTimePicker.Source = timePickerTableViewSource;
            tvTimePicker.ReloadData();

            var set = this.CreateBindingSet <TimePickerView, TimePickerViewModel>();

            set.Bind(timePickerTableViewSource).For(t => t.ItemsSource).To(vm => vm.TimeList);
            set.Bind(btnBack).To(vm => vm.BackBtnClickedCommand);
            set.Bind(btnClose).To(vm => vm.CloseBtnClickedCommand);
            set.Bind(btnBook).To(vm => vm.BookBtnClickedCommand);
            set.Apply();


            InitStyle();
        }
コード例 #3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //Set Header Slider
            var roomSource = new GenericTableviewSourceWithHeight <RoomIndexItemViewModel>(tvRoom)
            {
                GetCellHeightFunc      = (view, path, item) => 225,
                GetEstimatedHeightFunc = (view, path, item) => 225,
                GetIdentifierFunc      = (model, path) => RoomIndexItemView.Identifier,
                ModifyCellFunc         = (cell, path, item) =>
                {
                    var roomIndexItemView = cell as RoomIndexItemView;
                    roomIndexItemView?.InitStyle();
                },
                AutoDeselect     = true,
                RowSelectionFunc = (view, path, item) =>
                {
                    item.BookRoomCommand.Execute(null);
                }
            };

            var refreshControl = new MvxUIRefreshControl();

            // Selection off
            tvRoom.AllowsSelection = false;
            tvRoom.RefreshControl  = refreshControl;
            tvRoom.RegisterNibForCellReuse(UINib.FromName("RoomIndexItemView", null), RoomIndexItemView.Identifier);
            tvRoom.Delegate = new UITableViewDelegate();
            tvRoom.Source   = roomSource;

            // Add Post button
            var roomTimeIndexButton = new UIBarButtonItem
            {
                Title = "Overview",
            };

            var icoFontAttribute = new UITextAttributes {
                Font = Appearance.Fonts.LatoBoldWithSize(24), TextColor = Appearance.Colors.BisnerBlue
            };

            roomTimeIndexButton.SetTitleTextAttributes(icoFontAttribute, UIControlState.Application);
            roomTimeIndexButton.Style = UIBarButtonItemStyle.Done;

            NavigationItem.SetRightBarButtonItems(new[] { roomTimeIndexButton }, true);

            InitStyle();

            var bindingSet = this.CreateBindingSet <RoomIndexView, RoomIndexViewModel>();

            bindingSet.Bind(roomSource).For(s => s.ItemsSource).To(vm => vm.RoomList);
            bindingSet.Bind(roomTimeIndexButton).To(vm => vm.OverViewCommand);
            bindingSet.Bind(refreshControl).For(r => r.IsRefreshing).To(vm => vm.IsRefreshing);
            bindingSet.Bind(refreshControl).For(r => r.RefreshCommand).To(vm => vm.RefreshCommand);
            bindingSet.Apply();
        }
コード例 #4
0
        private void SetupTable()
        {
            _source = new GenericTableviewSourceWithHeight <IGroup>(ItemsTable)
            {
                GetIdentifierFunc = (group, path) => GroupCell.Identifier,
                ModifyCellFunc    = (cell, path, group) =>
                {
                    var groupCell = cell as GroupCell;

                    if (groupCell != null)
                    {
                        // Only 1 section
                        groupCell.SetIsFirstCell(true);
                        groupCell.GroupDescription.AttributedText = GetText(group.Id, group.Description);
                    }
                },
                GetCellHeightFunc = (view, path, group) => 220,
                //{
                //    if (path.Row == 0)
                //    {
                //        return 220;
                //    }

                //    return 180;
                //},
                GetEstimatedHeightFunc = (view, path, group) => 220,
                //{
                //    if (path.Row == 0)
                //    {
                //        return 220;
                //    }

                //    return 180;
                //},
                UseAnimations = false,
            };

            _refreshControl = new MvxUIRefreshControl();

            ItemsTable.DelaysContentTouches = false;

            foreach (var subview in ItemsTable.Subviews)
            {
                if (subview is UIScrollView)
                {
                    ((UIScrollView)subview).DelaysContentTouches = false;
                }
            }

            ItemsTable.BackgroundColor = Appearance.Colors.BackgroundColor;
            ItemsTable.AddSubviews(_refreshControl);
            ItemsTable.SeparatorStyle = UITableViewCellSeparatorStyle.None;
            ItemsTable.RegisterClassForCellReuse(typeof(GroupCell), GroupCell.Identifier);
            ItemsTable.AllowsSelection = false;
            ItemsTable.Source          = _source;
        }
コード例 #5
0
        private void SetupTable()
        {
            _source = new GenericTableviewSourceWithHeight <IItemBase>(ItemTable)
            {
                GetIdentifierFunc = (item, path) =>
                {
                    if (item is IFeedPost)
                    {
                        return(FeedPostCell.Identifier);
                    }

                    return(CommentCell.Identifier);
                },
                ModifyCellFunc = (cell, path, item) =>
                {
                    ModifyPostCell(item, cell);

                    ModifyCommentCell(cell, item, path);
                },
                GetCellHeightFunc = (view, path, item) =>
                {
                    if (item is IFeedPost)
                    {
                        return(GetFeedPostHeight(item as IFeedPost));
                    }

                    return(GetCommentCellHeight(item as IComment));
                },
                GetEstimatedHeightFunc = (view, path, item) =>
                {
                    if (item is IFeedPost)
                    {
                        return(GetFeedPostHeight(item as IFeedPost));
                    }

                    return(GetCommentCellHeight(item as IComment));
                },
                AutoDeselect  = true,
                UseAnimations = true,
                AddAnimation  = UITableViewRowAnimation.Top,
            };

            ItemTable.RegisterClassForCellReuse(typeof(FeedPostCell), FeedPostCell.Identifier);

            ItemTable.AllowsSelection = false;
            ItemTable.BackgroundColor = Colors.BackgroundColor;
            ItemTable.ContentInset    = new UIEdgeInsets(5, 0, 0, 0);
            ItemTable.Source          = _source;
        }
コード例 #6
0
ファイル: ChatView.cs プロジェクト: divine514/BisnerXamarin
        private void SetupTable()
        {
            _source = new GenericTableviewSourceWithHeight <ConversationListViewModel>(ConversationTable)
            {
                GetIdentifierFunc = (model, path) => ChatCell.Identifier,
                RowSelectionFunc  = (view, path, item) => ViewModel.ConversationSelected(item),
                ModifyCellFunc    = (cell, indexPath, item) =>
                {
                    var chatCell = cell as ChatCell;

                    if (chatCell != null)
                    {
                        chatCell.SetRulerFullWidth(indexPath.Row == 0);

                        if (indexPath.Section + 1 == ConversationTable.NumberOfSections() &&
                            ConversationTable.NumberOfRowsInSection(indexPath.Section) == indexPath.Row + 1)
                        {
                            // Show bottom border on last cell
                            chatCell.SetBottomRulerVisible(true);
                        }
                        else
                        {
                            chatCell.SetBottomRulerVisible(false);
                        }
                    }
                },
                GetCellHeightFunc = (view, path, item) =>
                {
                    return(73);
                },
                GetEstimatedHeightFunc = (view, path, item) =>
                {
                    return(73);
                },
                AutoDeselect     = true,
                UseAnimations    = true,
                AddAnimation     = UITableViewRowAnimation.Top,
                RemoveAnimation  = UITableViewRowAnimation.Bottom,
                ReplaceAnimation = UITableViewRowAnimation.Middle,
            };

            ConversationTable.Source = _source;

            ConversationTable.ContentInset = new UIEdgeInsets(5, 0, 0, 0);

            _refreshControl = new MvxUIRefreshControl();

            ConversationTable.AddSubviews(_refreshControl);
        }
コード例 #7
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //Set Header Slider
            var bookingsSource = new GenericTableviewSourceWithHeight <BookingsItemViewModel>(tvBookings)
            {
                GetCellHeightFunc = (view, path, item) => 120,
                GetIdentifierFunc = (model, path) => BookingsItemView.Identifier,
                AutoDeselect      = true,
                ModifyCellFunc    = (cell, path, item) =>
                {
                    var bookinsItemView = cell as BookingsItemView;
                    bookinsItemView?.InitStyle();
                },
                GetEstimatedHeightFunc = (view, path, item) => 120,
            };

            var refreshControl = new MvxUIRefreshControl();

            tvBookings.RefreshControl = refreshControl;

            var bindingSet = this.CreateBindingSet <JobboardView, JobboardViewModel>();

            bindingSet.Bind(bookingsSource).For(s => s.ItemsSource).To(vm => vm.BookingsList);
            bindingSet.Bind(bookingsSource).For(s => s.SelectionChangedCommand).To(vm => vm.ItemSelectedCommand);
            bindingSet.Bind(btnBookingNew).To(vm => vm.BookingCommand);
            bindingSet.Bind(btnBookingNew).For("Title").To(vm => vm.BookingButtonTitle);
            bindingSet.Bind(refreshControl).For(r => r.IsRefreshing).To(vm => vm.IsRefreshing);
            bindingSet.Bind(refreshControl).For(r => r.RefreshCommand).To(vm => vm.RefreshCommand);
            bindingSet.Apply();

            tvBookings.RegisterNibForCellReuse(UINib.FromName("BookingsItemView", null), BookingsItemView.Identifier);
            tvBookings.Delegate = new UITableViewDelegate();
            tvBookings.Source   = bookingsSource;
            tvBookings.ReloadData();

            InitStyle();
        }
コード例 #8
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //Set Header Slider
            var roomTimeIndexSource = new GenericTableviewSourceWithHeight <RoomTimeIndexItemViewModel>(tvRoomTimeIndex)
            {
                GetIdentifierFunc = (model, path) => RoomTimeIndexItemView.Identifier,
                GetCellHeightFunc = (view, path, item) => 270,
                ModifyCellFunc    = (cell, path, item) =>
                {
                    var roomTimeIndexItemView = cell as RoomTimeIndexItemView;
                    roomTimeIndexItemView?.InitStyle();
                }
            };

            var refreshControl = new MvxUIRefreshControl();

            tvRoomTimeIndex.RefreshControl = refreshControl;
            tvRoomTimeIndex.RegisterNibForCellReuse(UINib.FromName("RoomTimeIndexItemView", null), RoomTimeIndexItemView.Identifier);
            tvRoomTimeIndex.Delegate = new UITableViewDelegate();
            tvRoomTimeIndex.Source   = roomTimeIndexSource;
            tvRoomTimeIndex.ReloadData();

            var button = new UIBarButtonItem(UIImage.FromBundle("Icons/icon_calendar.png").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal), UIBarButtonItemStyle.Plain, null, null);

            NavigationItem.SetRightBarButtonItem(button, true);

            var bindingSet = this.CreateBindingSet <RoomTimeIndexView, RoomTimeIndexViewModel>();

            bindingSet.Bind(roomTimeIndexSource).For(b => b.ItemsSource).To(vm => vm.RoomTimeIndexList);
            bindingSet.Bind(refreshControl).For(r => r.IsRefreshing).To(vm => vm.IsRefreshing);
            bindingSet.Bind(refreshControl).For(r => r.RefreshCommand).To(vm => vm.RefreshCommand);
            bindingSet.Bind(button).To(vm => vm.ChangeDateCommand);
            bindingSet.Apply();

            InitStyle();
        }
コード例 #9
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            scvMain.Delegate        = this;
            txfSearch.ShouldReturn += (textField) =>
            {
                textField.ResignFirstResponder();
                return(true);
            };

            // Set refresh control
            var refreshControl = new MvxUIRefreshControl();

            scvMain.AddSubview(refreshControl);

            //Set Header Slider
            var headerSliderSource = new HeaderSliderCollectionViewSource(this.clvHeaderSlider);

            clvHeaderSlider.SetCollectionViewLayout(new LineLayoutForHaderSlider(), true);
            clvHeaderSlider.Delegate = new UICollectionViewDelegateFlowLayout();
            clvHeaderSlider.Source   = headerSliderSource;
            clvHeaderSlider.ReloadData();

            //Set body slider (carousel)
            var bodySliderSource = new BodySliderCollectionViewSource(clvBodySlider);

            clvBodySlider.SetCollectionViewLayout(new LineLayoutForBodySlider(), true);
            clvBodySlider.Delegate = new UICollectionViewDelegateFlowLayout();
            clvBodySlider.Source   = bodySliderSource;
            clvBodySlider.ReloadData();

            var routerTableViewSource = new GenericTableviewSourceWithHeight <CommonItemViewModel>(tvRouter)
            {
                GetIdentifierFunc = (model, path) => CommonItemView.Identifier,
                RowSelectionFunc  = (view, path, arg3) =>
                {
                    ViewModel.SelectItem(arg3);
                },
                GetCellHeightFunc      = (view, path, item) => 50,
                GetEstimatedHeightFunc = (view, path, item) => 50,
                AutoDeselect           = true
            };

            tvRouter.RegisterNibForCellReuse(UINib.FromName("CommonItemView", null), CommonItemView.Identifier);
            tvRouter.Source = routerTableViewSource;
            tvRouter.ReloadData();

            InitStyle();

            var bindingSet = this.CreateBindingSet <DashboardView, DashboardViewModel>();

            bindingSet.Bind(bodySliderSource).For(t => t.ItemsSource).To(vm => vm.BodySliderList);
            bindingSet.Bind(headerSliderSource).For(t => t.ItemsSource).To(vm => vm.HeaderSliderList);
            bindingSet.Bind(routerTableViewSource).For(t => t.ItemsSource).To(vm => vm.RouterItems);
            bindingSet.Bind(btnShowMember).To(vm => vm.ShowMembersCommand);
            bindingSet.Bind(refreshControl).For(r => r.IsRefreshing).To(vm => vm.IsRefreshing);
            bindingSet.Bind(refreshControl).For(r => r.RefreshCommand).To(vm => vm.RefreshCommand);
            bindingSet.Apply();

            // Set screen name for analytics
            ScreenName = "DashboardView";
        }