public ContactsMapView(ContactsViewModel vm) { this.Title = "Map"; this.Icon = "map.png"; this.BindingContext = vm; ViewModel.PropertyChanged += (sender, args) => { if (args.PropertyName == "Contacts") MakeMap(); }; map = new Map() { IsShowingUser = true }; MakeMap(); var stack = new StackLayout { Spacing = 0 }; map.VerticalOptions = LayoutOptions.FillAndExpand; map.HeightRequest = 100; map.WidthRequest = 960; stack.Children.Add(map); Content = stack; }
public ContactsView(ContactsViewModel vm) { InitializeComponent (); this.BindingContext = vm; ToolbarItems.Add(new ToolbarItem { Icon = "add.png", Name = "add", Command = new Command(() => { //navigate to new page Navigation.PushAsync(new ContactDetailsTabView(null)); }) }); //SYI: Removed - Pull contacts only on initial load. //ToolbarItems.Add(new ToolbarItem //{ //Icon = "refresh.png", //Name = "refresh", //Command = ViewModel.LoadContactsCommand //}); }
NavigationPage PageForOption (MenuType option) { switch (option) { case MenuType.Dashboard: { if (dashboard != null) return dashboard; var vm = new DashboardViewModel() { Navigation = Navigation }; dashboard = new NavigationPage(new DashboardView(vm)); return dashboard; } case MenuType.Accounts: { if (accounts != null) return accounts; var vm = new AccountsViewModel() { Navigation = Navigation }; accounts = new NavigationPage(new AccountsView(vm)); return accounts; } case MenuType.Leads: { if (leads != null) return leads; leads = new NavigationPage(new Leads.LeadsView(new ViewModels.Leads.LeadsViewModel() { Navigation = Navigation })); return leads; } case MenuType.Contacts: { if (contacts != null) return contacts; var vm = new ContactsViewModel(); contacts = new NavigationPage(new Contacts.ContactsView(vm)); return contacts; } case MenuType.Catalog: { if (catalog != null) return catalog; catalog = new NavigationPage(new Catalog.CatalogCarouselView()); return catalog; } case MenuType.Settings: { if (settings != null) return settings; settings = new NavigationPage(new Settings.UserSettingsView()); return settings; } } throw new NotImplementedException("Unknown menu option: " + option.ToString()); }