示例#1
0
        public override void ViewDidLoad()
        {
            _parkingViewSource = new ParkingViewSource(this.TableView);
            base.ViewDidLoad();

            this.TableView.Source = _parkingViewSource;
            this.TableView.ReloadData();

            //Blauwe achtergrondkleur geven aan top bar
            this.NavigationController.NavigationBar.BarTintColor = UIColor.FromRGB(0, 159, 227);
            this.NavigationController.NavigationBar.Translucent  = false;

            //Kleur scheidingslijn
            this.TableView.SeparatorColor = UIColor.FromRGB(0, 159, 227);

            //Om de overige scheidingslijnen te verbergen
            this.TableView.TableFooterView = new UIView();

            //Tekstkleur in top bar ==> WIT
            UIStringAttributes textColor = new UIStringAttributes()
            {
                ForegroundColor = UIColor.White
            };

            this.NavigationController.NavigationBar.TitleTextAttributes = textColor;

            //Titel geven aan top bar
            this.Title = "Live Parking";

            MvxFluentBindingDescriptionSet <ParkingView, ParkingsViewModel> set = new MvxFluentBindingDescriptionSet <ParkingView, ParkingsViewModel>(this);

            //Lijst opvullen met Parkings
            set.Bind(_parkingViewSource).To(vm => vm.Parkings);

            //Code voor het selecteren van een rij
            set.Bind(_parkingViewSource)
            .For(scr => scr.SelectionChangedCommand)
            .To(vm => vm.ShowDetailCommand);


            //Code voor het refreshen (pull to refresh)
            var refreshControl = new MvxUIRefreshControl();

            this.RefreshControl      = refreshControl;
            refreshControl.TintColor = UIColor.FromRGB(0, 159, 227);

            set.Bind(refreshControl).For(r => r.IsRefreshing).To(vm => vm.IsBusy);
            set.Bind(refreshControl).For(r => r.RefreshCommand).To(vm => vm.ReloadCommand);


            set.Apply();
        }
示例#2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var addNewMemberButton = new UIBarButtonItem(UIBarButtonSystemItem.Add);

            var source = new MvxDeleteSimpleTableViewSource((IRemove)ViewModel, MainTableView, MemberCell.Key, MemberCell.Key);

            MainTableView.RowHeight      = 66;
            MainTableView.Source         = source;
            MainTableView.WeakDataSource = this;

            var refreshControl = new MvxUIRefreshControl {
                Message = "Loading..."
            };

            MainTableView.AddSubview(refreshControl);

            var set = this.CreateBindingSet <EventView, EventViewModel>();

            set.Bind(source).To(vm => vm.Members);
            set.Bind(source).For(s => s.SelectionChangedCommand).To(vm => vm.CheckInCommand);
            set.Bind(refreshControl).For(r => r.IsRefreshing).To(vm => vm.IsBusy);
            set.Bind(refreshControl).For(r => r.RefreshCommand).To(vm => vm.RefreshCommand);
            set.Bind(this).For("Title").To(vm => vm.EventName);
            set.Bind(ButtonPickWinner).To(vm => vm.SelectWinnerCommand);
            set.Bind(ButtonRSVPNumber).For("Title").To(vm => vm.RSVPCount);
            set.Bind(addNewMemberButton).To(vm => vm.AddNewUserCommand);
            set.Apply();

            MainTableView.ReloadData();
            var spinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray);

            spinner.Frame = new RectangleF(0, 0, 320, 66);

            MainTableView.TableFooterView = spinner;
            VM.IsBusyChanged = (busy) => {
                if (busy && VM.Members.Count > 0)
                {
                    spinner.StartAnimating();
                }
                else
                {
                    spinner.StopAnimating();
                }
            };
            NavigationItem.RightBarButtonItem = addNewMemberButton;

            //MainTableView.Source.
        }
示例#3
0
        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);
        }
示例#4
0
        public override void InitializeAllControls()
        {
            Title = Strings.TaskListLabel;

            var btAddTodoItem = new UIBarButtonItem(UIBarButtonSystemItem.Add);

            btAddTodoItem.TintColor           = UIColor.White;
            btAddTodoItem.Clicked            += AddTodoItemClicked;
            NavigationItem.RightBarButtonItem = btAddTodoItem;

            NavigationController.Toolbar.Hidden = false;

            _refreshControl = new MvxUIRefreshControl();
            tvTodoList.AddSubview(_refreshControl);
        }
        private void SetBindings()
        {
            var bindingSet = this.CreateBindingSet <WifiHotspotsViewController, WifiHotspotsViewModel> ();

            bindingSet.Bind(LoadButton)
            .To(vm => vm.LoadWifiHotspotsCommand);

            bindingSet.Bind(LoadButton)
            .For("Title")
            .To(vm => vm.LoadWifiHotspotsButtonText);
            bindingSet.Bind(FilterTextField)
            .To(vm => vm.Filter);
            bindingSet.Bind(FilterTextField)
            .For(v => v.Placeholder)
            .To(vm => vm.FilterPlaceholder);
            bindingSet.Bind(LoadMapButton)
            .To(vm => vm.LoadMapCommand);
            bindingSet.Bind(LoadMapButton)
            .For("Title")
            .To(vm => vm.LoadMapButtonText);
            bindingSet.Bind(LoadMapButton)
            .For(v => v.Enabled)
            .To(vm => vm.IsLoadMapAvailable);

            bindingSet.Bind(View)
            .For(v => v.BackgroundColor)
            .To(vm => vm.IsBusy)
            .WithConversion(new BusyToBackgroundColorConverter());
            var source = new MvxSimpleTableViewSource(WifiTableView, WifiItemViewCell.Key, WifiItemViewCell.Key);

            WifiTableView.Source    = source;
            WifiTableView.RowHeight = 100;
            bindingSet.Bind(source)
            .To(vm => vm.WifiHotspotsList);

            var refreshControl = new MvxUIRefreshControl();

            WifiTableView.RefreshControl = refreshControl;

            bindingSet.Bind(refreshControl).For(r => r.IsRefreshing).To(vm => vm.IsBusy);
            bindingSet.Bind(refreshControl).For(r => r.RefreshCommand).To(vm => vm.LoadMoreWifiHotspotsCommand);

            bindingSet.Apply();

            WifiTableView.ReloadData();
        }
        public override void ViewDidLoad()
        {
            SetupNavigationBar();

            _source = new TasksTVS(TasksTable);

            SetBind();

            base.ViewDidLoad();

            _refreshControl = new MvxUIRefreshControl();

            TasksTable.RegisterNibForCellReuse(TaskCellViewController.TaskNib, TaskCellViewController.TaskKey);

            TasksTable.Source = _source;

            TasksTable.AddSubview(_refreshControl);
        }
示例#7
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new MySource(VM, TableView,
                                      EventCell.Key, EventCell.Key);

            TableView.RowHeight = 66;
            TableView.Source    = source;

            var refreshControl = new MvxUIRefreshControl {
                Message = "Loading..."
            };

            this.RefreshControl = refreshControl;

            var set = this.CreateBindingSet <EventsView, EventsViewModel>();

            set.Bind(source).To(vm => vm.Events);
            set.Bind(refreshControl).For(r => r.IsRefreshing).To(vm => vm.IsBusy);
            set.Bind(refreshControl).For(r => r.RefreshCommand).To(vm => vm.RefreshCommand);
            set.Bind(source).For(s => s.SelectionChangedCommand).To(vm => vm.GoToEventCommand);
            set.Apply();
            var spinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray);

            spinner.Frame = new RectangleF(0, 0, 320, 66);

            TableView.TableFooterView = spinner;
            //if isn't first load show spinner when busy
            VM.IsBusyChanged = (busy) => {
                if (busy && VM.Events.Count > 0)
                {
                    spinner.StartAnimating();
                }
                else
                {
                    spinner.StopAnimating();
                }
            };
            TableView.ReloadData();
            NavigationItem.RightBarButtonItem = new UIBarButtonItem("Stats", UIBarButtonItemStyle.Plain, delegate {
                ((EventsViewModel)ViewModel).ExecuteGoToStatsCommand();
            });
        }
示例#8
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            NavigationController.NavigationBar.PrefersLargeTitles = true;

            // Create refresh control
            _refreshControl = new MvxUIRefreshControl();
            RefreshControl  = _refreshControl;

            // Create a segmented control (split between likes, and playlists)
            var segmentedControl = new SoundByteSegmentedControl(new[] { "Tracks", "Playlists", "Users", "Podcasts" });

            segmentedControl.IndexChanged += OnSegmentedControlIndexChanged;
            TableView.TableHeaderView      = segmentedControl;

            // Initial selection
            OnSegmentedControlIndexChanged(this, 0);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _refreshControl = new MvxUIRefreshControl();
            DoneTasksTableView.AddSubview(_refreshControl);

            UIDevice.Notifications.ObserveOrientationDidChange(OrientationsHandler);
            netWork_button_constraint.Constant = TabBarController.TabBar.Frame.Size.Height;

            SetUpNavigationBar();

            var source = new TasksTableViewSource(DoneTasksTableView);

            DoneTasksTableView.Source = source;
            SetUpBinding(source);

            DoneTasksTableView.ReloadData();
        }
示例#10
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new MySource(VM, TableView,
                                      GroupCell.Key, GroupCell.Key);

            TableView.RowHeight = 66;
            TableView.Source    = source;


            var refreshControl = new MvxUIRefreshControl {
                Message = "Loading..."
            };

            this.RefreshControl = refreshControl;

            var set = this.CreateBindingSet <GroupsView, GroupsViewModel>();

            set.Bind(source).To(vm => vm.Groups);
            set.Bind(refreshControl).For(r => r.IsRefreshing).To(vm => vm.IsBusy);
            set.Bind(refreshControl).For(r => r.RefreshCommand).To(vm => vm.RefreshCommand);
            set.Bind(source).For(s => s.SelectionChangedCommand).To(vm => vm.GoToGroupCommand);
            set.Apply();

            TableView.ReloadData();
            var spinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray);

            spinner.Frame = new RectangleF(0, 0, 320, 66);
            //if isn't first time show spinner when busy
            TableView.TableFooterView = spinner;
            VM.IsBusyChanged          = (busy) => {
                if (busy && VM.Groups.Count > 0)
                {
                    spinner.StartAnimating();
                }
                else
                {
                    spinner.StopAnimating();
                }
            };
        }
示例#11
0
        private void SetupTable()
        {
            _source = new GenericTableviewSourceWithHeight <IItemBase>(ItemsTable)
            {
                GetIdentifierFunc = (item, path) =>
                {
                    if (item is IEvent)
                    {
                        return(EventCell.Identifier);
                    }

                    return(HeaderImageCell.Identifier);
                },
                RowSelectionFunc = (view, path, item) =>
                {
                    if (item is IEvent)
                    {
                        ViewModel.EventSelected(item.Id);
                    }
                },
                AutoDeselect      = true,
                GetCellHeightFunc = (view, path, arg3) =>
                {
                    return(UIScreen.MainScreen.Bounds.Width * 0.5f + 2);
                },
                GetEstimatedHeightFunc = (view, path, item) =>
                {
                    return(UIScreen.MainScreen.Bounds.Width * 0.5f + 2);
                },
            };

            _refreshControl = new MvxUIRefreshControl();

            ItemsTable.AddSubview(_refreshControl);
            ItemsTable.AllowsSelection = true;
            ItemsTable.RegisterClassForCellReuse(typeof(EventCell), EventCell.Identifier);
            ItemsTable.RegisterClassForCellReuse(typeof(HeaderImageCell), HeaderImageCell.Identifier);
            ItemsTable.Source = _source;
        }
示例#12
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();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _refreshControl = new MvxUIRefreshControl();

            TasksTable.RegisterNibForCellReuse(TaskCell.Nib, TaskCell.Key);
            var source = new TasksTVS(TasksTable);

            TasksTable.Source = source;
            TasksTable.AddSubview(_refreshControl);

            var set = this.CreateBindingSet <TasksListView, TasksListViewModel>();

            set.Bind(source).To(m => m.TaskCollection);
            set.Bind(source).For(v => v.SelectionChangedCommand).To(vm => vm.ShowTaskChangedView);
            set.Bind(_refreshControl).For(r => r.IsRefreshing).To(vm => vm.IsRefreshTaskCollection);
            set.Bind(_refreshControl).For(r => r.RefreshCommand).To(vm => vm.RefreshTaskCommand);
            set.Bind(NoInternetConnection).For(v => v.Hidden).To(vm => vm.IsNoInternetVisible);

            set.Apply();
        }
示例#14
0
        private void SetupTable()
        {
            _source = new GenericTableViewSource <INotification>(ItemsTable)
            {
                GetIdentifierFunc = (item, path) => NotificationCell.Identifier,
                RowSelectionFunc  = (view, path, arg3) => ViewModel.SelectedCommand.Execute(arg3),
                AutoDeselect      = true,
                UseAnimations     = true,
                AddAnimation      = UITableViewRowAnimation.Top,
                RemoveAnimation   = UITableViewRowAnimation.Bottom,
                ReplaceAnimation  = UITableViewRowAnimation.Middle,
            };

            _refreshControl = new MvxUIRefreshControl();

            ItemsTable.RegisterClassForCellReuse(typeof(NotificationCell), NotificationCell.Identifier);
            ItemsTable.AddSubview(_refreshControl);
            ItemsTable.BackgroundColor    = Appearance.Colors.BackgroundColor;
            ItemsTable.RowHeight          = UITableView.AutomaticDimension;
            ItemsTable.EstimatedRowHeight = 44;
            ItemsTable.Source             = _source;
        }
示例#15
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();
        }
示例#16
0
        protected override void Binding()
        {
            base.Binding();

            _refresh = new MvxUIRefreshControl();

            var emptyDataSet = new EmptyDataSet(ContentView, ViewModel.RefreshCommand);
            var source       = new ContactsTableViewSource(TableView, ContactTableViewCell.Key, ContactTableViewCell.Key);

            var set = this.CreateBindingSet <ContactsView, ContactsViewModel>();

            set.Bind(emptyDataSet).For(StatesTargetBinding.Key).To(vm => vm.State);
            set.Bind(source).To(vm => vm.Items);
            set.Bind(source).For(s => s.GetContactsCommand).To(vm => vm.LoadNextPage);
            set.Bind(source).For(v => v.SelectionChangedCommand).To(vm => vm.ItemClickCommand);
            set.Bind(_refresh).For(r => r.IsRefreshing).To(vm => vm.IsRefreshing);
            set.Bind(_refresh).For(r => r.RefreshCommand).To(vm => vm.RefreshCommand);
            set.Apply();

            TableView.Source         = source;
            TableView.RefreshControl = _refresh;
            TableView.ReloadData();
        }
        public override void ViewDidLoad()
        {
            this.View = new UIView {
                BackgroundColor = UIColor.White
            };

            base.ViewDidLoad();

            var Set        = this.CreateBindingSet <ListExampleView, ListExampleViewModel> ();
            var Root       = AutoLayoutContentView.CreateRoot("Root", UIColor.DarkGray, "Helvetica-Bold");
            var ListPanel  = Root.AddContainer("ListPanel", UIColor.White);
            var OuterLabel = Root.AddLabel("OuterLabel", "The Beautiful App", UIColor.White, 12);

            Root.AddConstraint("V:|-24-[OuterLabel]-[ListPanel]-|");
            Root.AddConstraint("H:|-[OuterLabel]");
            Root.AddConstraint("H:|-4-[ListPanel]-4-|");
            var InnerLabel = ListPanel.AddLabel("InnerLabel", "Contacts List", UIColor.Black, 12);
            var DataTable  = ListPanel.AddTableView("DataTable");

            ListPanel.AddConstraint("H:|-[InnerLabel]-(>=8)-|");
            ListPanel.AddConstraint("V:|-16-[InnerLabel]-[DataTable]-|");
            ListPanel.AddConstraint("H:|-[DataTable]-|");
            var listExampleTableSource = new ListExampleTableViewSource(ViewModel, DataTable);
            var refreshControl         = new MvxUIRefreshControl();

            DataTable.AddSubview(refreshControl);
            DataTable.Source = listExampleTableSource;
            DataTable.ReloadData();

            View = Root;

            Set.Bind(listExampleTableSource).To(vm => vm.Contacts);
            Set.Bind(refreshControl).For(r => r.RefreshCommand).To(vm => vm.ReloadCommand);
            Set.Bind(refreshControl).For(r => r.IsRefreshing).To(vm => vm.IsBusy);
            Set.Apply();
        }
示例#18
0
        private void SetupTable()
        {
            // Main feed needs top offset
            //if (ViewModel.FeedId == Guid.Empty)
            //{
            //    FeedTable.ContentInset = new UIEdgeInsets(5, 0, 0, 0);
            //}

            _source = new GenericTableviewSourceWithHeight <IFeedItem>(FeedTable)
            {
                GetIdentifierFunc = (item, path) =>
                {
                    if (item is CompanyFeedItem)
                    {
                        return(CompanyFeedCell.Identifier);
                    }

                    if (item is GroupFeedItem)
                    {
                        return(GroupFeedCell.Identifier);
                    }

                    return(FeedPostCell.Identifier);
                },
                GetCellHeightFunc = (view, path, item) =>
                {
                    if (item is CompanyFeedItem)
                    {
                        return(GetCompanyCellHeight());
                    }

                    if (item is GroupFeedItem)
                    {
                        return(470);
                    }

                    return(GetPostCellHeight(item as IFeedPost));
                },
                GetEstimatedHeightFunc = (view, path, item) =>
                {
                    if (item is CompanyFeedItem)
                    {
                        return(547);
                    }

                    if (item is GroupFeedItem)
                    {
                        return(470);
                    }

                    nfloat imageHeight = 0;

                    var post = item as IFeedPost;

                    if (post != null)
                    {
                        if (post.NumberOfImages == 1)
                        {
                            // 8 spacing below image
                            imageHeight += UIScreen.MainScreen.Bounds.Width * 0.6f + 8;
                        }
                        else if (post.NumberOfImages == 2)
                        {
                            // 8 spacing below image
                            imageHeight += (UIScreen.MainScreen.Bounds.Width - 3) / 2 * 0.6f + 8;
                        }
                        else if (post.NumberOfImages > 2)
                        {
                            // 8 spacing below image
                            imageHeight += UIScreen.MainScreen.Bounds.Width * 0.6f + 8;
                            imageHeight += (UIScreen.MainScreen.Bounds.Width - 3) / 2 * 0.6f + 3;
                        }

                        var finalHeight = 133 + imageHeight;

                        if (_textHeights.ContainsKey(post.Id))
                        {
                            finalHeight += _textHeights[post.Id];
                        }

                        return(finalHeight);
                    }

                    throw new Exception("FEED ----- UNKOWN ITEM TYPE IN LIST");
                },
                ModifyCellFunc = (cell, path, item) =>
                {
                    if (item is CompanyFeedItem)
                    {
                        CalculateCompanyTextHeightCombined(item as CompanyFeedItem, cell as CompanyFeedCell);
                    }

                    var post = item as IFeedPost;

                    if (post != null)
                    {
                        SetCellText(post, cell);

                        var postCell = cell as FeedPostCell;

                        if (postCell != null)
                        {
                            if (post.NumberOfImages == 1)
                            {
                                postCell.SetMainImageVisible();
                            }
                            else if (post.NumberOfImages == 2)
                            {
                                postCell.SetSubImagesVisible();
                            }
                            else if (post.NumberOfImages > 2)
                            {
                                postCell.SetAllImagesVisible();
                            }
                            else
                            {
                                postCell.SetNoImagesVisible();
                            }

                            postCell.SetInformationVisible(post.Title != null);
                        }
                    }
                },
                AutoDeselect = true,
            };

            _refreshControl = new MvxUIRefreshControl();

            FeedTable.RegisterClassForCellReuse(typeof(CompanyFeedCell), CompanyFeedCell.Identifier);
            FeedTable.RegisterClassForCellReuse(typeof(GroupFeedCell), GroupFeedCell.Identifier);
            FeedTable.RegisterClassForCellReuse(typeof(FeedPostCell), FeedPostCell.Identifier);
            //_bottomActivityIndicatorView = new MvxUiRefreshControl
            //{
            //    Frame = new CGRect(0, 0, 320, 66)
            //};
            //FeedTable.TableFooterView = _bottomActivityIndicatorView;
            FeedTable.Source = _source;

            FeedTable.AddSubview(_refreshControl);
            FeedTable.ReloadData();
        }
示例#19
0
        private void SetupTable()
        {
            _membersSource = new GenericTableviewSourceWithHeight <IItemBase>(ItemsTable)
            {
                GetIdentifierFunc = (item, path) =>
                {
                    if (item is MemberSearchItem)
                    {
                        return(MembersSearchCell.Identifier);
                    }

                    if (item is MembersButtonItem)
                    {
                        return(MembersButtonCell.Identifier);
                    }

                    if (item is ICompany)
                    {
                        return(MembersCompanyCell.Identifier);
                    }

                    return(MemberCell.Identifier);
                },
                RowSelectionFunc = (view, path, baseItem) =>
                {
                    ViewModel.MemberSelected(baseItem);
                },
                GetCellHeightFunc = (view, path, item) =>
                {
                    if (item is MembersButtonItem)
                    {
                        Debug.WriteLine("BUTTON ITEM AT ROW : {0}", path.Row);
                    }

                    if (item is IUser || item is ICompany)
                    {
                        return(68);
                    }

                    return(62);
                },
                GetEstimatedHeightFunc = (view, path, item) =>
                {
                    if (item is IUser || item is ICompany)
                    {
                        return(68);
                    }

                    return(62);
                },
                //ViewToMove = SearchContainer,
                //ConstraintToChange = SearchContainerTopConstraint,
                UseAnimations    = true,
                AddAnimation     = UITableViewRowAnimation.Left,
                RemoveAnimation  = UITableViewRowAnimation.Right,
                ReplaceAnimation = UITableViewRowAnimation.Middle,
                AutoDeselect     = true,
            };

            ItemsTable.BackgroundColor = Appearance.Colors.BackgroundColor;
            ItemsTable.RegisterClassForCellReuse(typeof(MembersCompanyCell), MembersCompanyCell.Identifier);
            ItemsTable.RegisterClassForCellReuse(typeof(MembersButtonCell), MembersButtonCell.Identifier);
            ItemsTable.RegisterClassForCellReuse(typeof(MembersSearchCell), MembersSearchCell.Identifier);
            ItemsTable.RegisterClassForCellReuse(typeof(MemberCell), MemberCell.Identifier);
            ItemsTable.Source = _membersSource;

            _refreshControl = new MvxUIRefreshControl();
            ItemsTable.AddSubviews(_refreshControl);
        }
示例#20
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";
        }
        private void SetupTable()
        {
            _source = new GenericTableviewSourceWithHeight <IItemBase>(ItemsTable)
            {
                GetIdentifierFunc = (item, path) =>
                {
                    if (item is HeaderImage)
                    {
                        return(HeaderImageCell.Identifier);
                    }

                    if (item is Event)
                    {
                        return(EventCell.Identifier);
                    }

                    if (item is EventCategoryDouble)
                    {
                        return(EventCategoryDoubleCell.Identifier);
                    }

                    if (item is IEventCategory)
                    {
                        return(EventCategoryCell.Identifier);
                    }

                    return(AllEventsCell.Identifier);
                },
                GetCellHeightFunc = (view, path, item) =>
                {
                    return(GetCellHeight(item));
                },
                GetEstimatedHeightFunc = (view, path, item) =>
                {
                    return(GetCellHeight(item));
                }
                // TODO: Vanwege de double image header cell kan row selectie niet want we weten niet op welke plaats er is getapped in de cell, later verbeteren met tap gestures  : http://stackoverflow.com/questions/11070874/how-can-i-distinguish-which-part-of-uitableviewcell-has-been-clicked
                //RowSelectionFunc = (view, path, item) =>
                //{
                //    if (item is DoubleHeaderImage)
                //    {
                //        ViewModel.CategorySelected();

                //    }

                //    ViewModel.CategorySelected(item.Id);
                //    ItemsTable.DeselectRow(path, true);
                //}
            };

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

            _refreshControl = new MvxUIRefreshControl();
            ItemsTable.AddSubview(_refreshControl);

            ItemsTable.ContentInset    = new UIEdgeInsets(0, 0, 5, 0);
            ItemsTable.BackgroundColor = Appearance.Colors.BackgroundColor;
            // The image header is only shown when there is only 1 category in the platform
            ItemsTable.RegisterClassForCellReuse(typeof(HeaderImageCell), HeaderImageCell.Identifier);
            ItemsTable.RegisterClassForCellReuse(typeof(EventCell), EventCell.Identifier);
            ItemsTable.RegisterClassForCellReuse(typeof(EventCategoryCell), EventCategoryCell.Identifier);
            ItemsTable.RegisterClassForCellReuse(typeof(AllEventsCell), AllEventsCell.Identifier);
            ItemsTable.RegisterClassForCellReuse(typeof(EventCategoryDoubleCell), EventCategoryDoubleCell.Identifier);
            ItemsTable.Source = _source;
        }
示例#22
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Title = "Measures";

            EdgesForExtendedLayout = UIRectEdge.None;

            View.BackgroundColor = UIColor.Clear;

            _refreshControl = new MvxUIRefreshControl();

            _tableView = new UITableView
            {
                RowHeight      = 60,
                SeparatorStyle = UITableViewCellSeparatorStyle.SingleLine
            };

            _source           = new MeasureTableViewSource(_tableView);
            _tableView.Source = _source;

            View.AddSubview(_tableView);
            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                _tableView.AtLeftOf(View),
                _tableView.AtTopOf(View),
                _tableView.AtBottomOf(View),
                _tableView.AtRightOf(View));

            View.BringSubviewToFront(_tableView);

            var bindingSet = this.CreateBindingSet <MeasuresView, MeasuresViewModel>();

            bindingSet
            .Bind(NavigationItem.RightBarButtonItem)
            .To(v => v.AddCommand);

            bindingSet
            .Bind(_refreshControl)
            .For(r => r.IsRefreshing)
            .To(vm => vm.LoadTask.IsNotCompleted)
            .WithFallback(false);

            bindingSet
            .Bind(_source)
            .For(v => v.ItemsSource)
            .To(vm => vm.Measures);

            bindingSet
            .Bind(_source)
            .For(v => v.SelectionChangedCommand)
            .To(vm => vm.SelectedCommand);

            bindingSet.Bind(_source)
            .For(v => v.DeleteItemCommand)
            .To(vm => vm.DeleteCommand);

            bindingSet
            .Bind(this)
            .For(v => v.Title)
            .To(v => v.Date)
            .WithConversion(
                new DateFormatterMvxValueConverter(
                    new NSDateFormatter
            {
                TimeStyle  = NSDateFormatterStyle.None,
                DateFormat = "MMMM yyyy"
            }));

            bindingSet.Apply();
        }
示例#23
0
 public DiscoverView(IntPtr handle) : base(handle)
 {
     mvxUIRefreshControl = new MvxUIRefreshControl();
 }