mirror of
https://github.com/farcasclaudiu/myfriendsaround.git
synced 2026-06-28 21:01:39 +03:00
textbox binding
refresh command
This commit is contained in:
@@ -6,12 +6,16 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
xmlns:vm="clr-namespace:MyFriendsAround.WP7.ViewModel">
|
xmlns:vm="clr-namespace:MyFriendsAround.WP7.ViewModel"
|
||||||
|
xmlns:my="clr-namespace:Coding4Fun.Phone.Controls.Converters;assembly=Coding4Fun.Phone.Controls"
|
||||||
|
xmlns:my1="clr-namespace:Microsoft.Silverlight.Testing.Client;assembly=Microsoft.Silverlight.Testing">
|
||||||
|
|
||||||
<!--Application Resources-->
|
<!--Application Resources-->
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
<vm:ViewModelLocator x:Key="Locator"
|
<vm:ViewModelLocator x:Key="Locator"
|
||||||
d:IsDataSource="True" />
|
d:IsDataSource="True" />
|
||||||
|
<my:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter1" />
|
||||||
|
<my1:InvertValueConverter x:Key="InvertValueConverter1" />
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
|
|
||||||
<Application.ApplicationLifetimeObjects>
|
<Application.ApplicationLifetimeObjects>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using Microsoft.Phone.Controls;
|
|||||||
using Microsoft.Phone.Shell;
|
using Microsoft.Phone.Shell;
|
||||||
using MyFriendsAround.WP7.ViewModel;
|
using MyFriendsAround.WP7.ViewModel;
|
||||||
using MyFriendsAround.WP7.Utils;
|
using MyFriendsAround.WP7.Utils;
|
||||||
|
using GalaSoft.MvvmLight.Threading;
|
||||||
|
|
||||||
|
|
||||||
namespace MyFriendsAround.WP7
|
namespace MyFriendsAround.WP7
|
||||||
@@ -45,6 +46,7 @@ namespace MyFriendsAround.WP7
|
|||||||
// This code will not execute when the application is reactivated
|
// This code will not execute when the application is reactivated
|
||||||
private void Application_Launching(object sender, LaunchingEventArgs e)
|
private void Application_Launching(object sender, LaunchingEventArgs e)
|
||||||
{
|
{
|
||||||
|
DispatcherHelper.Initialize();
|
||||||
LoadModel();
|
LoadModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,6 +54,7 @@ namespace MyFriendsAround.WP7
|
|||||||
// This code will not execute when the application is first launched
|
// This code will not execute when the application is first launched
|
||||||
private void Application_Activated(object sender, ActivatedEventArgs e)
|
private void Application_Activated(object sender, ActivatedEventArgs e)
|
||||||
{
|
{
|
||||||
|
DispatcherHelper.Initialize();
|
||||||
LoadModel();
|
LoadModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,6 +78,7 @@ namespace MyFriendsAround.WP7
|
|||||||
|
|
||||||
private void LoadModel()
|
private void LoadModel()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
MainViewModel mainModel = this.RetrieveFromIsolatedStorage<MainViewModel>();
|
MainViewModel mainModel = this.RetrieveFromIsolatedStorage<MainViewModel>();
|
||||||
if (mainModel != null)
|
if (mainModel != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,6 +63,12 @@
|
|||||||
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="Coding4Fun.Phone.Controls, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Coding4Fun.Phone.Controls.Complete.1.2\lib\Coding4Fun.Phone.Controls.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Coding4Fun.Phone.Controls.Toolkit">
|
||||||
|
<HintPath>..\packages\Coding4Fun.Phone.Controls.Complete.1.2\lib\Coding4Fun.Phone.Controls.Toolkit.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="GalaSoft.MvvmLight.WP7">
|
<Reference Include="GalaSoft.MvvmLight.WP7">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>C:\Program Files\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries\WP7\GalaSoft.MvvmLight.WP7.dll</HintPath>
|
<HintPath>C:\Program Files\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries\WP7\GalaSoft.MvvmLight.WP7.dll</HintPath>
|
||||||
@@ -79,7 +85,7 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Phone.Controls.Maps, Version=7.0.0.0, Culture=neutral, PublicKeyToken=24eec0d8c86cda1e" />
|
<Reference Include="Microsoft.Phone.Controls.Maps, Version=7.0.0.0, Culture=neutral, PublicKeyToken=24eec0d8c86cda1e" />
|
||||||
<Reference Include="Microsoft.Phone.Controls.Toolkit, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b772ad94eb9ca604, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Phone.Controls.Toolkit, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b772ad94eb9ca604, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\SilverlightToolkitWP.4.2011.2.1\lib\sl4\Microsoft.Phone.Controls.Toolkit.dll</HintPath>
|
<HintPath>..\packages\Coding4Fun.Phone.Controls.Complete.1.2\lib\Microsoft.Phone.Controls.Toolkit.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Silverlight.Testing">
|
<Reference Include="Microsoft.Silverlight.Testing">
|
||||||
<HintPath>..\Libs\SL3_UTF_May\Microsoft.Silverlight.Testing.dll</HintPath>
|
<HintPath>..\Libs\SL3_UTF_May\Microsoft.Silverlight.Testing.dll</HintPath>
|
||||||
@@ -171,6 +177,7 @@
|
|||||||
<Content Include="icons\appbar.questionmark.rest.png">
|
<Content Include="icons\appbar.questionmark.rest.png">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="icons\appbar.sync.rest.png" />
|
||||||
<Content Include="SplashScreenImage.jpg">
|
<Content Include="SplashScreenImage.jpg">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|||||||
@@ -56,11 +56,12 @@ namespace MyFriendsAround.WP7.ViewModel
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public MainViewModel()
|
public MainViewModel()
|
||||||
{
|
{
|
||||||
MyName = "Guest";
|
//
|
||||||
PublishLocationCommand = new RelayCommand(() => PublishLocationAction());
|
PublishLocationCommand = new RelayCommand(() => PublishLocationAction());
|
||||||
DisplayAboutCommand = new RelayCommand(() => DisplayAbout());
|
DisplayAboutCommand = new RelayCommand(() => DisplayAbout());
|
||||||
InputBoxCommand = new RelayCommand(() => InputBox());
|
InputBoxCommand = new RelayCommand(() => InputBox());
|
||||||
NavigateToAboutCommand = new RelayCommand(() => NavigateToAbout());
|
NavigateToAboutCommand = new RelayCommand(() => NavigateToAbout());
|
||||||
|
RefreshFriendsCommand = new RelayCommand(() => RefreshFriends());
|
||||||
|
|
||||||
if (IsInDesignMode)
|
if (IsInDesignMode)
|
||||||
{
|
{
|
||||||
@@ -69,12 +70,16 @@ namespace MyFriendsAround.WP7.ViewModel
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Code runs "for real"
|
// Code runs "for real"
|
||||||
IsBusy = true;
|
|
||||||
ServiceAgent.GetFriends(this.GetFriendsResult);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RefreshFriends()
|
||||||
|
{
|
||||||
|
IsBusy = true;
|
||||||
|
ServiceAgent.GetFriends(this.GetFriendsResult);
|
||||||
|
}
|
||||||
|
|
||||||
private void NavigateToAbout()
|
private void NavigateToAbout()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -163,12 +168,8 @@ namespace MyFriendsAround.WP7.ViewModel
|
|||||||
public ICommand PublishLocationCommand { get; set; }
|
public ICommand PublishLocationCommand { get; set; }
|
||||||
public ICommand DisplayAboutCommand { get; set; }
|
public ICommand DisplayAboutCommand { get; set; }
|
||||||
public ICommand InputBoxCommand { get; set; }
|
public ICommand InputBoxCommand { get; set; }
|
||||||
|
public ICommand NavigateToAboutCommand { get; set; }
|
||||||
public ICommand NavigateToAboutCommand
|
public ICommand RefreshFriendsCommand { get; set; }
|
||||||
{
|
|
||||||
get;
|
|
||||||
private set;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -206,6 +207,11 @@ namespace MyFriendsAround.WP7.ViewModel
|
|||||||
get { return "Publish"; }
|
get { return "Publish"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string AppBarTextRefresh
|
||||||
|
{
|
||||||
|
get { return "Refresh"; }
|
||||||
|
}
|
||||||
|
|
||||||
////public override void Cleanup()
|
////public override void Cleanup()
|
||||||
////{
|
////{
|
||||||
//// // Clean up if needed
|
//// // Clean up if needed
|
||||||
|
|||||||
@@ -19,7 +19,8 @@
|
|||||||
shell:SystemTray.IsVisible="True"
|
shell:SystemTray.IsVisible="True"
|
||||||
DataContext="{Binding Main, Source={StaticResource Locator}}"
|
DataContext="{Binding Main, Source={StaticResource Locator}}"
|
||||||
xmlns:my="clr-namespace:Microsoft.Phone.Controls.Maps;assembly=Microsoft.Phone.Controls.Maps"
|
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:Preview="clr-namespace:Phone7.Fx.Preview;assembly=Phone7.Fx.Preview"
|
||||||
|
xmlns:binding="clr-namespace:Coding4Fun.Phone.Controls.Binding;assembly=Coding4Fun.Phone.Controls">
|
||||||
|
|
||||||
<!--LayoutRoot contains the root grid where all other page content is placed-->
|
<!--LayoutRoot contains the root grid where all other page content is placed-->
|
||||||
|
|
||||||
@@ -37,6 +38,12 @@
|
|||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</phone:PhoneApplicationPage.Resources>
|
</phone:PhoneApplicationPage.Resources>
|
||||||
|
|
||||||
|
<i:Interaction.Triggers>
|
||||||
|
<i:EventTrigger EventName="Loaded">
|
||||||
|
<cmd:EventToCommand Command="{Binding RefreshFriendsCommand}" />
|
||||||
|
</i:EventTrigger>
|
||||||
|
</i:Interaction.Triggers>
|
||||||
|
|
||||||
<Grid x:Name="LayoutRoot"
|
<Grid x:Name="LayoutRoot"
|
||||||
Background="Transparent">
|
Background="Transparent">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
@@ -80,7 +87,8 @@
|
|||||||
Name="txtMyName"
|
Name="txtMyName"
|
||||||
Text="{Binding Path=MyName, Mode=TwoWay}"
|
Text="{Binding Path=MyName, Mode=TwoWay}"
|
||||||
VerticalAlignment="Bottom"
|
VerticalAlignment="Bottom"
|
||||||
Width="468" />
|
Width="468"
|
||||||
|
binding:TextBoxBinding.UpdateSourceOnChange="True" />
|
||||||
<my:Map x:Name="map"
|
<my:Map x:Name="map"
|
||||||
Height="468"
|
Height="468"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
@@ -110,6 +118,9 @@
|
|||||||
|
|
||||||
<Preview:BindableApplicationBar x:Name="AppBar"
|
<Preview:BindableApplicationBar x:Name="AppBar"
|
||||||
BarOpacity="0.5">
|
BarOpacity="0.5">
|
||||||
|
<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}"
|
<Preview:BindableApplicationBarIconButton Command="{Binding PublishLocationCommand}"
|
||||||
IconUri="/icons/appbar.publish.png"
|
IconUri="/icons/appbar.publish.png"
|
||||||
Text="{Binding AppBarTextPublish}" />
|
Text="{Binding AppBarTextPublish}" />
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ namespace MyFriendsAround.WP7
|
|||||||
// Constructor
|
// Constructor
|
||||||
public MainPage()
|
public MainPage()
|
||||||
{
|
{
|
||||||
|
|
||||||
DispatcherHelper.Initialize();
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
Messenger.Default.Register<DialogMessage>(
|
Messenger.Default.Register<DialogMessage>(
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 577 B |
@@ -1,4 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="SilverlightToolkitWP" version="4.2011.2.1" />
|
<package id="SilverlightToolkitWP" version="4.2011.2.1" />
|
||||||
|
<package id="Coding4Fun.Phone.Controls.Complete" version="1.2" />
|
||||||
</packages>
|
</packages>
|
||||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Reference in New Issue
Block a user