Skip to content
Merged
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
25 changes: 15 additions & 10 deletions Windows Phone/VineCache/VineCache/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,18 +180,23 @@ private void OnFacebookAuthenticationFinished(AccessTokenData session)

internal class VineCacheParseDelegate : ParseDelegate
{
bool eventReturned = false;
public void EventResult(PLEvent eventItem)
{
FacebookClient client = new FacebookClient(facebookToken);
client.GetTaskAsync("me", new { fields = "name, id, email" }).ContinueWith((Task<object> task, object item) => {
dynamic facebookInfo = task.Result;
App.facebookName = facebookInfo.name;
App.facebookID = facebookInfo.id;
//App.facebookEmail = facebookInfo.email;
parseDB.CreatePlayer(App.facebookName, App.facebookEmail, App.facebookID, item as PLEvent);
parseDB.GetMap(item as PLEvent);
}, eventItem);

if (eventReturned)
{
FacebookClient client = new FacebookClient(facebookToken);
client.GetTaskAsync("me", new { fields = "name, id, email" }).ContinueWith((Task<object> task, object item) =>
{
dynamic facebookInfo = task.Result;
App.facebookName = facebookInfo.name;
App.facebookID = facebookInfo.id;
//App.facebookEmail = facebookInfo.email;
parseDB.CreatePlayer(App.facebookName, App.facebookEmail, App.facebookID, item as PLEvent);
parseDB.GetMap(item as PLEvent);
}, eventItem);
}
eventReturned = true;
}

public void MapResult(PLMap mapItem)
Expand Down
5 changes: 3 additions & 2 deletions Windows Phone/VineCache/VineCache/DisplayVideoPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@

<Grid Background="White">
<TextBlock x:Name="gameNameTextBlock" Text="(Game name goes here)" Foreground="Green" FontSize="22" FontWeight="SemiBold" Margin="20,20,0,575"/>
<TextBlock Text="Find the location this video was taken:" Foreground="Green" FontSize="16" Margin="20,65,0,555"/>
<TextBlock Tapped="videoMediaElement_Tapped" Text="Find the location this video was taken:" Foreground="Green" FontSize="16" Margin="20,65,0,555"/>
<StackPanel Background="Black" Margin="20,90,20,0" VerticalAlignment="Top" >
<MediaElement x:Name="videoMediaElement" Source="Assets/Fountain.small.mp4" AutoPlay="False" Tapped="videoMediaElement_Tapped" VerticalAlignment="Top"/>
<MediaElement x:Name="videoMediaElement" Source="C:/Data/Users/Public/Videos/vinecachetargetvideo.mp4" AutoPlay="False" Tapped="videoMediaElement_Tapped" VerticalAlignment="Top"/>
</StackPanel>
<Button Name="NextPageButton" Content="Upload my video" Background="Green" HorizontalAlignment="Center" Click="NextPageButton_Click"/>
<ProgressBar x:Name="distanceToObjectProgressBar" FlowDirection="LeftToRight" HorizontalAlignment="Left" Height="20" VerticalAlignment="Bottom" Margin="20,0,0,20" Width="360" />
</Grid>
</Page>
22 changes: 17 additions & 5 deletions Windows Phone/VineCache/VineCache/DisplayVideoPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Windows.UI.Xaml.Navigation;
using Windows.Devices.Geolocation;
using Windows.Storage;
using System.Threading.Tasks;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkID=390556

Expand All @@ -26,6 +27,7 @@ public sealed partial class DisplayVideoPage : Page
{
private Geopoint startingPoint;
private double m_startingDistance;
private bool videoTargetSet = false;

public DisplayVideoPage()
{
Expand Down Expand Up @@ -74,8 +76,10 @@ protected override void OnNavigatedTo(NavigationEventArgs e)

private async void videoMediaElement_Tapped(object sender, TappedRoutedEventArgs e)
{
SetVideoTarget();
//this.NavigateToUploadVideoPage();
if (!videoTargetSet)
{
await SetVideoTarget();
}
videoMediaElement.Play();
distanceToObjectProgressBar.Value = 50;
if (this.startingPoint == null)
Expand All @@ -89,9 +93,12 @@ private async void videoMediaElement_Tapped(object sender, TappedRoutedEventArgs
}
}

public void SetVideoTarget()
public async Task SetVideoTarget()
{
this.videoMediaElement.Source = new Uri(KnownFolders.VideosLibrary.Path + "/vinecachetargetvideo.mp4");
StorageFile file = await KnownFolders.VideosLibrary.GetFileAsync("vinecachetargetvideo.mp4");
var stream = await file.OpenAsync(FileAccessMode.Read);
videoMediaElement.SetSource(stream, file.ContentType);
videoTargetSet = true;
}

private void NavigateToUploadVideoPage()
Expand All @@ -105,5 +112,10 @@ private Point GetTargetCoordinates()
//TODO: Get GPS Point from Node
return new Point(47.6455, -122.1286);
}
}

private void NextPageButton_Click(object sender, RoutedEventArgs e)
{
NavigateToUploadVideoPage();
}
}
}
4 changes: 3 additions & 1 deletion Windows Phone/VineCache/VineCache/ParseLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using System.Linq;

namespace VineCache
{
Expand Down Expand Up @@ -225,7 +226,8 @@ public void GetMap(PLEvent plEvent)

try
{
PLMap map = new PLMap((task.Result as ParseObject[])[0]);
ParseObject[] objects = task.Result.ToArray();
PLMap map = new PLMap(objects[0]);

ParseDB._PLMap = map;

Expand Down