Beispiel #1
0
		private void setupViewModel()
		{			
			this.ViewModel.ShowProfileSettings = async (arg) => {
				await this.Navigation.PushModalAsync(new NavigationPage(new ProfileSettingsPage(arg)));
			};
			this.ViewModel.ShowLanguageChangeWarning = (arg) => {
				DisplayAlert(AppResources.AlertTitleWarning, arg, AppResources.OK);
			};

			this.ViewModel.ShowSaveStoreAction = async (s) => {
				if(s == null)
				{
					await this.Navigation.PushModalAsync(new NavigationPage(new SaveStorePage(s)));
				}
				else
				{
					var storeInfoPage = new StoreInfoPage(s, ContentMode.Edit);
					await this.Navigation.PushModalAsync(new NavigationPage(storeInfoPage));
				}
			};

			this.ViewModel.ShowTermsAction = async () =>
			{
					await this.Navigation.PushModalAsync(new NavigationPage(new TermsPage()));
			};
			this.BindingContext = _viewModel;
		}
Beispiel #2
0
		private async void itemSelected (object sender, SelectedItemChangedEventArgs e)
		{
			var item = ((ListView)sender).SelectedItem as StoreViewModel; 
			if (item != null)
			{
				((ListView)sender).SelectedItem = null;
				var storeInfo = new StoreInfoPage(item.Store);
				await this.Navigation.PushAsync(storeInfo);
			}
		}
Beispiel #3
0
		protected override void OnAppearing()
		{
			base.OnAppearing();

			if (!_toolbarButtonsAdded)
			{
				//if this view is not inside root page add close button
				var root = this.FindParent<RootPage>();
				if (root == null)
				{
					this.ToolbarItems.Add(new ToolbarItem(AppResources.ButtonClose, "", async () =>
							{
								await this.Navigation.PopModalAsync();
						}));
				}


				this.ViewModel.DidSaveStoreAction = async (savedStore, isNew) =>
				{
					if (isNew)
					{
						//If the view isn't inside tabs, pop it
						if (root == null)
						{
							await this.Navigation.PopModalAsync();

							var storeInfoPage = new StoreInfoPage(savedStore, ContentMode.Edit);
							await FormsApp.Current.MainPage.Navigation.PushModalAsync(new NavigationPage(storeInfoPage));
						}
					}
					else
					{
						//If the view isn't inside tabs, pop it
						if (root == null)
							await this.Navigation.PopAsync();
					}
				};
				_toolbarButtonsAdded = true;
			}
			
			this.ViewModel.ReloadCommand.Execute(null);
		}