Settings Page (in work)

Fixing Web hosting in Azure
This commit is contained in:
2011-03-30 02:25:27 +03:00
parent 84642c37ad
commit 833083ca0e
21 changed files with 414 additions and 105 deletions
@@ -7,16 +7,10 @@ namespace MyFriendsAround.Common.Entities
{
public partial class Friend
{
public virtual double Latitude
{
get;
set;
}
public virtual double Longitude
{
get;
set;
}
public virtual double Latitude { get; set; }
public virtual double Longitude { get; set; }
public virtual string PictureUrl { get; set; }
}
}
@@ -12,11 +12,16 @@ namespace MyFriendsAround.Data.BLL
public static class FriendsRepository
{
public static List<Friend> GetFriends()
{
{
return GetFriends(0, 50);
}
public static List<Friend> GetFriends(int skip, int take)
{
using (MyFriendsModelContainer ctx = new MyFriendsModelContainer())
{
ctx.ContextOptions.ProxyCreationEnabled = false;
List<Friend> list = ctx.Friends.ToList();
List<Friend> list = ctx.Friends.OrderByDescending(f=> f.LastUpdated).Skip(skip).Take(take).ToList();
list.ForEach((f) =>
{
SqlGeometry geom = SqlGeometry.Parse(f.LocationStr);
@@ -59,5 +64,12 @@ namespace MyFriendsAround.Data.BLL
return success;
}
}
public static bool UpdatePicture(string userId, byte[] userPicture)
{
return false;
}
}
}
@@ -47,6 +47,7 @@
<ItemGroup>
<Reference Include="Microsoft.SqlServer.Types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\Libs\Sql\Microsoft.SqlServer.Types.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
+5 -5
View File
@@ -89,21 +89,21 @@ namespace MyFriendsAround.WP7
{
Container.Instance.RegisterInstance<MainViewModel>(new MainViewModel(), "MainViewModel");
}
AboutViewModel aboutModel = this.RetrieveFromIsolatedStorage<AboutViewModel>();
if (aboutModel != null)
SettingsViewModel settingsModel = this.RetrieveFromIsolatedStorage<SettingsViewModel>();
if (settingsModel != null)
{
Container.Instance.RegisterInstance<AboutViewModel>(aboutModel, "AboutViewModel");
Container.Instance.RegisterInstance<SettingsViewModel>(settingsModel, "SettingsViewModel");
}
else
{
Container.Instance.RegisterInstance<AboutViewModel>(new AboutViewModel(), "AboutViewModel");
Container.Instance.RegisterInstance<SettingsViewModel>(new SettingsViewModel(), "SettingsViewModel");
}
}
private void SaveModel()
{
this.SaveToIsolatedStorage<MainViewModel>(Container.Instance.Resolve<MainViewModel>("MainViewModel"));
this.SaveToIsolatedStorage<AboutViewModel>(Container.Instance.Resolve<AboutViewModel>("AboutViewModel"));
this.SaveToIsolatedStorage<SettingsViewModel>(Container.Instance.Resolve<SettingsViewModel>("SettingsViewModel"));
}
@@ -141,11 +141,12 @@
<Compile Include="Helpers\Navigation\IPageNavigation.cs" />
<Compile Include="Helpers\Navigation\PageNavigation.cs" />
<Compile Include="Utils\ApplicationExtensions.cs" />
<Compile Include="Utils\IsolatedStorageHelper.cs" />
<Compile Include="Utils\LittleWatson.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Views\AboutPage.xaml.cs">
<DependentUpon>AboutPage.xaml</DependentUpon>
<Compile Include="Views\SettingsPage.xaml.cs">
<DependentUpon>SettingsPage.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ExceptionPrompt.cs">
<SubType>Code</SubType>
@@ -161,7 +162,7 @@
<Compile Include="Utils\Identification.cs" />
<Compile Include="Utils\SerializationHelper.cs" />
<Compile Include="ViewModel\Container.cs" />
<Compile Include="ViewModel\AboutViewModel.cs" />
<Compile Include="ViewModel\SettingsViewModel.cs" />
<Compile Include="ViewModel\MainViewModel.cs" />
<Compile Include="ViewModel\PushPinModel.cs" />
<Compile Include="ViewModel\ViewModelBase.cs" />
@@ -176,7 +177,7 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\AboutPage.xaml">
<Page Include="Views\SettingsPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
@@ -197,6 +198,12 @@
<Content Include="Background.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="icons\anonymousIcon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="icons\appbar.feature.settings.rest.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="icons\appbar.publish.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
@@ -0,0 +1,55 @@
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.IO;
using System.IO.IsolatedStorage;
using Microsoft.Phone;
using System.Windows.Media.Imaging;
namespace MyFriendsAround.WP7.Utils
{
public class IsolatedStorageHelper
{
public static void SaveToLocalStorage(string imageFileName, string imageFolder, byte[] content)
{
if (content == null)
{
return;
}
var isoFile = IsolatedStorageFile.GetUserStoreForApplication();
if (!isoFile.DirectoryExists(imageFolder))
{
isoFile.CreateDirectory(imageFolder);
}
string filePath = Path.Combine(imageFolder, imageFileName);
using (var stream = isoFile.CreateFile(filePath))
{
stream.Write(content, 0, content.Length);
}
}
public static WriteableBitmap LoadFromLocalStorage(string imageFileName, string imageFolder)
{
var isoFile = IsolatedStorageFile.GetUserStoreForApplication();
if (!isoFile.DirectoryExists(imageFolder))
{
isoFile.CreateDirectory(imageFolder);
}
string filePath = Path.Combine(imageFolder, imageFileName);
using (var imageStream = isoFile.OpenFile(filePath, FileMode.Open, FileAccess.Read))
{
var imageSource = PictureDecoder.DecodeJpeg(imageStream);
return imageSource;
}
}
}
}
@@ -2,17 +2,23 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Device.Location;
using System.IO;
using System.Net;
using System.Security;
using System.ServiceModel.Channels;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Coding4Fun.Phone.Controls;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.Messaging;
using GalaSoft.MvvmLight.Threading;
using Hammock;
using Hammock.Serialization;
using Microsoft.Phone;
using Microsoft.Phone.Controls;
using Microsoft.Silverlight.Testing;
using MyFriendsAround.Common.Entities;
@@ -20,6 +26,7 @@ using MyFriendsAround.WP7.Service;
using MyFriendsAround.WP7.Utils;
using MyFriendsAround.WP7.Views;
using Newtonsoft.Json;
using Microsoft.Phone.Tasks;
namespace MyFriendsAround.WP7.ViewModel
{
@@ -53,6 +60,14 @@ namespace MyFriendsAround.WP7.ViewModel
}
}
public string PageNameSettings
{
get
{
return "Settings";
}
}
/// <summary>
/// Initializes a new instance of the MainViewModel class.
/// </summary>
@@ -61,8 +76,12 @@ namespace MyFriendsAround.WP7.ViewModel
//
PublishLocationCommand = new RelayCommand(() => PublishLocationAction());
DisplayAboutCommand = new RelayCommand(() => DisplayAbout());
NavigateToAboutCommand = new RelayCommand(() => NavigateToAbout());
NavigateToSettingsCommand = new RelayCommand(() => NavigateToSettings());
RefreshFriendsCommand = new RelayCommand(() => RefreshFriends());
ShowAboutCommand = new RelayCommand(() => ShowAbout());
SaveMySettingsCommand = new RelayCommand(() => SaveMySettings());
CancelMySettingsCommand = new RelayCommand(() => CancelMySettings());
ChoosePhotoCommand = new RelayCommand(() => ChoosePhoto());
if (IsInDesignMode)
{
@@ -75,16 +94,115 @@ namespace MyFriendsAround.WP7.ViewModel
}
private void ChoosePhoto()
{
//choose photo
ShowCameraCaptureTask();
//ShowPhotoChooserTask();
}
private void ShowPhotoChooserTask()
{
var photoChooserTask = new PhotoChooserTask();
photoChooserTask.Completed += cameraTask_Completed;
photoChooserTask.Show();
}
private void ShowCameraCaptureTask()
{
var cameraTask = new CameraCaptureTask();
cameraTask.Completed += cameraTask_Completed;
cameraTask.Show();
}
private void cameraTask_Completed(object sender, PhotoResult e)
{
if (e.TaskResult == TaskResult.OK)
{
// Get the image temp file from e.OriginalFileName.
// Get the image temp stream from e.ChosenPhoto.
// Don't keep either the stream or rely on the temp
// file name as they may be vanished!
// Store the image bytes.
byte[] _imageBytes = new byte[e.ChosenPhoto.Length];
e.ChosenPhoto.Read(_imageBytes, 0, _imageBytes.Length);
// Seek back so we can create an image.
e.ChosenPhoto.Seek(0, SeekOrigin.Begin);
// Create an image from the stream.
var imageSource = PictureDecoder.DecodeJpeg(e.ChosenPhoto);
MyPicture = imageSource;
}
}
/// <summary>
/// The <see cref="MyPicture" /> property's name.
/// </summary>
public const string MyPicturePropertyName = "MyPicture";
private BitmapSource _myPicture = new BitmapImage(new Uri("/icons/anonymousIcon.png", UriKind.RelativeOrAbsolute));
/// <summary>
/// Gets the MyPicture property.
/// </summary>
public BitmapSource MyPicture
{
get
{
return _myPicture;
}
set
{
if (_myPicture == value)
{
return;
}
var oldValue = _myPicture;
_myPicture = value;
// Update bindings, no broadcast
RaisePropertyChanged(MyPicturePropertyName);
// Update bindings and broadcast change using GalaSoft.MvvmLight.Messenging
RaisePropertyChanged(MyPicturePropertyName, oldValue, value, true);
}
}
private void CancelMySettings()
{
//navigate back
this.PageNav.GoBack();
}
private void SaveMySettings()
{
//save settings locally and on the server
}
private void ShowAbout()
{
//
var aboutPrompt = new AboutPrompt();
aboutPrompt.Title = "About";
aboutPrompt.Body = Environment.NewLine + "Created by Claudiu Farcas" + Environment.NewLine + Environment.NewLine + "@claudiufarcas" + Environment.NewLine + Environment.NewLine + "Please visit" + Environment.NewLine + Environment.NewLine + "http://www.vorienteering.com";
aboutPrompt.VersionNumber = "1.0";
aboutPrompt.Show();
}
private void RefreshFriends()
{
IsBusy = true;
ServiceAgent.GetFriends(this.GetFriendsResult);
}
private void NavigateToAbout()
private void NavigateToSettings()
{
//
this.PageNav.NavigateTo(new Uri("/Views/AboutPage.xaml", UriKind.Relative));
this.PageNav.NavigateTo(new Uri("/Views/SettingsPage.xaml", UriKind.Relative));
}
@@ -193,8 +311,13 @@ namespace MyFriendsAround.WP7.ViewModel
public ICommand PublishLocationCommand { get; set; }
public ICommand DisplayAboutCommand { get; set; }
public ICommand NavigateToAboutCommand { get; set; }
public ICommand NavigateToSettingsCommand { get; set; }
public ICommand RefreshFriendsCommand { get; set; }
public ICommand ShowAboutCommand { get; set; }
public ICommand SaveMySettingsCommand { get; set; }
public ICommand CancelMySettingsCommand { get; set; }
public ICommand ChoosePhotoCommand { get; set; }
/// <summary>
@@ -228,6 +351,11 @@ namespace MyFriendsAround.WP7.ViewModel
get { return "About"; }
}
public string AppBarTextSettings
{
get { return "Settings"; }
}
public string AppBarTextPublish
{
get { return "Publish"; }
@@ -238,6 +366,18 @@ namespace MyFriendsAround.WP7.ViewModel
get { return "Refresh"; }
}
public string AppBarTextSaveSettings
{
get { return "Save"; }
}
public string AppBarTextCancelSettings
{
get { return "Cancel"; }
}
////public override void Cleanup()
////{
//// // Clean up if needed
@@ -21,7 +21,7 @@ using Newtonsoft.Json;
namespace MyFriendsAround.WP7.ViewModel
{
public class AboutViewModel : ViewModelBase
public class SettingsViewModel : ViewModelBase
{
public string ApplicationTitle
{
@@ -43,7 +43,7 @@ namespace MyFriendsAround.WP7.ViewModel
/// <summary>
/// Initializes a new instance of the MainViewModel class.
/// </summary>
public AboutViewModel()
public SettingsViewModel()
{
if (IsInDesignMode)
{
@@ -91,11 +91,11 @@ namespace MyFriendsAround.WP7.ViewModel
/// <summary>
/// Gets the About property.
/// </summary>
public AboutViewModel About
public SettingsViewModel Settings
{
get
{
AboutViewModel aboutViewModel = GetViewModel<AboutViewModel>("AboutViewModel");
SettingsViewModel aboutViewModel = GetViewModel<SettingsViewModel>("SettingsViewModel");
return aboutViewModel;
}
}
@@ -108,7 +108,7 @@ namespace MyFriendsAround.WP7.ViewModel
{
MainViewModel mainViewModel = GetViewModel<MainViewModel>("MainViewModel");
mainViewModel.Cleanup();
AboutViewModel aboutViewModel = GetViewModel<AboutViewModel>("AboutViewModel");
SettingsViewModel aboutViewModel = GetViewModel<SettingsViewModel>("SettingsViewModel");
aboutViewModel.Cleanup();
}
@@ -1,35 +0,0 @@
<phone:PhoneApplicationPage
x:Class="MyFriendsAround.WP7.Views.AboutPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
DataContext="{Binding About, Source={StaticResource Locator}}"
mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
shell:SystemTray.IsVisible="True">
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ApplicationTitle" Text="{Binding Path=ApplicationTitle}" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="{Binding Path=PageName}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"></Grid>
</Grid>
</phone:PhoneApplicationPage>
+58 -33
View File
@@ -51,23 +51,12 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel"
Grid.Row="0"
Margin="24,24,0,12">
<TextBlock x:Name="ApplicationTitle"
Text="{Binding ApplicationTitle}"
Style="{StaticResource PhoneTextNormalStyle}" />
<TextBlock x:Name="PageTitle"
Text="{Binding PageName}"
Margin="-3,-8,0,0"
Style="{StaticResource PhoneTextTitle1Style}" />
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentGrid"
Grid.Row="1"
Margin="0,0,0,70">
Grid.Row="0" VerticalAlignment="Stretch"
Grid.RowSpan="2"
Margin="0">
<!--<Button Content="Publish"
HorizontalAlignment="Left" Margin="6,0,0,6" Name="btnPublishLocation"
@@ -81,20 +70,10 @@
</i:Interaction.Triggers>
</Button>-->
<TextBox Height="67"
HorizontalAlignment="Left"
Margin="6,0,0,6"
Name="txtMyName"
Text="{Binding Path=MyName, Mode=TwoWay}"
VerticalAlignment="Bottom"
Width="468"
binding:TextBoxBinding.UpdateSourceOnChange="True" />
<my:Map x:Name="map"
Height="468"
HorizontalAlignment="Left"
Margin="6,0,0,0"
VerticalAlignment="Top"
Width="468"
HorizontalAlignment="Stretch"
Margin="6,0,6,0"
VerticalAlignment="Stretch"
Center="{Binding Path=MapCenter, Mode=TwoWay}">
<my:MapItemsControl ItemsSource="{Binding PushPins}">
<my:MapItemsControl.ItemTemplate>
@@ -116,21 +95,67 @@
IsIndeterminate="{Binding Path=IsBusy}" />
</Grid>
<!--TitlePanel contains the name of the application and page title-->
<Grid x:Name="TitlePanel"
Grid.Row="0"
Margin="0"
Background="Black"
VerticalAlignment="Top"
HorizontalAlignment="Stretch"
Opacity="0.8">
<TextBlock x:Name="ApplicationTitle"
Margin="12, 12, 0, 0"
Text="{Binding ApplicationTitle}"
Foreground="#00fffc"
Style="{StaticResource PhoneTextNormalStyle}" />
<Grid Margin="0,6,6,6"
Height="80">
<Grid Width="80"
Height="80"
HorizontalAlignment="Right"
Background="Transparent"
Opacity="1"
>
<Image x:Name="imgMine"
Source="{Binding MyPicture}">
</Image>
<Border Background="#00fffc"
Width="80"
Height="25"
HorizontalAlignment="Stretch"
VerticalAlignment="Bottom"
BorderThickness="0">
<TextBlock x:Name="txtMyName"
Style="{StaticResource PhoneTextNormalStyle}"
FontSize="16"
Foreground="Black"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="2"
Text="{Binding MyName}" />
</Border>
</Grid>
</Grid>
</Grid>
<Preview:BindableApplicationBar x:Name="AppBar"
BarOpacity="0.5">
BarOpacity="0.8">
<Preview:BindableApplicationBarIconButton Command="{Binding RefreshFriendsCommand}"
IconUri="/icons/appbar.sync.rest.png"
Text="{Binding AppBarTextRefresh}" IsEnabled="{Binding Path=IsBusy, Converter={StaticResource InvertValueConverter1}}" />
<Preview:BindableApplicationBarIconButton Command="{Binding PublishLocationCommand}"
IconUri="/icons/appbar.publish.png"
Text="{Binding AppBarTextPublish}" />
<Preview:BindableApplicationBarIconButton Command="{Binding NavigateToAboutCommand}"
IconUri="/icons/appbar.questionmark.rest.png"
Text="{Binding AppBarTextAbout}" />
<Preview:BindableApplicationBarIconButton Command="{Binding NavigateToSettingsCommand}"
IconUri="/icons/appbar.feature.settings.rest.png"
Text="{Binding AppBarTextSettings}" />
<Preview:BindableApplicationBar.MenuItems>
<Preview:BindableApplicationBarMenuItem Text="Settings"
Command="{Binding InputBoxCommand}" />
<Preview:BindableApplicationBarMenuItem Text="{Binding AppBarTextAbout}"
Command="{Binding ShowAboutCommand}" />
</Preview:BindableApplicationBar.MenuItems>
</Preview:BindableApplicationBar>
</Grid>
@@ -0,0 +1,83 @@
<phone:PhoneApplicationPage
x:Class="MyFriendsAround.WP7.Views.SettingsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:binding="clr-namespace:Coding4Fun.Phone.Controls.Binding;assembly=Coding4Fun.Phone.Controls" xmlns:Preview="clr-namespace:Phone7.Fx.Preview;assembly=Phone7.Fx.Preview" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP7" FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
DataContext="{Binding Main, Source={StaticResource Locator}}"
mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
shell:SystemTray.IsVisible="True">
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ApplicationTitle" Text="{Binding Path=ApplicationTitle}" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle"
Text="{Binding Path=PageNameSettings}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<StackPanel
Orientation="Vertical"
Margin="6,0,0,6"
>
<TextBlock Text="My Name"
Style="{StaticResource PhoneTextTitle3Style}" />
<TextBox Height="67"
HorizontalAlignment="Stretch"
Name="txtMyName"
Text="{Binding Path=MyName, Mode=TwoWay}"
VerticalAlignment="Top"
binding:TextBoxBinding.UpdateSourceOnChange="True" />
<TextBlock Text="My Picture"
Style="{StaticResource PhoneTextTitle3Style}" />
<Button x:Name="btnChoosePhoto"
Margin="0, 24, 0, 24"
Width="200"
Height="200"
Background="#00fffc"
BorderThickness="0"
Padding="0"
>
<Image x:Name="myPicture"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Margin="3"
Source="{Binding MyPicture}"></Image>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<cmd:EventToCommand
Command="{Binding ChoosePhotoCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</StackPanel>
</Grid>
<Preview:BindableApplicationBar x:Name="AppBar"
BarOpacity="0.8">
<Preview:BindableApplicationBarIconButton Command="{Binding SaveMySettingsCommand}"
IconUri="/Toolkit.Content/ApplicationBar.Check.png"
Text="{Binding AppBarTextSaveSettings}"
IsEnabled="{Binding Path=IsBusy, Converter={StaticResource InvertValueConverter1}}" />
<Preview:BindableApplicationBarIconButton Command="{Binding CancelMySettingsCommand}"
IconUri="/Toolkit.Content/ApplicationBar.Cancel.png"
Text="{Binding AppBarTextCancelSettings}" />
</Preview:BindableApplicationBar>
</Grid>
</phone:PhoneApplicationPage>
@@ -13,9 +13,9 @@ using Microsoft.Phone.Controls;
namespace MyFriendsAround.WP7.Views
{
public partial class AboutPage : PhoneApplicationPage
public partial class SettingsPage : PhoneApplicationPage
{
public AboutPage()
public SettingsPage()
{
InitializeComponent();
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

@@ -8,7 +8,7 @@ using MyFriendsAround.Data.BLL;
namespace MyFriendsAround.Web.Controllers
{
[HandleError]
//[HandleError]
public class HomeController : Controller
{
public ActionResult Index()
@@ -52,6 +52,10 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.SqlServer.Types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\Libs\Sql\Microsoft.SqlServer.Types.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Data.Entity" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
@@ -99,7 +103,9 @@
<Content Include="myfriends.svc" />
<Content Include="Scripts\GoogleMapping.js" />
<Content Include="Scripts\GoogleMapping.min.js" />
<Content Include="Web.config" />
<Content Include="Web.config">
<SubType>Designer</SubType>
</Content>
<Content Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
@@ -11,7 +11,7 @@
<div id="header">
<div id="title">
<h1>My Friend Around</h1>
<h1>My Friends Around</h1>
</div>
<div id="logindisplay">
+6 -1
View File
@@ -8,12 +8,14 @@
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|myfriendsaround.mdf;User Instance=true" providerName="System.Data.SqlClient" />
<!--<add name="myfriendsaroundConnectionString" connectionString="Data Source=ewzculop8c.database.windows.net;Initial Catalog=myfriendsaround;User ID=user;Password=password" providerName="System.Data.SqlClient" />-->
<add name="MyFriendsModelContainer" connectionString="metadata=res://*/MyFriendsModel.csdl|res://*/MyFriendsModel.ssdl|res://*/MyFriendsModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=ewzculop8c.database.windows.net;initial catalog=myfriendsaround;user id=user;password=password;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
<add name="MyFriendsModelContainer"
connectionString="metadata=res://*/MyFriendsModel.csdl|res://*/MyFriendsModel.ssdl|res://*/MyFriendsModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Server=ewzculop8c.database.windows.net;Database=myfriendsaround;User ID=[USER]@ewzculop8c;Password=[PASSWORD];Trusted_Connection=False;Encrypt=True&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>
<appSettings>
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="takeTopFriends" value="20" />
</appSettings>
<system.web>
@@ -64,6 +66,9 @@
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
<!--show detailed error-->
<customErrors mode="Off" />
</system.web>
<system.webServer>
+16
View File
@@ -11,6 +11,7 @@ using System.Text;
using MyFriendsAround.Common.Entities;
using MyFriendsAround.Data;
using MyFriendsAround.Data.BLL;
using System.Web.Configuration;
namespace MyFriendsAround.Web
{
@@ -27,6 +28,14 @@ namespace MyFriendsAround.Web
return FriendsRepository.GetFriends();
}
[OperationContract]
[WebGet(ResponseFormat = WebMessageFormat.Json)]
public List<Friend> GetFriends(int skip)
{
int take = Convert.ToInt32(WebConfigurationManager.AppSettings["takeTopFriends"]);
return FriendsRepository.GetFriends(skip, take);
}
[OperationContract]
[WebInvoke(ResponseFormat = WebMessageFormat.Json, Method = "POST")]
@@ -34,6 +43,13 @@ namespace MyFriendsAround.Web
{
return FriendsRepository.PublishLocation(friend);
}
[OperationContract]
[WebInvoke(ResponseFormat = WebMessageFormat.Json, Method = "POST")]
public bool UpdatePicture(string userId, byte[] userPicture)
{
return FriendsRepository.UpdatePicture(userId, userPicture);
}
}
}
@@ -3,7 +3,7 @@
<Role name="MyFriendsAround.Web">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=myfriendsaround;AccountKey=q6VfarAitAElTN+u0GD/F3kS3f+CGFdNNoJnZltTbFJnv7VEDZHwWX99JG6ZEUzQNjtdL9uLg8uske+ls8/uPg==" />
</ConfigurationSettings>
</Role>
</ServiceConfiguration>