mirror of
https://github.com/farcasclaudiu/myfriendsaround.git
synced 2026-06-29 13:02:05 +03:00
offline images
friends list / select friend distance
This commit is contained in:
@@ -17,6 +17,7 @@ using Microsoft.Phone.Tasks;
|
||||
using MyFriendsAround.WP7.Utils;
|
||||
using MyFriendsAround.WP7.ViewModel;
|
||||
using NetworkDetection;
|
||||
using System.Threading;
|
||||
|
||||
namespace MyFriendsAround.WP7.Views
|
||||
{
|
||||
@@ -53,7 +54,7 @@ namespace MyFriendsAround.WP7.Views
|
||||
|
||||
private void NavigateBack()
|
||||
{
|
||||
Container.Instance.Resolve<MainViewModel>("MainViewModel").CropCancel();
|
||||
Container.Instance.Resolve<MainViewModel>(Constants.VM_MAIN).CropCancel();
|
||||
}
|
||||
|
||||
void task_Completed(object sender, PhotoResult e)
|
||||
@@ -158,12 +159,7 @@ namespace MyFriendsAround.WP7.Views
|
||||
byte[] _imageBytes = new byte[stream.Length];
|
||||
stream.Read(_imageBytes, 0, _imageBytes.Length);
|
||||
//save
|
||||
IsolatedStorageHelper.SaveToLocalStorage("myphoto.jpg", "profiles", _imageBytes);
|
||||
//
|
||||
//BitmapImage bi = new BitmapImage();
|
||||
//stream.Seek(0, SeekOrigin.Begin);
|
||||
//bi.SetSource(stream);
|
||||
Container.Instance.Resolve<MainViewModel>("MainViewModel").MyPicture = wbm;
|
||||
IsolatedStorageHelper.SaveToLocalStorage(Constants.MYPICTURE_FILE_NAME, "profiles", _imageBytes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,14 +18,17 @@
|
||||
d:DesignHeight="768"
|
||||
shell:SystemTray.IsVisible="True"
|
||||
DataContext="{Binding Main, Source={StaticResource Locator}}"
|
||||
d:DataContext="{Binding Main, Source={StaticResource Locator}}"
|
||||
xmlns:my="clr-namespace:Microsoft.Phone.Controls.Maps;assembly=Microsoft.Phone.Controls.Maps"
|
||||
xmlns:Preview="clr-namespace:Phone7.Fx.Preview;assembly=Phone7.Fx.Preview"
|
||||
xmlns:binding="clr-namespace:Coding4Fun.Phone.Controls.Binding;assembly=Coding4Fun.Phone.Controls"
|
||||
xmlns:Core="clr-namespace:Microsoft.Phone.Controls.Maps.Core;assembly=Microsoft.Phone.Controls.Maps">
|
||||
xmlns:Core="clr-namespace:Microsoft.Phone.Controls.Maps.Core;assembly=Microsoft.Phone.Controls.Maps"
|
||||
xmlns:conv="clr-namespace:MyFriendsAround.WP7.Helpers.Converters">
|
||||
|
||||
<!--LayoutRoot contains the root grid where all other page content is placed-->
|
||||
|
||||
<phone:PhoneApplicationPage.Resources>
|
||||
<conv:MyImageConverter x:Key="myImageConverter" />
|
||||
<ControlTemplate x:Key="PushpinControlTemplate1"
|
||||
TargetType="my:Pushpin">
|
||||
<Grid Height="24"
|
||||
@@ -44,7 +47,7 @@
|
||||
<Grid Background="{TemplateBinding Background}"
|
||||
HorizontalAlignment="Left">
|
||||
<Image x:Name="imgFriend"
|
||||
Source="{Binding PinImageUrl, Mode=OneWay}"
|
||||
Source="{Binding PinImageUrl, Mode=OneWay, Converter={StaticResource imageCacheConverter}}"
|
||||
Margin="2, 2, 2, 24"
|
||||
Width="48"
|
||||
Height="48"
|
||||
@@ -98,22 +101,9 @@
|
||||
Grid.RowSpan="2"
|
||||
Margin="0">
|
||||
|
||||
<!--<Button Content="Publish"
|
||||
HorizontalAlignment="Left" Margin="6,0,0,6" Name="btnPublishLocation"
|
||||
Width="468"
|
||||
Height="72"
|
||||
VerticalAlignment="Bottom">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<cmd:EventToCommand Command="{Binding PublishLocationCommand}"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Button>-->
|
||||
|
||||
<my:Map x:Name="map"
|
||||
CredentialsProvider="AkCiPfQt9YM0cCkZlltdR3mnFQRkV41l4f-eXFmf3qcBBhBC-EkvD8MuazOkMnE_"
|
||||
HorizontalAlignment="Stretch"
|
||||
ZoomBarVisibility="Visible"
|
||||
Margin="6,0,6,0"
|
||||
VerticalAlignment="Stretch"
|
||||
Center="{Binding Path=MapCenter, Mode=TwoWay}"
|
||||
@@ -151,24 +141,36 @@
|
||||
|
||||
<StackPanel HorizontalAlignment="Left"
|
||||
VerticalAlignment="Stretch">
|
||||
<Image Source="/icons/appbar.add.rest.png"
|
||||
Margin="0"
|
||||
Width="64"
|
||||
Height="64"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Left">
|
||||
<Image Source="/icons/appbar.add.rest.png"
|
||||
Margin="0"
|
||||
Width="64"
|
||||
Height="64"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Left">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="MouseLeftButtonDown">
|
||||
<cmd:EventToCommand Command="{Binding MapZoomOutCommand}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Image>
|
||||
<Image Source="/icons/appbar.minus.rest.png"
|
||||
Margin="0"
|
||||
Width="64"
|
||||
Height="64"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Left">
|
||||
<Slider Orientation="Vertical"
|
||||
Minimum="1"
|
||||
Maximum="22"
|
||||
Value="{Binding MapZoom, Mode=TwoWay}"
|
||||
Height="300">
|
||||
<!--<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="ValueChanged">
|
||||
<cmd:EventToCommand Command="{Binding MapZoomChangedCommand}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>-->
|
||||
</Slider>
|
||||
|
||||
<Image Source="/icons/appbar.minus.rest.png"
|
||||
Margin="0"
|
||||
Width="64"
|
||||
Height="64"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Left">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="MouseLeftButtonDown">
|
||||
<cmd:EventToCommand Command="{Binding MapZoomInCommand}" />
|
||||
@@ -186,10 +188,12 @@
|
||||
<Grid x:Name="TitlePanel"
|
||||
Grid.Row="0"
|
||||
Margin="0"
|
||||
Background="Black"
|
||||
Background="Transparent"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Stretch"
|
||||
Opacity="0.8">
|
||||
Opacity="1">
|
||||
<Rectangle Fill="Black"
|
||||
Opacity="0.7"></Rectangle>
|
||||
<TextBlock x:Name="ApplicationTitle"
|
||||
Margin="12, 12, 0, 0"
|
||||
Text="{Binding ApplicationTitle}"
|
||||
@@ -200,13 +204,18 @@
|
||||
<Grid Width="80"
|
||||
Height="80"
|
||||
HorizontalAlignment="Right"
|
||||
Background="Transparent"
|
||||
Background="{StaticResource PhoneAccentBrush}"
|
||||
Opacity="1">
|
||||
<Image x:Name="imgMine"
|
||||
Opacity="1"
|
||||
Source="{Binding MyPicture, Mode=OneWay}"
|
||||
Margin="0"
|
||||
Source="{Binding SelectedFriend, Path=SelectedFriend.PinImageUrl, Converter={StaticResource imageCacheConverter}}"
|
||||
Margin="1"
|
||||
Stretch="Fill">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="MouseLeftButtonDown">
|
||||
<cmd:EventToCommand Command="{Binding ShowSelectFriendCommand}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Image>
|
||||
<Border Background="{StaticResource PhoneAccentBrush}"
|
||||
Width="80"
|
||||
@@ -222,7 +231,7 @@
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Margin="2"
|
||||
Text="{Binding MyName, Mode=OneWay}"
|
||||
Text="{Binding SelectedFriend, Path=SelectedFriend.PinUserName}"
|
||||
Opacity="1" />
|
||||
</Border>
|
||||
</Grid>
|
||||
@@ -239,19 +248,87 @@
|
||||
|
||||
</Grid>
|
||||
|
||||
<Grid Background="Transparent"
|
||||
VerticalAlignment="Stretch"
|
||||
Grid.RowSpan="2"
|
||||
Visibility="{Binding IsSelectFriend, Converter={StaticResource BooleanToVisibilityConverter1}}">
|
||||
<Rectangle Fill="Black"
|
||||
Opacity="0.7">
|
||||
</Rectangle>
|
||||
<StackPanel Margin="20"
|
||||
Opacity="1"
|
||||
Background="Black"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch"
|
||||
Width="Auto"
|
||||
Height="Auto">
|
||||
<TextBlock Text="Select your friend"
|
||||
Style="{StaticResource PhoneTextNormalStyle}"
|
||||
TextAlignment="Center"
|
||||
FontSize="24"
|
||||
Padding="10"
|
||||
Margin="0" />
|
||||
<ListBox ItemsSource="{Binding PushPins, Mode=OneWay}"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Margin="0"
|
||||
Width="Auto"
|
||||
Height="675"
|
||||
Background="Black"
|
||||
Opacity="1"
|
||||
SelectedItem="{Binding SelectedFriend, Mode=TwoWay}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal"
|
||||
HorizontalAlignment="Stretch"
|
||||
Margin="4">
|
||||
<Image Source="{Binding PinImageUrl, Mode=OneWay, Converter={StaticResource imageCacheConverter}}"
|
||||
Width="96"
|
||||
Height="96" />
|
||||
<StackPanel Margin="10, 0,0,0">
|
||||
<TextBlock Text="{Binding PinUserName}"
|
||||
FontSize="24" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Last update:"
|
||||
FontSize="20">
|
||||
</TextBlock>
|
||||
<TextBlock Text="{Binding PinLastUpdated}"
|
||||
FontSize="20"
|
||||
Margin="10, 0, 0, 0" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Distance:"
|
||||
FontSize="20">
|
||||
</TextBlock>
|
||||
<TextBlock Text="{Binding PinDistance}"
|
||||
FontSize="20"
|
||||
Margin="10, 0, 0, 0" />
|
||||
<TextBlock Text="Km"
|
||||
Margin="5, 0, 0, 0"
|
||||
FontSize="20">
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<Preview:BindableApplicationBar x:Name="AppBar"
|
||||
BarOpacity="0.8">
|
||||
<Preview:BindableApplicationBarIconButton Command="{Binding ShowMyLocationCommand}"
|
||||
IconUri="/icons/appbar.location.png"
|
||||
Text="{Binding AppBarTextMyLocation}"
|
||||
IsEnabled="{Binding Path=IsBusy, Converter={StaticResource InvertValueConverter1}}" />
|
||||
Text="{Binding AppBarTextMyLocation}" />
|
||||
<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}" />
|
||||
Text="{Binding AppBarTextPublish}"
|
||||
IsEnabled="{Binding Path=IsBusy, Converter={StaticResource InvertValueConverter1}}" />
|
||||
<Preview:BindableApplicationBarIconButton Command="{Binding NavigateToSettingsCommand}"
|
||||
IconUri="/icons/appbar.feature.settings.rest.png"
|
||||
Text="{Binding AppBarTextSettings}" />
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
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}"
|
||||
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" xmlns:conv="clr-namespace:MyFriendsAround.WP7.Helpers.Converters" FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="Portrait" Orientation="Portrait"
|
||||
@@ -13,6 +13,11 @@
|
||||
mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
|
||||
|
||||
<phone:PhoneApplicationPage.Resources>
|
||||
<conv:MyImageConverter x:Key="myImageConverter" />
|
||||
</phone:PhoneApplicationPage.Resources>
|
||||
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Loaded">
|
||||
<cmd:EventToCommand Command="{Binding MainLoadCommand}" />
|
||||
@@ -47,7 +52,7 @@
|
||||
<TextBox Height="67"
|
||||
HorizontalAlignment="Stretch"
|
||||
Name="txtMyName"
|
||||
Text="{Binding Path=MyName, Mode=TwoWay}"
|
||||
Text="{Binding MyName, Mode=TwoWay}"
|
||||
VerticalAlignment="Top"
|
||||
binding:TextBoxBinding.UpdateSourceOnChange="True" />
|
||||
<TextBlock Text="My Picture"
|
||||
@@ -65,7 +70,8 @@
|
||||
VerticalAlignment="Stretch"
|
||||
Stretch="Uniform"
|
||||
Margin="1"
|
||||
Source="{Binding MyPicture, Mode=TwoWay}"></Image>
|
||||
Source="{Binding MyPicture, Mode=OneWay, Converter={StaticResource myImageConverter}}">
|
||||
</Image>
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<cmd:EventToCommand
|
||||
@@ -76,7 +82,7 @@
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<Preview:BindableApplicationBar x:Name="AppBar"
|
||||
<!--<Preview:BindableApplicationBar x:Name="AppBar"
|
||||
BarOpacity="0.8">
|
||||
<Preview:BindableApplicationBarIconButton Command="{Binding SaveMySettingsCommand}"
|
||||
IconUri="/Toolkit.Content/ApplicationBar.Check.png"
|
||||
@@ -85,7 +91,7 @@
|
||||
<Preview:BindableApplicationBarIconButton Command="{Binding CancelMySettingsCommand}"
|
||||
IconUri="/Toolkit.Content/ApplicationBar.Cancel.png"
|
||||
Text="{Binding AppBarTextCancelSettings}" />
|
||||
</Preview:BindableApplicationBar>
|
||||
</Preview:BindableApplicationBar>-->
|
||||
</Grid>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user