Skip to content
This repository was archived by the owner on Feb 3, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/TravelMonkey.Android/Resources/Resource.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/TravelMonkey.Android/TravelMonkey.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.6.0.616-pre4" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.2" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.1" />
<PackageReference Include="Xamarin.Forms.PancakeView">
<Version>1.3.7</Version>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion src/TravelMonkey.iOS/TravelMonkey.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.6.0.616-pre4" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.2" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.1" />
<PackageReference Include="Xamarin.Forms.PancakeView">
<Version>1.3.7</Version>
</PackageReference>
Expand Down
10 changes: 5 additions & 5 deletions src/TravelMonkey/ApiKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
{
public static class ApiKeys
{
#warning You need to set up your API keys.
public static string ComputerVisionApiKey = "";
public static string TranslationsApiKey = "";
public static string BingImageSearch = "";
//#warning You need to set up your API keys.
public static string ComputerVisionApiKey = "16631d45b4eb49859c78a4f1226554dd";
public static string TranslationsApiKey = "af35527fe3d54e71819bb95eb9a88283";
public static string BingImageSearch = "40ab99291f01481ebc3b58b460e2681a";

// Change this to the Azure Region you are using
public static string ComputerVisionEndpoint = "https://westeurope.api.cognitive.microsoft.com/";
public static string ComputerVisionEndpoint = "https://westus2.api.cognitive.microsoft.com/";
public static string TranslationsEndpoint = "https://api.cognitive.microsofttranslator.com/";
}
}
4 changes: 2 additions & 2 deletions src/TravelMonkey/Services/BingSearchService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ public class BingSearchService

public async Task<List<Destination>> GetDestinations()
{
var searchDestinations = new[] { "Seattle", "Maui", "Amsterdam", "Antarctica" };

var searchDestinations = new[] { "Seattle", "Maui", "Amsterdam", "Antarctica", "Argentina" };
//Write city and call bingsearch
try
{
var client = new ImageSearchClient(new ApiKeyServiceClientCredentials(ApiKeys.BingImageSearch));
Expand Down
2 changes: 1 addition & 1 deletion src/TravelMonkey/TravelMonkey.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.6.0.616-pre4" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.2" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.1" />
<PackageReference Include="Xamarin.Forms.PancakeView" Version="1.3.7" />
<PackageReference Include="Xam.Plugin.Media" Version="5.0.1" />
<PackageReference Include="Acr.UserDialogs" Version="7.1.0.442" />
Expand Down
17 changes: 16 additions & 1 deletion src/TravelMonkey/ViewModels/MainPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public Destination CurrentDestination
set => Set(ref _currentDestination, value);
}





public Command<string> OpenUrlCommand { get; } = new Command<string>(async (url) =>
{
if (!string.IsNullOrWhiteSpace(url))
Expand All @@ -33,6 +37,9 @@ public Destination CurrentDestination
});
});

public string Description { get; }


public MainPageViewModel()
{
if (Destinations.Count > 0)
Expand All @@ -48,13 +55,21 @@ public MainPageViewModel()
else
CurrentDestination = Destinations[currentIdx + 1];
};

}

}
public Command<string> SpeachTextCommand { get; } = new Command<string>(async (text) =>
{
if (!string.IsNullOrWhiteSpace(text))
await TextToSpeech.SpeakAsync(text);

});

public void StartSlideShow()
{
_slideShowTimer.Start();

}
public void StopSlideShow()
{
Expand Down
8 changes: 8 additions & 0 deletions src/TravelMonkey/ViewModels/TranslateResultPageViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using TravelMonkey.Services;
using Xamarin.Essentials;
using Xamarin.Forms;

namespace TravelMonkey.ViewModels
Expand Down Expand Up @@ -49,5 +50,12 @@ private async void TranslateText()

Translations = result.Translations;
}

public Command<string> SpeachTranslationsCommand { get; } = new Command<string>(async (text) =>
{
if (!string.IsNullOrWhiteSpace(text))
await TextToSpeech.SpeakAsync(text);

});
}
}
18 changes: 15 additions & 3 deletions src/TravelMonkey/Views/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:d="http://xamarin.com/schemas/2014/forms/design" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:yummy="clr-namespace:Xamarin.Forms.PancakeView;assembly=Xamarin.Forms.PancakeView" xmlns:effect="clr-namespace:TravelMonkey.Effects" mc:Ignorable="d" x:Class="TravelMonkey.Views.MainPage">
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:yummy="clr-namespace:Xamarin.Forms.PancakeView;assembly=Xamarin.Forms.PancakeView"
xmlns:effect="clr-namespace:TravelMonkey.Effects" mc:Ignorable="d"
x:Class="TravelMonkey.Views.MainPage">
<ScrollView>
<StackLayout BackgroundColor="White">
<!-- Hero image -->
Expand Down Expand Up @@ -75,7 +81,7 @@
</StackLayout>

<ScrollView Orientation="Horizontal">
<StackLayout Spacing="0" Orientation="Horizontal" BindableLayout.ItemsSource="{Binding Pictures}" HeightRequest="120">
<StackLayout x:Name="PicturesCollection" Spacing="0" Orientation="Horizontal" BindableLayout.ItemsSource="{Binding Pictures}" HeightRequest="120">
<BindableLayout.EmptyViewTemplate>
<DataTemplate>
<Grid HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" >
Expand All @@ -89,9 +95,15 @@
<yummy:PancakeView HeightRequest="120" WidthRequest="200" IsClippedToBounds="true" CornerRadius="12">
<Grid>
<Image Aspect="AspectFill" Source="{Binding Image}" />
<yummy:PancakeView HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" BackgroundGradientStartColor="Transparent" BackgroundGradientEndColor="#222" />
<yummy:PancakeView HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" BackgroundGradientStartColor="Transparent"
BackgroundGradientEndColor="#222" />
<StackLayout Spacing="0" Margin="12" VerticalOptions="EndAndExpand">
<Label FontSize="16" FontFamily="LatoBold" TextColor="#fff" Text="{Binding Description}" />
<Button Text="🔈" Command="{Binding Path=BindingContext.SpeachTextCommand, Source={x:Reference Name= PicturesCollection}}"
CommandParameter="{Binding Description}"
HorizontalOptions="Center"
VerticalOptions="Center">
</Button>
</StackLayout>
</Grid>
</yummy:PancakeView>
Expand Down
4 changes: 4 additions & 0 deletions src/TravelMonkey/Views/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.ComponentModel;
using TravelMonkey.ViewModels;
using Xamarin.Essentials;
using Xamarin.Forms;

namespace TravelMonkey.Views
Expand All @@ -15,6 +16,7 @@ public MainPage()
InitializeComponent();

BindingContext = _mainPageViewModel;

}

protected override void OnAppearing()
Expand All @@ -36,6 +38,8 @@ private async void AddNewPicture_Tapped(object sender, EventArgs e)
await Navigation.PushModalAsync(new AddPicturePage());
}



private async void Entry_Completed(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(TranslateTextEntry.Text))
Expand Down
7 changes: 6 additions & 1 deletion src/TravelMonkey/Views/TranslationResultPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<Entry Margin="15,0" Text="{Binding InputText, Mode=OneWay}" ReturnCommand="{Binding TranslateTextCommand}" ReturnCommandParameter="{Binding Text, Source={RelativeSource Mode=Self}}" FontSize="20" FontFamily="LatoRegular" BackgroundColor="Transparent" Placeholder="Enter text to translate" />

<ScrollView>
<StackLayout BindableLayout.ItemsSource="{Binding Translations}" Padding="10">
<StackLayout x:Name="TranslationsCollection" BindableLayout.ItemsSource="{Binding Translations}" Padding="10">
<BindableLayout.EmptyViewTemplate>
<DataTemplate>
<Grid HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" >
Expand All @@ -38,6 +38,11 @@
<Image Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Source="{Binding Key, StringFormat='{0}.png'}" WidthRequest="40" HorizontalOptions="Start" />
<Label Grid.Column="1" Grid.Row="0" Text="{Binding Key, Converter={StaticResource LanguageCodeToDescriptionConverter}, ConverterParameter={Binding Key}}" FontFamily="LatoBold" FontSize="Small" VerticalOptions="End" />
<Label Grid.Column="1" Grid.Row="1" Text="{Binding Value}" FontFamily="LatoRegular" FontSize="20" />
<Button Grid.Column="1" Grid.Row="1" Text="🔈" Command="{Binding Path=BindingContext.SpeachTranslationsCommand, Source={x:Reference Name= TranslationsCollection}}"
CommandParameter="{Binding Value}"
HorizontalOptions="EndAndExpand"
VerticalOptions="Center">
</Button>
</Grid>
</yummy:PancakeView>
</DataTemplate>
Expand Down