private async void PopulateContacts() { var vm = (MainViewModel)this.BindingContext; await vm.HydrateContactsMainViewModel(); this.Contacts.HasUnevenRows = true; this.Contacts.ItemsSource = vm.Contacts; this.Contacts.WidthRequest = ((Page)this).Width * 7 / 8; this.Contacts.HeightRequest = ((Page)this).Height * 2 / 3; this.ContactsBG.WidthRequest = ((Page)this).Width * 7 / 8; this.ContactsBG.HeightRequest = ((Page)this).Height * 10 / 25; this.Contacts.HorizontalOptions = LayoutOptions.Center; this.Contacts.ItemTapped += (s, e) => Navigation.PushModalAsync( new ContactDetailView { ContactDetailsVm = new ContactDetailsViewModel( ((ListView) s).SelectedItem as Contact) }, false); this.Contacts.ItemTemplate = new DataTemplate(() => { var what = new ImageCell(); what.SetBinding(ImageCell.TextProperty, "Name"); what.SetBinding(ImageCell.ImageSourceProperty, "PicUrl"); what.SetBinding(ImageCell.DetailProperty, "Phone"); vm.IsBusy = false; return what; }); }
public MasterPage() { var masterPageItems = new List<MasterPageItem> (); masterPageItems.Add (new MasterPageItem { Title = "Profil", //IconSource = "contacts.png", TargetType = typeof(ProfilPage) }); masterPageItems.Add (new MasterPageItem { Title = "Actualités", //IconSource = "Actualite.png", TargetType = typeof(ActualitePage) }); masterPageItems.Add (new MasterPageItem { Title = "Calendrier", //IconSource = "contacts.png", TargetType = typeof(CalendrierPage) }); masterPageItems.Add (new MasterPageItem { Title = "Maps", //IconSource = "reminders.png", TargetType = typeof(MapPage) }); masterPageItems.Add (new MasterPageItem { Title = "Messagerie", //IconSource = "todo.png", TargetType = typeof(DefaultPage) }); masterPageItems.Add (new MasterPageItem { Title = "Deconnexion", //IconSource = "todo.png", TargetType = typeof(DeconnexionPage) }); listView = new ListView { ItemsSource = masterPageItems, ItemTemplate = new DataTemplate (() => { var imageCell = new ImageCell (); imageCell.SetBinding (TextCell.TextProperty, "Title"); imageCell.SetBinding (ImageCell.ImageSourceProperty, "IconSource"); return imageCell; }), VerticalOptions = LayoutOptions.FillAndExpand }; Padding = new Thickness (0, 40, 0, 0); //Icon = "hamburger.png"; Title = "Menu"; Content = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand, Children = { listView } }; }
public ActiveChatsPage(ViewModelBase viewModel) : base(viewModel) { var listView = new BindableListView { ItemTemplate = new DataTemplate(() => { var imageCell = new ImageCell(); imageCell.SetBinding(ImageCell.TextProperty, new Binding("Name")); imageCell.SetBinding(ImageCell.DetailProperty, new Binding("DescriptionText")); imageCell.SetBinding(ImageCell.ImageSourceProperty, new Binding("Image")); imageCell.TextColor = Styling.CellTitleColor; imageCell.DetailColor = Styling.CellDetailColor; return imageCell; }), SeparatorVisibility = SeparatorVisibility.None }; listView.SetBinding(ListView.ItemsSourceProperty, new Binding("ActiveChats")); listView.SetBinding(BindableListView.ItemClickedCommandProperty, new Binding("SelectActiveChatCommand")); listView.SetBinding(ListView.IsVisibleProperty, new Binding("HasConversations", BindingMode.OneWay)); var noItemsLabel = new Label { Text = "Start a conversation or open a room!", HorizontalOptions = LayoutOptions.Center, FontSize = 16, TextColor = Color.Gray }; var noItemsLayout = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { new BoxView{HeightRequest = 20}, noItemsLabel } }; noItemsLayout.SetBinding(StackLayout.IsVisibleProperty, new Binding("HasConversations", BindingMode.OneWay, converter: new InverterConverter())); var loadingIndicator = new ActivityIndicator (); loadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy")); loadingIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy")); Content = new StackLayout { Children = { loadingIndicator, listView, noItemsLayout } }; }
public HistoryListView() { Description = ""; CodeIndex = 0; ItemTemplate = new DataTemplate (() => { var cell = new ImageCell (); cell.ImageSource = ImageSource.FromFile ("upload.png"); cell.SetBinding (TextCell.TextProperty, "Header"); cell.SetBinding (TextCell.DetailProperty, "Description"); return cell; }); }
public OnlineUsersPage(ViewModelBase viewModel) : base(viewModel) { var usersCountLabel = new SquawkLabel () { }; usersCountLabel.SetBinding(Label.TextProperty, new Binding("Users.Count", stringFormat: " {0} users online")); var filterEntry = new SquawkEntry () { Placeholder = "Filter...", }; filterEntry.SetBinding (Entry.TextProperty, new Binding ("FilterText")); var listView = new BindableListView { ItemTemplate = new DataTemplate(() => { var imageCell = new ImageCell { ImageSource = Styling.ContactIcon }; imageCell.SetBinding(TextCell.TextProperty, new Binding("Name")); imageCell.SetBinding(TextCell.DetailProperty, new Binding("Description")); imageCell.TextColor = Styling.CellTitleColor; imageCell.DetailColor = Styling.CellDetailColor; return imageCell; }) }; listView.SetBinding(ListView.ItemsSourceProperty, new Binding("UsersDisplay")); listView.SetBinding(BindableListView.ItemClickedCommandProperty, new Binding("SelectUserCommand")); var loadingIndicator = new ActivityIndicator (); loadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy")); loadingIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy")); Content = new StackLayout { Children = { new StackLayout {Children = { usersCountLabel, filterEntry, loadingIndicator }, BackgroundColor = Styling.SubheaderYellow, Padding = new Thickness(3) }, listView } }; }
public InviteToAppPage(ViewModelBase viewModel) : base(viewModel) { Title = "Contacts"; var contactsCountLabel = new SquawkLabel(); contactsCountLabel.SetBinding(Label.TextProperty, new Binding("Contacts.Count", stringFormat: "{0} contacts.")); var tipLabel = new SquawkLabel(); tipLabel.Text = "Select a contact to send an invitation"; var listView = new BindableListView { ItemTemplate = new DataTemplate(() => { var imageCell = new ImageCell { ImageSource = Device.OnPlatform( ImageSource.FromFile("empty_contact.jpg"), ImageSource.FromFile("empty_contact.jpg"), ImageSource.FromFile("Assets/empty_contact.jpg")), }; imageCell.SetBinding(TextCell.TextProperty, new Binding("Name")); imageCell.SetBinding(TextCell.DetailProperty, new Binding("Number")); return imageCell; }), IsGroupingEnabled = true, GroupDisplayBinding = new Binding("Name"), }; listView.SetBinding(ListView.ItemsSourceProperty, new Binding("GroupedContacts")); listView.SetBinding(BindableListView.ItemClickedCommandProperty, new Binding("ContactSelectedCommand")); var loadingIndicator = new ActivityIndicator(); loadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy")); Content = new StackLayout { Children = { loadingIndicator, contactsCountLabel, tipLabel, listView } }; }
public MasterPage () { var masterPageItems = new List<MasterPageItem> (); masterPageItems.Add (new MasterPageItem { Title = "Contacts", IconSource = "contacts.png", TargetType = typeof(ContactsPage) }); masterPageItems.Add (new MasterPageItem { Title = "TodoList", IconSource = "todo.png", TargetType = typeof(TodoListPage) }); masterPageItems.Add (new MasterPageItem { Title = "Reminders", IconSource = "reminders.png", TargetType = typeof(ReminderPage) }); listView = new ListView { ItemsSource = masterPageItems, ItemTemplate = new DataTemplate (() => { var imageCell = new ImageCell (); imageCell.SetBinding (TextCell.TextProperty, "Title"); imageCell.SetBinding (ImageCell.ImageSourceProperty, "IconSource"); return imageCell; }), VerticalOptions = LayoutOptions.FillAndExpand, SeparatorVisibility = SeparatorVisibility.None }; Padding = new Thickness (0, 40, 0, 0); Icon = (Device.OS == TargetPlatform.Windows || Device.OS == TargetPlatform.WinPhone) ? "swap.png" : "hamburger.png"; Title = "Personal Organiser"; Content = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand, Children = { listView } }; }
public OnlineUsersPage(ViewModelBase viewModel) : base(viewModel) { Title = "Participants"; Icon = "group.png"; var usersCountLabel = new Label(); usersCountLabel.SetBinding(Label.TextProperty, new Binding("Users.Count", stringFormat: " {0} users online.")); var listView = new BindableListView { ItemTemplate = new DataTemplate(() => { var imageCell = new ImageCell { ImageSource = Device.OnPlatform( ImageSource.FromFile("empty_contact.jpg"), ImageSource.FromFile("empty_contact.jpg"), ImageSource.FromFile("Assets/empty_contact.jpg")), }; imageCell.SetBinding(TextCell.TextProperty, new Binding("Name")); imageCell.SetBinding(TextCell.DetailProperty, new Binding("Description")); return imageCell; }) }; listView.SetBinding(ListView.ItemsSourceProperty, new Binding("Users")); listView.SetBinding(BindableListView.ItemClickedCommandProperty, new Binding("ContactSelectedCommand")); var contactsLoadingIndicator = new ActivityIndicator(); contactsLoadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy")); Content = new StackLayout { Children = { contactsLoadingIndicator, usersCountLabel, listView } }; }
public MainMasterPage() { InitializeComponent(); var masterPageItems = new List<MasterPageItem>(); masterPageItems.Add(new MasterPageItem { Title = "Recherche de projet", //IconSource = "contacts.png", TargetType = typeof(MainPage) }); masterPageItems.Add(new MasterPageItem { Title = "Mon profil", TargetType = typeof(Profil) }); masterPageItems.Add(new MasterPageItem { Title = "Map", TargetType = typeof(Map) }); masterPageItems.Add(new MasterPageItem { Title = "Ajouter un projet", TargetType = typeof(AddProjectPage) }); listView = new ListView { ItemsSource = masterPageItems, ItemTemplate = new DataTemplate(() => { var imageCell = new ImageCell(); imageCell.SetBinding(TextCell.TextProperty, "Title"); return imageCell; }), VerticalOptions = LayoutOptions.FillAndExpand, }; Padding = new Thickness(0, 40, 0, 0); Title = "Menu"; Content = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand, Children = { listView } }; }
public SettingsPage(LanesViewModel viewModel) { BindingContext = viewModel; #region create the IsOpen Switch var isOpenSwitch = new SwitchCell { Text = "Is Open" }; isOpenSwitch.SetBinding(SwitchCell.OnProperty,"LaneTappedIsOpen"); #endregion #region Create the Needs Maintenance Switch var needsMaintenanceSwitch = new SwitchCell { Text = "Needs Maintenance" }; needsMaintenanceSwitch.SetBinding(SwitchCell.OnProperty,"LaneTappedNeedsMaintenance"); #endregion #region create the IP Address Entry var ipAddressText = new EntryCell { Label = "IP Address", HorizontalTextAlignment = TextAlignment.End }; ipAddressText.SetBinding(EntryCell.TextProperty, "LaneTappedIPAddress"); #endregion #region Create Image Cell var imageCell = new ImageCell(); imageCell.SetBinding(ImageCell.ImageSourceProperty, "ImageCellIcon"); #endregion #region Create the Icon Toggle Button var iconToggleButton = new Button(); iconToggleButton.SetBinding(Button.CommandProperty, "IconToggleButton"); iconToggleButton.SetBinding(Button.TextProperty, "ToggleButtonText"); #endregion #region create the TableView var tableView = new TableView { Intent = TableIntent.Settings, Root = new TableRoot { new TableSection{ isOpenSwitch, needsMaintenanceSwitch, ipAddressText, imageCell } } }; #endregion #region Create StackLayout to Include a Button var settingsStack = new StackLayout { Children ={ tableView, iconToggleButton } }; #endregion NavigationPage.SetTitleIcon(this,"cogwheel_navigation"); Title = $"Lane {viewModel.LanesList.IndexOf(viewModel.LaneTapped)+1} Settings"; Content = settingsStack; }
public MasterpageMoma() { var masterPageItems = new List<MasterPageItem>(); masterPageItems.Add(new MasterPageItem { Title = AppLanguageResource.Map, IconSource = "ic_action_navigate.png", TargetType = typeof(MapMoma) }); masterPageItems.Add(new MasterPageItem { Title = AppLanguageResource.Storyline, IconSource = "ic_action_map.png", TargetType = typeof(StorylineMoma) }); masterPageItems.Add(new MasterPageItem { Title = AppLanguageResource.Scavenger, IconSource = "ic_action_search.png", TargetType = typeof(ScavengerPageMoma) }); masterPageItems.Add(new MasterPageItem { Title = AppLanguageResource.Directions, IconSource = "ic_action_compass.png", TargetType = typeof(DirectionMoma) }); masterPageItems.Add(new MasterPageItem { Title = AppLanguageResource.Contact, IconSource = "ic_action_phone.png", TargetType = typeof(ContactMoma) }); masterPageItems.Add(new MasterPageItem { Title = AppLanguageResource.Help, IconSource = "ic_action_help.png", TargetType = typeof(HelpMoma) }); masterPageItems.Add(new MasterPageItem { Title = AppLanguageResource.Settings, IconSource = "ic_action_settings.png", TargetType = typeof(SettingsMoma) }); listView = new ListView { ItemsSource = masterPageItems, ItemTemplate = new DataTemplate(() => { var imageCell = new ImageCell(); imageCell.SetBinding(TextCell.TextProperty, "Title"); imageCell.TextColor = Color.White; imageCell.SetBinding(ImageCell.ImageSourceProperty, "IconSource"); return imageCell; }), VerticalOptions = LayoutOptions.FillAndExpand, }; Padding = new Thickness(10, 10, 0, 0); Icon = "menu_icon.png"; Title = "Master"; BackgroundColor = Color.FromHex("#001533"); Content = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand, Children = { listView } }; }
public MasterPage() { var masterPageItems = new List<MasterPageItem>(); masterPageItems.Add(new MasterPageItem { Title = "Homepage", IconSource = "homepage.png", TargetType = typeof(HomePage) }); masterPageItems.Add(new MasterPageItem { Title = "Resources", IconSource = "play.png", TargetType = typeof(ResourcesTabbedSwipePage) }); masterPageItems.Add(new MasterPageItem { Title = "Conversations", IconSource = "chat.png", TargetType = typeof(ChatSelection) }); masterPageItems.Add(new MasterPageItem { Title = "Account", IconSource = "account.png", TargetType = typeof(AccountPage) }); masterPageItems.Add(new MasterPageItem { Title = "Survey", IconSource = "survey.png", TargetType = typeof(Survey) }); masterPageItems.Add(new MasterPageItem { Title = "About Us", IconSource = "about.png", TargetType = typeof(AboutPage) }); //populate pull-out menu with above items listView = new ListView { ItemsSource = masterPageItems, ItemTemplate = new DataTemplate(() => { var imageCell = new ImageCell(); imageCell.SetValue(TextCell.TextColorProperty, Color.Black); imageCell.SetValue(TextCell.TextProperty, FontAttributes.Bold); imageCell.SetValue(TextCell.DetailColorProperty, Color.FromHex("B3B3B3")); imageCell.SetBinding(TextCell.TextProperty, "Title"); imageCell.SetBinding(ImageCell.ImageSourceProperty, "IconSource"); return imageCell; }), VerticalOptions = LayoutOptions.FillAndExpand, }; Icon = "drawable/menu.png"; Title = "MENU"; listView.RowHeight = 60; listView.BackgroundColor = Color.FromHex ("B3B3B3"); Device.OnPlatform(Android: () => { listView.SeparatorVisibility = SeparatorVisibility.Default; listView.SeparatorColor = Color.FromHex("4D345D"); //separator between options }, iOS: () => { listView.SeparatorVisibility = SeparatorVisibility.None; listView.SeparatorColor = Color.FromHex("4D345D"); //separator between options }); var menuLabel = new ContentView { Padding = new Thickness(10, 10, 0, 10), Content = new Label { TextColor = Color.Black, FontSize = 18, FontFamily = "Arial", BackgroundColor = Color.FromHex("B3B3B3"), Text = "MENU", } }; var hotlineButton = new Button { Text = string.Format("Call Suicide Hotline") }; hotlineButton.Clicked += (sender, args) => { Device.OpenUri(new Uri(string.Format("tel:{0}", "+1(800)2738255"))); }; var layout = new StackLayout { Spacing = 0, VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.FromHex("B3B3B3") }; layout.Children.Add(menuLabel); layout.Children.Add( new BoxView() { //Line under settings Color = Color.FromHex("4D345D"), HeightRequest = 6 }); layout.Children.Add(listView); layout.Children.Add(hotlineButton); Content = layout; }