Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added old searchs and caching translations #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
7 changes: 4 additions & 3 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.

72 changes: 54 additions & 18 deletions src/TravelMonkey.iOS/TravelMonkey.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,60 @@
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-20x20%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-20x20%403x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-29x29%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-29x29%403x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-40x40%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-40x40%403x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-60x60%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-60x60%403x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-20x20%401x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-20x20%402x-1.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-29x29%401x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-29x29%402x-1.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-40x40%401x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-40x40%402x-1.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-76x76%401x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-76x76%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-83.5x83.5%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\ItunesArtwork%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-20x20%402x.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-20x20%403x.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-29x29%402x.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-29x29%403x.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-40x40%402x.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-40x40%403x.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-60x60%402x.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-60x60%403x.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-20x20%401x.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-20x20%402x-1.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-29x29%401x.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-29x29%402x-1.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-40x40%401x.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-40x40%402x-1.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-76x76%401x.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-76x76%402x.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-App-83.5x83.5%402x.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\ItunesArtwork%402x.png">
<Visible>false</Visible>
</ImageAsset>
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down
56 changes: 32 additions & 24 deletions src/TravelMonkey.sln
Original file line number Diff line number Diff line change
@@ -1,57 +1,65 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
# Visual Studio Version 16
VisualStudioVersion = 16.0.30011.22
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TravelMonkey.Android", "TravelMonkey.Android\TravelMonkey.Android.csproj", "{A06A377B-F901-4238-88BD-A92726C715C2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TravelMonkey.iOS", "TravelMonkey.iOS\TravelMonkey.iOS.csproj", "{8C00CCB8-214B-4B88-8042-4C8D31284CD3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TravelMonkey", "TravelMonkey\TravelMonkey.csproj", "{04991790-FBB2-415A-9531-268B4193DB3E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TravelMonkey", "TravelMonkey\TravelMonkey.csproj", "{04991790-FBB2-415A-9531-268B4193DB3E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|iPhoneSimulator = Release|iPhoneSimulator
Debug|iPhone = Debug|iPhone
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|Any CPU = Release|Any CPU
Release|iPhone = Release|iPhone
Release|iPhoneSimulator = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A06A377B-F901-4238-88BD-A92726C715C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A06A377B-F901-4238-88BD-A92726C715C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A06A377B-F901-4238-88BD-A92726C715C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A06A377B-F901-4238-88BD-A92726C715C2}.Release|Any CPU.Build.0 = Release|Any CPU
{A06A377B-F901-4238-88BD-A92726C715C2}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{A06A377B-F901-4238-88BD-A92726C715C2}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{A06A377B-F901-4238-88BD-A92726C715C2}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{A06A377B-F901-4238-88BD-A92726C715C2}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{A06A377B-F901-4238-88BD-A92726C715C2}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{A06A377B-F901-4238-88BD-A92726C715C2}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{A06A377B-F901-4238-88BD-A92726C715C2}.Debug|iPhone.Build.0 = Debug|Any CPU
{A06A377B-F901-4238-88BD-A92726C715C2}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{A06A377B-F901-4238-88BD-A92726C715C2}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{A06A377B-F901-4238-88BD-A92726C715C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A06A377B-F901-4238-88BD-A92726C715C2}.Release|Any CPU.Build.0 = Release|Any CPU
{A06A377B-F901-4238-88BD-A92726C715C2}.Release|iPhone.ActiveCfg = Release|Any CPU
{A06A377B-F901-4238-88BD-A92726C715C2}.Release|iPhone.Build.0 = Release|Any CPU
{A06A377B-F901-4238-88BD-A92726C715C2}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{A06A377B-F901-4238-88BD-A92726C715C2}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{8C00CCB8-214B-4B88-8042-4C8D31284CD3}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
{8C00CCB8-214B-4B88-8042-4C8D31284CD3}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
{8C00CCB8-214B-4B88-8042-4C8D31284CD3}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
{8C00CCB8-214B-4B88-8042-4C8D31284CD3}.Release|Any CPU.Build.0 = Release|iPhoneSimulator
{8C00CCB8-214B-4B88-8042-4C8D31284CD3}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{8C00CCB8-214B-4B88-8042-4C8D31284CD3}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{8C00CCB8-214B-4B88-8042-4C8D31284CD3}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{8C00CCB8-214B-4B88-8042-4C8D31284CD3}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{8C00CCB8-214B-4B88-8042-4C8D31284CD3}.Debug|iPhone.ActiveCfg = Debug|iPhone
{8C00CCB8-214B-4B88-8042-4C8D31284CD3}.Debug|iPhone.Build.0 = Debug|iPhone
{8C00CCB8-214B-4B88-8042-4C8D31284CD3}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{8C00CCB8-214B-4B88-8042-4C8D31284CD3}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{8C00CCB8-214B-4B88-8042-4C8D31284CD3}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
{8C00CCB8-214B-4B88-8042-4C8D31284CD3}.Release|Any CPU.Build.0 = Release|iPhoneSimulator
{8C00CCB8-214B-4B88-8042-4C8D31284CD3}.Release|iPhone.ActiveCfg = Release|iPhone
{8C00CCB8-214B-4B88-8042-4C8D31284CD3}.Release|iPhone.Build.0 = Release|iPhone
{8C00CCB8-214B-4B88-8042-4C8D31284CD3}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{8C00CCB8-214B-4B88-8042-4C8D31284CD3}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{04991790-FBB2-415A-9531-268B4193DB3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{04991790-FBB2-415A-9531-268B4193DB3E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{04991790-FBB2-415A-9531-268B4193DB3E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{04991790-FBB2-415A-9531-268B4193DB3E}.Release|Any CPU.Build.0 = Release|Any CPU
{04991790-FBB2-415A-9531-268B4193DB3E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{04991790-FBB2-415A-9531-268B4193DB3E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{04991790-FBB2-415A-9531-268B4193DB3E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{04991790-FBB2-415A-9531-268B4193DB3E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{04991790-FBB2-415A-9531-268B4193DB3E}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{04991790-FBB2-415A-9531-268B4193DB3E}.Debug|iPhone.Build.0 = Debug|Any CPU
{04991790-FBB2-415A-9531-268B4193DB3E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{04991790-FBB2-415A-9531-268B4193DB3E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{04991790-FBB2-415A-9531-268B4193DB3E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{04991790-FBB2-415A-9531-268B4193DB3E}.Release|Any CPU.Build.0 = Release|Any CPU
{04991790-FBB2-415A-9531-268B4193DB3E}.Release|iPhone.ActiveCfg = Release|Any CPU
{04991790-FBB2-415A-9531-268B4193DB3E}.Release|iPhone.Build.0 = Release|Any CPU
{04991790-FBB2-415A-9531-268B4193DB3E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{04991790-FBB2-415A-9531-268B4193DB3E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {22BAEAC3-A8AD-42DE-B6AD-67ABEC0D42B8}
EndGlobalSection
EndGlobal
12 changes: 12 additions & 0 deletions src/TravelMonkey/Models/OldSearchs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace TravelMonkey.Models
{
public class OldSearchs
{
public string Phrase { get; set; }
public Dictionary<string, string> Resultados { get; set; }
}
}
40 changes: 40 additions & 0 deletions src/TravelMonkey/Services/DataTranslationsService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using TravelMonkey.Models;

namespace TravelMonkey.Services
{
internal class DataTranslationsService
{
static DataTranslationsService item;
public static DataTranslationsService Instance
{
get
{
if (item == null)
{
item = new DataTranslationsService();
}
return item;
}
}
public List<OldSearchs> Listado = new List<OldSearchs>();
public void Add(string phrase, Dictionary<string, string> results)
{
try
{
Listado.Add(new OldSearchs()
{
Phrase = phrase,
Resultados = results
});
}
catch (Exception)
{

}
}
}
}
7 changes: 3 additions & 4 deletions src/TravelMonkey/TravelMonkey.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@
<ItemGroup>
<Folder Include="Resources\" />
<Folder Include="Resources\Fonts\" />
<Folder Include="ViewModels\" />
<Folder Include="Models\" />
<Folder Include="Effects\" />
<Folder Include="Views\" />
<Folder Include="Services\" />
<Folder Include="Data\" />
<Folder Include="Models\CognitiveServices\" />
<Folder Include="Converters\" />
Expand All @@ -50,5 +46,8 @@
<DependentUpon>MainPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Update="Views\OldTranslationsPage.xaml.cs">
<DependentUpon>OldTranslationsPage.xaml</DependentUpon>
</Compile>
</ItemGroup>
</Project>
12 changes: 11 additions & 1 deletion src/TravelMonkey/ViewModels/MainPageViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Timers;
using System.Windows.Input;
using TravelMonkey.Data;
using TravelMonkey.Models;
using TravelMonkey.Views;
using Xamarin.Essentials;
using Xamarin.Forms;

Expand Down Expand Up @@ -33,6 +36,7 @@ public Destination CurrentDestination
});
});

public ICommand BTgoLastSearchs { get; }
public MainPageViewModel()
{
if (Destinations.Count > 0)
Expand All @@ -49,6 +53,12 @@ public MainPageViewModel()
CurrentDestination = Destinations[currentIdx + 1];
};
}
BTgoLastSearchs = new Command(()=>GoLast());
}

private void GoLast()
{
App.Current.MainPage.Navigation.PushModalAsync(new OldTranslationsPage());
}

public void StartSlideShow()
Expand Down
44 changes: 44 additions & 0 deletions src/TravelMonkey/ViewModels/OldTranslationsViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq.Expressions;
using System.Net.Http.Headers;
using System.Windows.Input;
using TravelMonkey.Models;
using TravelMonkey.Services;
using TravelMonkey.Views;
using Xamarin.Forms;

namespace TravelMonkey.ViewModels
{
public class OldTranslationsViewModel : BaseViewModel
{
private string _inputText;
private List<OldSearchs> _searchs;

public List<OldSearchs> Searchs
{
get => _searchs;
set
{
Set(ref _searchs, value);
}
}
public ICommand BTGo { get; }
public OldTranslationsViewModel()
{
BTGo = new Command(dat => Goto(dat));
}
internal void Refresh()
{
Searchs = DataTranslationsService.Instance.Listado;
}

internal async void Goto(object dat)
{
OldSearchs item = dat as OldSearchs;
if (item == null) return;
await App.Current.MainPage.Navigation.PushModalAsync(new TranslationResultPage(item.Phrase));
}
}
}
Loading