diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000..6cc3e15
Binary files /dev/null and b/.DS_Store differ
diff --git a/Ajapaik.sln b/Ajapaik.sln
new file mode 100755
index 0000000..e2d3e80
--- /dev/null
+++ b/Ajapaik.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010 Express for Windows Phone
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ajapaik", "Ajapaik\Ajapaik.csproj", "{3CFB20AD-8C75-43E4-A753-9A1BFB8EC103}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {3CFB20AD-8C75-43E4-A753-9A1BFB8EC103}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3CFB20AD-8C75-43E4-A753-9A1BFB8EC103}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3CFB20AD-8C75-43E4-A753-9A1BFB8EC103}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+ {3CFB20AD-8C75-43E4-A753-9A1BFB8EC103}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3CFB20AD-8C75-43E4-A753-9A1BFB8EC103}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3CFB20AD-8C75-43E4-A753-9A1BFB8EC103}.Release|Any CPU.Deploy.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Ajapaik/.DS_Store b/Ajapaik/.DS_Store
new file mode 100644
index 0000000..a7be8c7
Binary files /dev/null and b/Ajapaik/.DS_Store differ
diff --git a/Ajapaik/Ajapaik.csproj b/Ajapaik/Ajapaik.csproj
new file mode 100755
index 0000000..02d1577
--- /dev/null
+++ b/Ajapaik/Ajapaik.csproj
@@ -0,0 +1,189 @@
+
+
+
+ Debug
+ AnyCPU
+ 10.0.20506
+ 2.0
+ {3CFB20AD-8C75-43E4-A753-9A1BFB8EC103}
+ {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
+ Library
+ Properties
+ Ajapaik
+ Ajapaik
+ v4.0
+ $(TargetFrameworkVersion)
+ WindowsPhone71
+ Silverlight
+ true
+
+
+ true
+ true
+ Ajapaik.xap
+ Properties\AppManifest.xml
+ Ajapaik.App
+ true
+ true
+
+
+ true
+ full
+ false
+ Bin\Debug
+ DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
+ true
+ true
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ Bin\Release
+ TRACE;SILVERLIGHT;WINDOWS_PHONE
+ true
+ true
+ prompt
+ 4
+
+
+
+ .\Coding4Fun.Phone.Controls.dll
+
+
+ .\Coding4Fun.Phone.Controls.Toolkit.dll
+
+
+ .\ExifLib.dll
+
+
+ .\Hammock.WindowsPhone.Mango.dll
+
+
+ .\ICSharpCode.SharpZipLib.WindowsPhone.dll
+
+
+
+
+ False
+ .\Microsoft.Phone.Controls.Toolkit.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ App.xaml
+
+
+
+
+
+ MainPage.xaml
+
+
+
+
+
+
+
+ AcceptPhotoView.xaml
+
+
+ CameraWithOverlay.xaml
+
+
+ PhotoInfoView.xaml
+
+
+ PhotoListView.xaml
+
+
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+
+
+
+
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Ajapaik/Ajapaik.csproj.user b/Ajapaik/Ajapaik.csproj.user
new file mode 100755
index 0000000..394572e
--- /dev/null
+++ b/Ajapaik/Ajapaik.csproj.user
@@ -0,0 +1,15 @@
+
+
+
+ ShowAllFiles
+
+
+
+
+
+ False
+
+
+
+
+
\ No newline at end of file
diff --git a/Ajapaik/App.xaml b/Ajapaik/App.xaml
new file mode 100755
index 0000000..003cc0d
--- /dev/null
+++ b/Ajapaik/App.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Ajapaik/App.xaml.cs b/Ajapaik/App.xaml.cs
new file mode 100755
index 0000000..7a232fa
--- /dev/null
+++ b/Ajapaik/App.xaml.cs
@@ -0,0 +1,161 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using Microsoft.Phone.Controls;
+using Microsoft.Phone.Shell;
+
+namespace Ajapaik
+{
+ public partial class App : Application
+ {
+ private static Settings settings = null;
+
+ ///
+ /// Sptnik config settings.
+ ///
+ /// Sptnik settings.
+ public static Settings Settings
+ {
+ get
+ {
+ // Delay creation of the view model until necessary
+ if (settings == null)
+ {
+ settings = new Settings();
+ }
+ return settings;
+ }
+ }
+
+ ///
+ /// Provides easy access to the root frame of the Phone Application.
+ ///
+ /// The root frame of the Phone Application.
+ public PhoneApplicationFrame RootFrame { get; private set; }
+
+ ///
+ /// Constructor for the Application object.
+ ///
+ public App()
+ {
+ // Global handler for uncaught exceptions.
+ UnhandledException += Application_UnhandledException;
+
+ // Standard Silverlight initialization
+ InitializeComponent();
+
+ // Phone-specific initialization
+ InitializePhoneApplication();
+
+ // Show graphics profiling information while debugging.
+ if (System.Diagnostics.Debugger.IsAttached)
+ {
+ // Display the current frame rate counters.
+ Application.Current.Host.Settings.EnableFrameRateCounter = true;
+
+ // Show the areas of the app that are being redrawn in each frame.
+ //Application.Current.Host.Settings.EnableRedrawRegions = true;
+
+ // Enable non-production analysis visualization mode,
+ // which shows areas of a page that are handed off to GPU with a colored overlay.
+ //Application.Current.Host.Settings.EnableCacheVisualization = true;
+
+ // Disable the application idle detection by setting the UserIdleDetectionMode property of the
+ // application's PhoneApplicationService object to Disabled.
+ // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
+ // and consume battery power when the user is not using the phone.
+ PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
+ }
+
+ }
+
+ // Code to execute when the application is launching (eg, from Start)
+ // This code will not execute when the application is reactivated
+ private void Application_Launching(object sender, LaunchingEventArgs e)
+ {
+ }
+
+ // Code to execute when the application is activated (brought to foreground)
+ // This code will not execute when the application is first launched
+ private void Application_Activated(object sender, ActivatedEventArgs e)
+ {
+ }
+
+ // Code to execute when the application is deactivated (sent to background)
+ // This code will not execute when the application is closing
+ private void Application_Deactivated(object sender, DeactivatedEventArgs e)
+ {
+ }
+
+ // Code to execute when the application is closing (eg, user hit Back)
+ // This code will not execute when the application is deactivated
+ private void Application_Closing(object sender, ClosingEventArgs e)
+ {
+ }
+
+ // Code to execute if a navigation fails
+ private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
+ {
+ if (System.Diagnostics.Debugger.IsAttached)
+ {
+ // A navigation has failed; break into the debugger
+ System.Diagnostics.Debugger.Break();
+ }
+ }
+
+ // Code to execute on Unhandled Exceptions
+ private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
+ {
+ if (System.Diagnostics.Debugger.IsAttached)
+ {
+ // An unhandled exception has occurred; break into the debugger
+ System.Diagnostics.Debugger.Break();
+ }
+ }
+
+ #region Phone application initialization
+
+ // Avoid double-initialization
+ private bool phoneApplicationInitialized = false;
+
+ // Do not add any additional code to this method
+ private void InitializePhoneApplication()
+ {
+ if (phoneApplicationInitialized)
+ return;
+
+ // Create the frame but don't set it as RootVisual yet; this allows the splash
+ // screen to remain active until the application is ready to render.
+ RootFrame = new PhoneApplicationFrame();
+ RootFrame.Navigated += CompleteInitializePhoneApplication;
+
+ // Handle navigation failures
+ RootFrame.NavigationFailed += RootFrame_NavigationFailed;
+
+ // Ensure we don't initialize again
+ phoneApplicationInitialized = true;
+ }
+
+ // Do not add any additional code to this method
+ private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
+ {
+ // Set the root visual to allow the application to render
+ if (RootVisual != RootFrame)
+ RootVisual = RootFrame;
+
+ // Remove this handler since it is no longer needed
+ RootFrame.Navigated -= CompleteInitializePhoneApplication;
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/Ajapaik/ApplicationIcon.png b/Ajapaik/ApplicationIcon.png
new file mode 100755
index 0000000..ce2989b
Binary files /dev/null and b/Ajapaik/ApplicationIcon.png differ
diff --git a/Ajapaik/Background.png b/Ajapaik/Background.png
new file mode 100755
index 0000000..63d7172
Binary files /dev/null and b/Ajapaik/Background.png differ
diff --git a/Ajapaik/Coding4Fun.Phone.Controls.Toolkit.dll b/Ajapaik/Coding4Fun.Phone.Controls.Toolkit.dll
new file mode 100755
index 0000000..5d8def0
Binary files /dev/null and b/Ajapaik/Coding4Fun.Phone.Controls.Toolkit.dll differ
diff --git a/Ajapaik/Coding4Fun.Phone.Controls.dll b/Ajapaik/Coding4Fun.Phone.Controls.dll
new file mode 100755
index 0000000..68b91d8
Binary files /dev/null and b/Ajapaik/Coding4Fun.Phone.Controls.dll differ
diff --git a/Ajapaik/ExifLib.dll b/Ajapaik/ExifLib.dll
new file mode 100755
index 0000000..bf50f52
Binary files /dev/null and b/Ajapaik/ExifLib.dll differ
diff --git a/Ajapaik/Hammock.WindowsPhone.Mango.dll b/Ajapaik/Hammock.WindowsPhone.Mango.dll
new file mode 100755
index 0000000..bfe5c70
Binary files /dev/null and b/Ajapaik/Hammock.WindowsPhone.Mango.dll differ
diff --git a/Ajapaik/Hammock.WindowsPhone.Mango.pdb b/Ajapaik/Hammock.WindowsPhone.Mango.pdb
new file mode 100755
index 0000000..a30e7f1
Binary files /dev/null and b/Ajapaik/Hammock.WindowsPhone.Mango.pdb differ
diff --git a/Ajapaik/Helpers/BooleanToVisibilityConverter.cs b/Ajapaik/Helpers/BooleanToVisibilityConverter.cs
new file mode 100755
index 0000000..b64edae
--- /dev/null
+++ b/Ajapaik/Helpers/BooleanToVisibilityConverter.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+
+namespace Ajapaik.Helpers
+{
+ ///
+ /// Converts a boolean value to a value,
+ /// and vice versa.
+ ///
+ public class BooleanToVisibilityConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType,
+ object parameter, CultureInfo culture)
+ {
+ string paramValue = (string)parameter;
+
+ if (value == null || (bool)value)
+ {
+ return paramValue == "Collapsed"
+ ? Visibility.Collapsed : Visibility.Visible;
+ }
+
+ return paramValue == "Collapsed"
+ ? Visibility.Visible : Visibility.Collapsed;
+ }
+
+ public object ConvertBack(object value, Type targetType,
+ object parameter, CultureInfo culture)
+ {
+ string paramValue = (string)parameter;
+ if (value == null || (Visibility)value == Visibility.Visible)
+ {
+ return paramValue != "Collapsed";
+ }
+
+ return paramValue == "Collapsed";
+ }
+ }
+}
\ No newline at end of file
diff --git a/Ajapaik/Helpers/JsonSerializer.cs b/Ajapaik/Helpers/JsonSerializer.cs
new file mode 100755
index 0000000..1702252
--- /dev/null
+++ b/Ajapaik/Helpers/JsonSerializer.cs
@@ -0,0 +1,42 @@
+using System.IO;
+using System.Runtime.Serialization.Json;
+
+namespace Ajapaik.Helpers
+{
+ public class JsonSerializer
+ {
+ public static string Serialize(T instance) where T : class
+ {
+ var serializer = new DataContractJsonSerializer(typeof(T));
+ using (var memoryStream = new MemoryStream())
+ {
+ serializer.WriteObject(memoryStream, instance);
+
+ memoryStream.Flush();
+ memoryStream.Position = 0;
+
+ using (var reader = new StreamReader(memoryStream))
+ {
+ return reader.ReadToEnd();
+ }
+ }
+ }
+
+ public static T Deserialize(string serialized) where T : class
+ {
+ var serializer = new DataContractJsonSerializer(typeof(T));
+ using (var memoryStream = new MemoryStream())
+ {
+ using (var writer = new StreamWriter(memoryStream))
+ {
+ writer.Write(serialized);
+ writer.Flush();
+
+ memoryStream.Position = 0;
+
+ return serializer.ReadObject(memoryStream) as T;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Ajapaik/Helpers/Multipart.cs b/Ajapaik/Helpers/Multipart.cs
new file mode 100755
index 0000000..bca7b73
--- /dev/null
+++ b/Ajapaik/Helpers/Multipart.cs
@@ -0,0 +1,107 @@
+using System;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Ink;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+using System.Collections.Generic;
+using System.IO;
+
+namespace Ajapaik.Helpers
+{
+ public class PostSubmitter
+ {
+ public string url { get; set; }
+ public Dictionary parameters { get; set; }
+ string boundary = "----------" + DateTime.Now.Ticks.ToString();
+ public event EventHandler theEvent;
+
+ public PostSubmitter() { }
+
+ public void Submit()
+ {
+ // Prepare web request...
+ HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(new Uri(url));
+ myRequest.Method = "POST";
+ myRequest.ContentType = string.Format("multipart/form-data; boundary={0}", boundary);
+
+ myRequest.BeginGetRequestStream(new AsyncCallback(GetRequestStreamCallback), myRequest);
+ }
+
+ private void GetRequestStreamCallback(IAsyncResult asynchronousResult)
+ {
+ HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState;
+ Stream postStream = request.EndGetRequestStream(asynchronousResult);
+
+ writeMultipartObject(postStream, parameters);
+ postStream.Close();
+
+ request.BeginGetResponse(new AsyncCallback(GetResponseCallback), request);
+ }
+
+ private void GetResponseCallback(IAsyncResult asynchronousResult)
+ {
+ HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState;
+ HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asynchronousResult);
+ Stream streamResponse = response.GetResponseStream();
+ StreamReader streamRead = new StreamReader(streamResponse);
+ streamResponse.Close();
+ streamRead.Close();
+ // Release the HttpWebResponse
+ response.Close();
+ theEvent.Invoke(this, null);
+ }
+
+
+ public void writeMultipartObject(Stream stream, object data)
+ {
+ StreamWriter writer = new StreamWriter(stream);
+ if (data != null)
+ {
+ foreach (var entry in data as Dictionary)
+ {
+ WriteEntry(writer, entry.Key, entry.Value);
+ }
+ }
+ writer.Write("--");
+ writer.Write(boundary);
+ writer.WriteLine("--");
+ writer.Flush();
+ }
+
+ private void WriteEntry(StreamWriter writer, string key, object value)
+ {
+ if (value != null)
+ {
+ writer.Write("--");
+ writer.WriteLine(boundary);
+ if (value is byte[])
+ {
+ byte[] ba = value as byte[];
+
+ writer.WriteLine(@"Content-Disposition: form-data; name=""{0}""; filename=""{1}""", key, "sentPhoto.jpg");
+ writer.WriteLine(@"Content-Type: application/octet-stream");
+ //writer.WriteLine(@"Content-Type: image / jpeg");
+ writer.WriteLine(@"Content-Length: " + ba.Length);
+ writer.WriteLine();
+ writer.Flush();
+ Stream output = writer.BaseStream;
+
+ output.Write(ba, 0, ba.Length);
+ output.Flush();
+ writer.WriteLine();
+ }
+ else
+ {
+ writer.WriteLine(@"Content-Disposition: form-data; name=""{0}""", key);
+ writer.WriteLine();
+ writer.WriteLine(value.ToString());
+ }
+ }
+ }
+ }
+}
diff --git a/Ajapaik/ICSharpCode.SharpZipLib.WindowsPhone.dll b/Ajapaik/ICSharpCode.SharpZipLib.WindowsPhone.dll
new file mode 100755
index 0000000..5a42b14
Binary files /dev/null and b/Ajapaik/ICSharpCode.SharpZipLib.WindowsPhone.dll differ
diff --git a/Ajapaik/ICSharpCode.SharpZipLib.WindowsPhone.pdb b/Ajapaik/ICSharpCode.SharpZipLib.WindowsPhone.pdb
new file mode 100755
index 0000000..7c1b6ed
Binary files /dev/null and b/Ajapaik/ICSharpCode.SharpZipLib.WindowsPhone.pdb differ
diff --git a/Ajapaik/Images/MapPin.png b/Ajapaik/Images/MapPin.png
new file mode 100755
index 0000000..cd3be73
Binary files /dev/null and b/Ajapaik/Images/MapPin.png differ
diff --git a/Ajapaik/Images/appbarCamera.png b/Ajapaik/Images/appbarCamera.png
new file mode 100755
index 0000000..8c61a4e
Binary files /dev/null and b/Ajapaik/Images/appbarCamera.png differ
diff --git a/Ajapaik/Images/appbarCancel.png b/Ajapaik/Images/appbarCancel.png
new file mode 100755
index 0000000..4dd724f
Binary files /dev/null and b/Ajapaik/Images/appbarCancel.png differ
diff --git a/Ajapaik/Images/appbarCheck.png b/Ajapaik/Images/appbarCheck.png
new file mode 100755
index 0000000..7a07466
Binary files /dev/null and b/Ajapaik/Images/appbarCheck.png differ
diff --git a/Ajapaik/Images/appbarLocation.png b/Ajapaik/Images/appbarLocation.png
new file mode 100755
index 0000000..89e872e
Binary files /dev/null and b/Ajapaik/Images/appbarLocation.png differ
diff --git a/Ajapaik/Images/appbarNumberlist.png b/Ajapaik/Images/appbarNumberlist.png
new file mode 100755
index 0000000..6e0cdd9
Binary files /dev/null and b/Ajapaik/Images/appbarNumberlist.png differ
diff --git a/Ajapaik/Images/appbarPin.png b/Ajapaik/Images/appbarPin.png
new file mode 100755
index 0000000..47d90e5
Binary files /dev/null and b/Ajapaik/Images/appbarPin.png differ
diff --git a/Ajapaik/Images/iconCamera.png b/Ajapaik/Images/iconCamera.png
new file mode 100755
index 0000000..e54fe71
Binary files /dev/null and b/Ajapaik/Images/iconCamera.png differ
diff --git a/Ajapaik/MainPage.xaml b/Ajapaik/MainPage.xaml
new file mode 100755
index 0000000..34c5eb9
--- /dev/null
+++ b/Ajapaik/MainPage.xaml
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Ajapaik/MainPage.xaml.cs b/Ajapaik/MainPage.xaml.cs
new file mode 100755
index 0000000..65d6273
--- /dev/null
+++ b/Ajapaik/MainPage.xaml.cs
@@ -0,0 +1,121 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+using Microsoft.Phone.Controls;
+using Ajapaik.Models;
+using Ajapaik.Helpers;
+using Microsoft.Phone.Controls.Maps;
+using System.Collections.ObjectModel;
+
+namespace Ajapaik
+{
+ public partial class MainPage : PhoneApplicationPage
+ {
+ private Pushpin currentPushpin;
+
+ //private methods
+ private void Button_Click(object sender, RoutedEventArgs e)
+ {
+ Button button = sender as Button;
+ App.Settings.SelectedPhoto = App.Settings.Photos.First(x => x.ID == (int)button.Tag);
+ NavigationService.Navigate(new Uri("/Views/PhotoInfoView.xaml", UriKind.Relative));
+ }
+
+ private void PushPin_Tap(object sender, RoutedEventArgs e)
+ {
+ Pushpin pushpin = sender as Pushpin;
+ App.Settings.SelectedPhoto = App.Settings.Photos.First(x => x.ID == (int)pushpin.Tag);
+
+ //NavigationService.Navigate(new Uri("/Views/PhotoInfoView.xaml", UriKind.Relative));
+ Border border = null;
+ if (currentPushpin != null)
+ {
+ border = (Border)currentPushpin.Content;
+ border.Visibility = Visibility.Collapsed;
+ }
+ //Pushpin pushpin = sender as Pushpin;
+ border = (Border)pushpin.Content;
+ border.Visibility = Visibility.Visible;
+ currentPushpin = pushpin;
+ //PhotoPushpin photoPushpin = Pushpins.First(x => x.ID == (int)pushpin.Tag);
+ //photoPushpin.Visibility = true;
+ //currentPhotoPushpin = photoPushpin;
+ }
+
+ private void LoadPhotos()
+ {
+ WebClient webClient = new WebClient();
+ //ProgressBar.IsIndeterminate = true;
+ webClient.DownloadStringCompleted += (s, e) =>
+ {
+ if (e.Error == null)
+ {
+ PhotosResponse response = JsonSerializer.Deserialize(e.Result);
+ List oldPhotos = response.Photos;
+ App.Settings.Photos = new ObservableCollection(oldPhotos);
+ Pushpins = new ObservableCollection();
+ foreach (Photo photo in oldPhotos)
+ {
+ Pushpins.Add(new PhotoPushpin(photo.ID,photo.Latitude,photo.Longitude, photo.ThumbnailURL, photo.Description));
+ }
+ CenterMap();
+ MapItems.ItemsSource = Pushpins;
+ //ProgressBar.IsIndeterminate = false;
+ }
+ };
+ webClient.DownloadStringAsync(new Uri(Settings.URI));
+ }
+
+ ///
+ /// Center map code.
+ ///
+ private void CenterMap()
+ {
+ if (Pushpins != null)
+ {
+ var locations = Pushpins.Select(model => model.Location);
+ LocationMap.SetView(LocationRect.CreateLocationRect(locations));
+ }
+ }
+
+ ///
+ /// List app bar button clicked
+ ///
+ private void OnListClick(object sender, EventArgs e)
+ {
+ NavigationService.Navigate(new Uri("/Views/PhotoListView.xaml", UriKind.Relative));
+ }
+
+ //protected methoods
+ ///
+ /// On navigated action
+ ///
+ protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
+ {
+ base.OnNavigatedTo(e);
+ CenterMap();
+ }
+
+ //public methods
+ public ObservableCollection Pushpins { get; set; }
+
+ // Constructor
+ public MainPage()
+ {
+ InitializeComponent();
+ LoadPhotos();
+ }
+
+ private void pushPin_Tap(object sender, System.Windows.Input.GestureEventArgs e)
+ {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/Ajapaik/Microsoft.Phone.Controls.Toolkit.dll b/Ajapaik/Microsoft.Phone.Controls.Toolkit.dll
new file mode 100755
index 0000000..7523aef
Binary files /dev/null and b/Ajapaik/Microsoft.Phone.Controls.Toolkit.dll differ
diff --git a/Ajapaik/Models/Photo.cs b/Ajapaik/Models/Photo.cs
new file mode 100755
index 0000000..83e16a3
--- /dev/null
+++ b/Ajapaik/Models/Photo.cs
@@ -0,0 +1,29 @@
+using System.Runtime.Serialization;
+
+namespace Ajapaik.Models
+{
+ [DataContract]
+ public class Photo
+ {
+ [DataMember(Name="id")]
+ public int ID { get; set; }
+
+ [DataMember(Name="lat")]
+ public double Latitude { get; set; }
+
+ [DataMember(Name="lon")]
+ public double Longitude { get; set; }
+
+ [DataMember(Name="city_id")]
+ public int CityID { get; set; }
+
+ [DataMember(Name="description")]
+ public string Description { get; set; }
+
+ [DataMember(Name="image_url")]
+ public string ImageURL { get; set; }
+
+ [DataMember(Name="image_thumb")]
+ public string ThumbnailURL { get; set; }
+ }
+}
diff --git a/Ajapaik/Models/PhotoPushpin.cs b/Ajapaik/Models/PhotoPushpin.cs
new file mode 100755
index 0000000..1c88b3a
--- /dev/null
+++ b/Ajapaik/Models/PhotoPushpin.cs
@@ -0,0 +1,59 @@
+using System.Device.Location;
+using System.ComponentModel;
+
+namespace Ajapaik.Models
+{
+ public class PhotoPushpin : INotifyPropertyChanged
+ {
+ private bool visibility;
+
+ #region protected methods
+ ///
+ /// Looks that property was changed.
+ ///
+ protected virtual void OnPropertyChanged (PropertyChangedEventArgs e)
+ {
+ var tempEvent = PropertyChanged;
+ if (tempEvent != null)
+ {
+ tempEvent(this, e);
+ }
+ }
+ #endregion
+
+ ///
+ /// Property change event.
+ ///
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ public int ID { get; set; }
+
+ public string Title { get; set; }
+
+ public GeoCoordinate Location { get; set; }
+
+ public string Thumbnail { get; set; }
+
+ public bool Visibility
+ {
+ get { return visibility; }
+ set
+ {
+ if(visibility != value)
+ {
+ visibility = value;
+ OnPropertyChanged(new PropertyChangedEventArgs("Visibility"));
+ }
+ }
+ }
+
+ public PhotoPushpin(int id, double latitude, double longitude, string thumbnail, string title)
+ {
+ this.ID = id;
+ this.Title = title;
+ this.Location = new GeoCoordinate(latitude, longitude);
+ this.Visibility = false;
+ this.Thumbnail = thumbnail;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Ajapaik/Models/PhotosResponse.cs b/Ajapaik/Models/PhotosResponse.cs
new file mode 100755
index 0000000..72c0619
--- /dev/null
+++ b/Ajapaik/Models/PhotosResponse.cs
@@ -0,0 +1,12 @@
+using System.Runtime.Serialization;
+using System.Collections.Generic;
+
+namespace Ajapaik.Models
+{
+ [DataContract]
+ public class PhotosResponse
+ {
+ [DataMember(Name="result")]
+ public List Photos { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Ajapaik/Properties/AppManifest.xml b/Ajapaik/Properties/AppManifest.xml
new file mode 100755
index 0000000..a955232
--- /dev/null
+++ b/Ajapaik/Properties/AppManifest.xml
@@ -0,0 +1,6 @@
+
+
+
+
diff --git a/Ajapaik/Properties/AssemblyInfo.cs b/Ajapaik/Properties/AssemblyInfo.cs
new file mode 100755
index 0000000..6d0425a
--- /dev/null
+++ b/Ajapaik/Properties/AssemblyInfo.cs
@@ -0,0 +1,37 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Resources;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Ajapaik")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Ajapaik")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("c3041dcb-4c22-4004-8c77-08ecf3e02708")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: NeutralResourcesLanguageAttribute("en-US")]
diff --git a/Ajapaik/Properties/WMAppManifest.xml b/Ajapaik/Properties/WMAppManifest.xml
new file mode 100755
index 0000000..3427b13
--- /dev/null
+++ b/Ajapaik/Properties/WMAppManifest.xml
@@ -0,0 +1,35 @@
+
+
+
+
+ ApplicationIcon.png
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Background.png
+ 0
+ Ajapaik
+
+
+
+
+
diff --git a/Ajapaik/Settings.cs b/Ajapaik/Settings.cs
new file mode 100755
index 0000000..bfed1dc
--- /dev/null
+++ b/Ajapaik/Settings.cs
@@ -0,0 +1,18 @@
+using Ajapaik.Models;
+using System.Collections.ObjectModel;
+using System.Windows.Media.Imaging;
+using System.IO;
+
+namespace Ajapaik
+{
+ public class Settings
+ {
+ public const string URI = "http://api.ajapaik.ee/?action=photo&city_id=2";
+
+ public Photo SelectedPhoto { get; set; }
+
+ public MemoryStream PhotoByUser { get; set; }
+
+ public ObservableCollection Photos { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Ajapaik/SplashScreenImage.jpg b/Ajapaik/SplashScreenImage.jpg
new file mode 100755
index 0000000..b87b739
Binary files /dev/null and b/Ajapaik/SplashScreenImage.jpg differ
diff --git a/Ajapaik/SubmissionInfo/ManualTestResults.xml b/Ajapaik/SubmissionInfo/ManualTestResults.xml
new file mode 100755
index 0000000..a7b9010
--- /dev/null
+++ b/Ajapaik/SubmissionInfo/ManualTestResults.xml
@@ -0,0 +1,54 @@
+
+
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+ Pending
+
+
\ No newline at end of file
diff --git a/Ajapaik/SubmissionInfo/Settings.xml b/Ajapaik/SubmissionInfo/Settings.xml
new file mode 100755
index 0000000..f140d85
--- /dev/null
+++ b/Ajapaik/SubmissionInfo/Settings.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+ ;;;;;;;;
+
\ No newline at end of file
diff --git a/Ajapaik/Views/AcceptPhotoView.xaml b/Ajapaik/Views/AcceptPhotoView.xaml
new file mode 100755
index 0000000..937d389
--- /dev/null
+++ b/Ajapaik/Views/AcceptPhotoView.xaml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Ajapaik/Views/AcceptPhotoView.xaml.cs b/Ajapaik/Views/AcceptPhotoView.xaml.cs
new file mode 100755
index 0000000..c2f0b15
--- /dev/null
+++ b/Ajapaik/Views/AcceptPhotoView.xaml.cs
@@ -0,0 +1,103 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+using Microsoft.Phone.Controls;
+using Ajapaik.Models;
+using System.Windows.Media.Imaging;
+using Hammock;
+using System.IO;
+using Hammock.Web;
+using System.Text;
+using Coding4Fun.Phone.Controls;
+using Ajapaik.Helpers;
+
+namespace Ajapaik.Views
+{
+ public partial class AcceptPhotoView : PhoneApplicationPage
+ {
+ private Photo oldPhoto;
+
+ #region private methods
+ private void PhotoPostCompleted(RestRequest request, RestResponse response, object userstate)
+ {
+ // We want to ensure we are running on our thread UI
+ Deployment.Current.Dispatcher.BeginInvoke(() =>
+ {
+ if (response.StatusCode == HttpStatusCode.Created)
+ {
+ Deployment.Current.Dispatcher.BeginInvoke(
+ () =>
+ {
+ ToastPrompt toast = new ToastPrompt
+ {
+ Title = "ajapaik",
+ Message = "your photo was uploaded",
+ };
+ toast.Show();
+ });
+ }
+ else
+ {
+ MessageBox.Show("Error while uploading to server. Please try again later. " +
+ "If this error persists please let the program author know.");
+ }
+ });
+ }
+
+ //private methods
+ private void OnOkClick(object sender, EventArgs e)
+ {
+ WebClient wc = new WebClient();
+
+ var picture = App.Settings.PhotoByUser;
+ Dictionary data = new Dictionary()
+ {
+ {"user_file[]", picture.ToArray() }
+ };
+ PostSubmitter post = new PostSubmitter() { url = "http://www.ajapaik.ee/foto/" + App.Settings.SelectedPhoto.ID + "/upload/", parameters = data };
+ post.theEvent += new EventHandler(post_theEvent);
+ post.Submit();
+
+ }
+
+ private void post_theEvent(object sender, EventArgs e)
+ {
+ Deployment.Current.Dispatcher.BeginInvoke(
+ () =>
+ {
+ ToastPrompt toast = new ToastPrompt
+ {
+ Title = "ajapaik",
+ Message = "your photo was uploaded",
+ };
+ toast.Show();
+ });
+ }
+
+
+ private void OnCancelClick(object sender, EventArgs e)
+ {
+ App.Settings.PhotoByUser = null;
+ NavigationService.GoBack();
+ }
+ #endregion
+
+ public AcceptPhotoView()
+ {
+ InitializeComponent();
+ oldPhoto = App.Settings.SelectedPhoto;
+ OldPhoto.Source = new BitmapImage(new Uri(oldPhoto.ImageURL));
+ BitmapImage bmp = new BitmapImage();
+ bmp.SetSource(App.Settings.PhotoByUser);
+ NewPhoto.Source = bmp;
+ }
+ }
+}
diff --git a/Ajapaik/Views/CameraWithOverlay.xaml b/Ajapaik/Views/CameraWithOverlay.xaml
new file mode 100755
index 0000000..b64e58d
--- /dev/null
+++ b/Ajapaik/Views/CameraWithOverlay.xaml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Ajapaik/Views/CameraWithOverlay.xaml.cs b/Ajapaik/Views/CameraWithOverlay.xaml.cs
new file mode 100755
index 0000000..135699c
--- /dev/null
+++ b/Ajapaik/Views/CameraWithOverlay.xaml.cs
@@ -0,0 +1,393 @@
+using System;
+using System.IO;
+using System.IO.IsolatedStorage;
+using System.Windows;
+using System.Windows.Media;
+using Microsoft.Devices;
+using Microsoft.Phone.Controls;
+using Microsoft.Xna.Framework.Media;
+using System.Windows.Media.Imaging;
+using Ajapaik.Models;
+using ExifLib;
+using System.Net;
+
+namespace Ajapaik.Views
+{
+ public partial class CameraWithOverlay : PhoneApplicationPage
+ {
+ // Variables
+ private int savedCounter = 0;
+ PhotoCamera cam;
+ MediaLibrary library = new MediaLibrary(); double initialScale = 1d;
+ // these two fully define the zoom state:
+ private double TotalImageScale = 1d;
+ private Point ImagePosition = new Point(0, 0);
+
+ private Point _oldFinger1;
+ private Point _oldFinger2;
+ private double _oldScaleFactor;
+ private double _angle;
+
+ private void OnPinchStarted(object s, PinchStartedGestureEventArgs e)
+ {
+ _oldFinger1 = e.GetPosition(MainImage, 0);
+ _oldFinger2 = e.GetPosition(MainImage, 1);
+ _oldScaleFactor = 1;
+ }
+
+ private void OnPinchDelta(object s, PinchGestureEventArgs e)
+ {
+ var scaleFactor = e.DistanceRatio / _oldScaleFactor;
+
+ var currentFinger1 = e.GetPosition(MainImage, 0);
+ var currentFinger2 = e.GetPosition(MainImage, 1);
+
+ var translationDelta = GetTranslationDelta(
+ currentFinger1,
+ currentFinger2,
+ _oldFinger1,
+ _oldFinger2,
+ ImagePosition,
+ scaleFactor);
+
+ _oldFinger1 = currentFinger1;
+ _oldFinger2 = currentFinger2;
+ _oldScaleFactor = e.DistanceRatio;
+
+ UpdateImage(scaleFactor, translationDelta);
+ }
+
+ private void UpdateImage(double scaleFactor, Point delta)
+ {
+
+ TotalImageScale *= scaleFactor;
+ if (TotalImageScale < 1)
+ {
+ TotalImageScale = 1;
+ return;
+ }
+
+ ImagePosition = new Point(ImagePosition.X + delta.X, ImagePosition.Y + delta.Y);
+
+ var transform = (CompositeTransform)MainImage.RenderTransform;
+ transform.ScaleX = TotalImageScale;
+ transform.ScaleY = TotalImageScale;
+ transform.TranslateX = ImagePosition.X;
+ transform.TranslateY = ImagePosition.Y;
+ }
+
+ private Point GetTranslationDelta(
+ Point currentFinger1, Point currentFinger2,
+ Point oldFinger1, Point oldFinger2,
+ Point currentPosition, double scaleFactor)
+ {
+ var newPos1 = new Point(
+ currentFinger1.X + (currentPosition.X - oldFinger1.X) * scaleFactor,
+ currentFinger1.Y + (currentPosition.Y - oldFinger1.Y) * scaleFactor);
+
+ var newPos2 = new Point(
+ currentFinger2.X + (currentPosition.X - oldFinger2.X) * scaleFactor,
+ currentFinger2.Y + (currentPosition.Y - oldFinger2.Y) * scaleFactor);
+
+ var newPos = new Point(
+ (newPos1.X + newPos2.X) / 2,
+ (newPos1.Y + newPos2.Y) / 2);
+
+ return new Point(
+ newPos.X - currentPosition.X,
+ newPos.Y - currentPosition.Y);
+ }
+ //region private methods
+
+ private void OnSliderValueChanged(object sender, RoutedPropertyChangedEventArgs args)
+ {
+ if (MainImage == null) return;
+ MainImage.Opacity = args.NewValue / 100;
+ }
+ // Update the UI if initialization succeeds.
+ private void cam_Initialized(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e)
+ {
+ if (e.Succeeded)
+ {
+ this.Dispatcher.BeginInvoke(delegate()
+ {
+ // Write message.
+ //txtDebug.Text = "Camera initialized.";
+ //isCameraInitialized = true;
+ });
+ }
+ }
+ private void cam_CaptureCompleted(object sender, CameraOperationCompletedEventArgs e)
+ {
+ // Increments the savedCounter variable used for generating JPEG file names.
+ savedCounter++;
+ }
+ private void OnTakePhotoClick(object sender, EventArgs e)
+ {
+ if (cam != null)
+ {
+ try
+ {
+ // Start image capture.
+ cam.CaptureImage();
+ }
+ catch (Exception ex)
+ {
+ this.Dispatcher.BeginInvoke(delegate()
+ {
+ // Cannot capture an image until the previous capture has completed.
+ //txtDebug.Text = ex.Message;
+ });
+ }
+ }
+ }
+ // Informs when full resolution picture has been taken, saves to local media library and isolated storage.
+ void cam_CaptureImageAvailable(object sender, Microsoft.Devices.ContentReadyEventArgs e)
+ {
+ string fileName = String.Format("Ajapaik_{0:yyyy-MM-dd_hh-mm-ss-tt}.jpg",
+ DateTime.Now);
+
+ try
+ {
+ // Save picture to the library camera roll.
+ library.SavePictureToCameraRoll(fileName, e.ImageStream);
+
+ // Set the position of the stream back to start
+ e.ImageStream.Seek(0, SeekOrigin.Begin);
+
+ // Save picture as JPEG to isolated storage.
+ App.Settings.PhotoByUser = new MemoryStream();
+ var targetStream = App.Settings.PhotoByUser;
+ // Initialize the buffer for 4KB disk pages.
+ byte[] readBuffer = new byte[4096];
+ int bytesRead = -1;
+
+ // Copy the image to isolated storage.
+ while ((bytesRead = e.ImageStream.Read(readBuffer, 0, readBuffer.Length)) > 0)
+ {
+ targetStream.Write(readBuffer, 0, bytesRead);
+ }
+
+ this.Dispatcher.BeginInvoke(delegate()
+ {
+ // Write message.
+ //txtDebug.Text = "Camera initialized.";
+ //isCameraInitialized = true;
+ NavigationService.Navigate(new Uri("/Views/AcceptPhotoView.xaml", UriKind.Relative));
+ });
+ }
+ finally
+ {
+ // Close image stream
+ e.ImageStream.Close();
+ }
+
+ }
+ // Informs when thumbnail picture has been taken, saves to isolated storage
+ // User will select this image in the pictures application to bring up the full-resolution picture.
+ public void cam_CaptureThumbnailAvailable(object sender, ContentReadyEventArgs e)
+ {
+ string fileName = savedCounter + "_th.jpg";
+
+ try
+ {
+ // Write message to UI thread.
+ Deployment.Current.Dispatcher.BeginInvoke(delegate()
+ {
+ // txtDebug.Text = "Captured image available, saving thumbnail.";
+ });
+
+ // Save thumbnail as JPEG to isolated storage.
+ using (IsolatedStorageFile isStore = IsolatedStorageFile.GetUserStoreForApplication())
+ {
+ using (IsolatedStorageFileStream targetStream = isStore.OpenFile(fileName, FileMode.Create, FileAccess.Write))
+ {
+ // Initialize the buffer for 4KB disk pages.
+ byte[] readBuffer = new byte[4096];
+ int bytesRead = -1;
+
+ // Copy the thumbnail to isolated storage.
+ while ((bytesRead = e.ImageStream.Read(readBuffer, 0, readBuffer.Length)) > 0)
+ {
+ targetStream.Write(readBuffer, 0, bytesRead);
+ }
+ }
+ }
+
+ // Write message to UI thread.
+ Deployment.Current.Dispatcher.BeginInvoke(delegate()
+ {
+ //txtDebug.Text = "Thumbnail has been saved to isolated storage.";
+
+ });
+ }
+ finally
+ {
+ // Close image stream
+ e.ImageStream.Close();
+ }
+ }
+ private void LoadPhoto()
+ {
+ Photo photo = App.Settings.SelectedPhoto;
+ WebClient wc = new WebClient();
+ wc.OpenReadAsync( new Uri(photo.ImageURL));
+ wc.OpenReadCompleted += new OpenReadCompletedEventHandler(wc_OpenReadCompleted);
+ }
+
+ void wc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
+ {
+ if (e.Error == null)
+ {
+ var stream = e.Result;
+ JpegInfo info = ExifReader.ReadJpeg(stream, "victory");
+
+
+ if (info.Height > info.Width)
+ {
+ stream = RotateStream(stream, 90);
+ }
+ Deployment.Current.Dispatcher.BeginInvoke(() =>
+ {
+ var bitmap = new BitmapImage();
+ bitmap.SetSource(stream);
+ MainImage.Source = bitmap;
+ });
+ }
+
+ }
+
+
+
+
+ //Code for initialization, capture completed, image availability events; also setting the source for the viewfinder.
+ protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
+ {
+ LoadPhoto();
+
+ // Check to see if the camera is available on the device.
+ if ((PhotoCamera.IsCameraTypeSupported(CameraType.Primary) == true) ||
+ (PhotoCamera.IsCameraTypeSupported(CameraType.FrontFacing) == true))
+ {
+ cam = new Microsoft.Devices.PhotoCamera(CameraType.Primary);
+
+ // Event is fired when the PhotoCamera object has been initialized.
+ cam.Initialized += new EventHandler(cam_Initialized);
+
+ // Event is fired when the capture sequence is complete.
+ cam.CaptureCompleted += new EventHandler(cam_CaptureCompleted);
+
+ // Event is fired when the capture sequence is complete and an image is available.
+ cam.CaptureImageAvailable += new EventHandler(cam_CaptureImageAvailable);
+
+ // Event is fired when the capture sequence is complete and a thumbnail image is available.
+ //cam.CaptureThumbnailAvailable += new EventHandler(cam_CaptureThumbnailAvailable);
+
+ //Set the VideoBrush source to the camera.
+ viewfinderBrush.SetSource(cam);
+ }
+ else
+ {
+ // The camera is not supported on the device.
+ this.Dispatcher.BeginInvoke(delegate()
+ {
+ // Write message.
+ // txtDebug.Text = "A Camera is not available on this device.";
+ });
+
+ // Disable UI.
+ //ShutterButton.IsEnabled = false;
+ }
+ }
+
+
+ private Stream RotateStream(Stream stream, int angle)
+ {
+ stream.Position = 0;
+ if (angle % 90 != 0 || angle < 0) throw new ArgumentException();
+ if (angle % 360 == 0) return stream;
+
+ BitmapImage bitmap = new BitmapImage();
+ bitmap.SetSource(stream);
+ WriteableBitmap wbSource = new WriteableBitmap(bitmap);
+
+ WriteableBitmap wbTarget = null;
+ if (angle % 180 == 0)
+ {
+ wbTarget = new WriteableBitmap(wbSource.PixelWidth, wbSource.PixelHeight);
+ }
+ else
+ {
+ wbTarget = new WriteableBitmap(wbSource.PixelHeight, wbSource.PixelWidth);
+ }
+
+ for (int x = 0; x < wbSource.PixelWidth; x++)
+ {
+ for (int y = 0; y < wbSource.PixelHeight; y++)
+ {
+ switch (angle % 360)
+ {
+ case 90:
+ wbTarget.Pixels[(wbSource.PixelHeight - y - 1) + x * wbTarget.PixelWidth] = wbSource.Pixels[x + y * wbSource.PixelWidth];
+ break;
+ case 180:
+ wbTarget.Pixels[(wbSource.PixelWidth - x - 1) + (wbSource.PixelHeight - y - 1) * wbSource.PixelWidth] = wbSource.Pixels[x + y * wbSource.PixelWidth];
+ break;
+ case 270:
+ wbTarget.Pixels[y + (wbSource.PixelWidth - x - 1) * wbTarget.PixelWidth] = wbSource.Pixels[x + y * wbSource.PixelWidth];
+ break;
+ }
+ }
+ }
+ MemoryStream targetStream = new MemoryStream();
+ wbTarget.SaveJpeg(targetStream, wbTarget.PixelWidth, wbTarget.PixelHeight, 0, 100);
+ return targetStream;
+ }
+
+ protected override void OnNavigatingFrom(System.Windows.Navigation.NavigatingCancelEventArgs e)
+ {
+ if (cam != null)
+ {
+ // Dispose camera to minimize power consumption and to expedite shutdown.
+ cam.Dispose();
+
+ // Release memory, ensure garbage collection.
+ cam.Initialized -= cam_Initialized;
+ cam.CaptureCompleted -= cam_CaptureCompleted;
+ cam.CaptureImageAvailable -= cam_CaptureImageAvailable;
+ //cam.CaptureThumbnailAvailable -= cam_CaptureThumbnailAvailable;
+ }
+ }
+
+ // Ensure that the viewfinder is upright in LandscapeRight.
+ protected override void OnOrientationChanged(OrientationChangedEventArgs e)
+ {
+ if (cam != null)
+ {
+ // LandscapeRight rotation when camera is on back of device.
+ int landscapeRightRotation = 180;
+
+ // Rotate video brush from camera.
+ if (e.Orientation == PageOrientation.LandscapeRight)
+ {
+ // Rotate for LandscapeRight orientation.
+ viewfinderBrush.RelativeTransform =
+ new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = landscapeRightRotation };
+ }
+ else
+ {
+ // Rotate for standard landscape orientation.
+ viewfinderBrush.RelativeTransform =
+ new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 0 };
+ }
+ }
+
+ base.OnOrientationChanged(e);
+ }
+
+ public CameraWithOverlay()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Ajapaik/Views/PhotoInfoView.xaml b/Ajapaik/Views/PhotoInfoView.xaml
new file mode 100755
index 0000000..700d956
--- /dev/null
+++ b/Ajapaik/Views/PhotoInfoView.xaml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Ajapaik/Views/PhotoInfoView.xaml.cs b/Ajapaik/Views/PhotoInfoView.xaml.cs
new file mode 100755
index 0000000..d84d463
--- /dev/null
+++ b/Ajapaik/Views/PhotoInfoView.xaml.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+using Microsoft.Phone.Controls;
+using System.Device.Location;
+using Ajapaik.Models;
+
+namespace Ajapaik.Views
+{
+ public partial class PhotoInfoView : PhoneApplicationPage
+ {
+ private Photo photo;
+
+ private void OnRephotoClick(object sender, EventArgs e)
+ {
+ NavigationService.Navigate(new Uri("/Views/CameraWithOverlay.xaml", UriKind.Relative));
+ }
+
+ public PhotoInfoView()
+ {
+ InitializeComponent();
+ photo = App.Settings.SelectedPhoto;
+ DataContext = photo;
+ GeoCoordinate center = new GeoCoordinate(photo.Latitude, photo.Longitude);
+ LocationMap.Center = center;
+ OldPhotoPushpin.Location = center;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Ajapaik/Views/PhotoListView.xaml b/Ajapaik/Views/PhotoListView.xaml
new file mode 100755
index 0000000..a80558f
--- /dev/null
+++ b/Ajapaik/Views/PhotoListView.xaml
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Ajapaik/Views/PhotoListView.xaml.cs b/Ajapaik/Views/PhotoListView.xaml.cs
new file mode 100755
index 0000000..44fe199
--- /dev/null
+++ b/Ajapaik/Views/PhotoListView.xaml.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+using Microsoft.Phone.Controls;
+using System.Collections.ObjectModel;
+using Ajapaik.Models;
+
+namespace Ajapaik.Views
+{
+ public partial class PhotoListView : PhoneApplicationPage
+ {
+
+ private void PhotoSelected(object sender, SelectionChangedEventArgs e)
+ {
+ // If selected index is -1 (no selection) do nothing
+ if (PhotoList.SelectedIndex == -1)
+ return;
+
+ App.Settings.SelectedPhoto = PhotoList.SelectedItem as Photo;
+
+ // Navigate to the new page
+ NavigationService.Navigate(new Uri("/Views/PhotoInfoView.xaml", UriKind.Relative));
+
+ // Reset selected index to -1 (no selection)
+ PhotoList.SelectedIndex = -1;
+ }
+
+ private void OnMapClick(object sender, EventArgs e)
+ {
+ NavigationService.GoBack();
+ }
+
+ protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
+ {
+ base.OnNavigatedTo(e);
+ PhotoList.ItemsSource = App.Settings.Photos;
+ }
+
+ public ObservableCollection Photos
+ {
+ get { return App.Settings.Photos; }
+ }
+
+ public PhotoListView()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file