bindable appbar

minor changes
cleanup
This commit is contained in:
2011-03-24 02:14:22 +02:00
parent 449dee4702
commit 8798abdd69
31 changed files with 1134 additions and 790 deletions
@@ -0,0 +1,111 @@
using System;
using System.Collections;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using System.Windows.Media;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
namespace Phone7.Fx.Preview
{
[ContentProperty("Buttons")]
public class BindableApplicationBar : ItemsControl, IApplicationBar
{
private readonly ApplicationBar _applicationBar;
public BindableApplicationBar()
{
_applicationBar = new ApplicationBar();
this.Loaded += new RoutedEventHandler(BindableApplicationBar_Loaded);
}
void BindableApplicationBar_Loaded(object sender, RoutedEventArgs e)
{
var page =
this.GetVisualAncestors().Where(c => c is PhoneApplicationPage).FirstOrDefault() as PhoneApplicationPage;
if (page != null) page.ApplicationBar = _applicationBar;
}
protected override void OnItemsChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
base.OnItemsChanged(e);
_applicationBar.Buttons.Clear();
_applicationBar.MenuItems.Clear();
foreach (BindableApplicationBarIconButton button in Items.Where(c => c is BindableApplicationBarIconButton))
{
_applicationBar.Buttons.Add(button.Button);
}
foreach (BindableApplicationBarMenuItem button in Items.Where(c => c is BindableApplicationBarMenuItem))
{
_applicationBar.MenuItems.Add(button.MenuItem);
}
}
public static readonly DependencyProperty IsVisibleProperty =
DependencyProperty.RegisterAttached("IsVisible", typeof(bool), typeof(BindableApplicationBar), new PropertyMetadata(true, OnVisibleChanged));
private static void OnVisibleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (e.NewValue != e.OldValue)
{
((BindableApplicationBar)d)._applicationBar.IsVisible = (bool)e.NewValue;
}
}
public static readonly DependencyProperty IsMenuEnabledProperty =
DependencyProperty.RegisterAttached("IsMenuEnabled", typeof(bool), typeof(BindableApplicationBar), new PropertyMetadata(true, OnEnabledChanged));
private static void OnEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (e.NewValue != e.OldValue)
{
((BindableApplicationBar)d)._applicationBar.IsMenuEnabled = (bool)e.NewValue;
}
}
public bool IsVisible
{
get { return (bool)GetValue(IsVisibleProperty); }
set { SetValue(IsVisibleProperty, value); }
}
public double BarOpacity
{
get { return _applicationBar.Opacity; }
set { _applicationBar.Opacity = value; }
}
public bool IsMenuEnabled
{
get { return (bool)GetValue(IsMenuEnabledProperty); }
set { SetValue(IsMenuEnabledProperty, value); }
}
public Color BackgroundColor
{
get { return _applicationBar.BackgroundColor; }
set { _applicationBar.BackgroundColor = value; }
}
public Color ForegroundColor
{
get { return _applicationBar.ForegroundColor; }
set { _applicationBar.ForegroundColor = value; }
}
public IList Buttons
{
get { return this.Items; }
}
public IList MenuItems
{
get { return this.Items; }
}
public event EventHandler<ApplicationBarStateChangedEventArgs> StateChanged;
}
}
@@ -0,0 +1,98 @@
using System;
using System.Windows;
using System.Windows.Input;
using Microsoft.Phone.Shell;
namespace Phone7.Fx.Preview
{
public class BindableApplicationBarIconButton : FrameworkElement, IApplicationBarIconButton, IApplicationBarMenuItem
{
public static readonly DependencyProperty CommandProperty =
DependencyProperty.RegisterAttached("Command", typeof(ICommand), typeof(BindableApplicationBarIconButton), null);
public ICommand Command
{
get { return (ICommand)GetValue(CommandProperty); }
set { SetValue(CommandProperty, value); }
}
public static readonly DependencyProperty CommandParameterProperty =
DependencyProperty.RegisterAttached("CommandParameter", typeof(object), typeof(BindableApplicationBarIconButton), null);
public object CommandParameter
{
get { return GetValue(CommandParameterProperty); }
set { SetValue(CommandParameterProperty, value); }
}
public static readonly DependencyProperty CommandParameterValueProperty =
DependencyProperty.RegisterAttached("CommandParameterValue", typeof(object), typeof(BindableApplicationBarMenuItem), null);
public object CommandParameterValue
{
get { return GetValue(CommandParameterValueProperty); }
set { SetValue(CommandParameterValueProperty, value); }
}
public static readonly DependencyProperty IsEnabledProperty =
DependencyProperty.RegisterAttached("IsEnabled", typeof(bool), typeof(BindableApplicationBarIconButton), new PropertyMetadata(true, OnEnabledChanged));
private static void OnEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (e.NewValue != e.OldValue)
{
((BindableApplicationBarIconButton)d).Button.IsEnabled = (bool)e.NewValue;
}
}
public static readonly DependencyProperty TextProperty =
DependencyProperty.RegisterAttached("Text", typeof(string), typeof(BindableApplicationBarIconButton), new PropertyMetadata(OnTextChanged));
private static void OnTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (e.NewValue != e.OldValue)
{
((BindableApplicationBarIconButton)d).Button.Text = e.NewValue.ToString();
}
}
public ApplicationBarIconButton Button { get; set; }
public BindableApplicationBarIconButton()
{
Button = new ApplicationBarIconButton();
Button.Text = "Text";
Button.Click += ApplicationBarIconButtonClick;
}
void ApplicationBarIconButtonClick(object sender, EventArgs e)
{
if (Command != null && CommandParameter != null)
Command.Execute(CommandParameter);
else if (Command != null)
Command.Execute(CommandParameterValue);
}
public bool IsEnabled
{
get { return (bool)GetValue(IsEnabledProperty); }
set { SetValue(IsEnabledProperty, value); }
}
public string Text
{
get { return (string)GetValue(TextProperty); }
set { SetValue(TextProperty, value); }
}
public event EventHandler Click;
public Uri IconUri
{
get { return Button.IconUri; }
set { Button.IconUri = value; }
}
}
}
@@ -0,0 +1,94 @@
using System;
using System.Windows;
using System.Windows.Input;
using Microsoft.Phone.Shell;
namespace Phone7.Fx.Preview
{
public class BindableApplicationBarMenuItem : FrameworkElement, IApplicationBarMenuItem
{
public static readonly DependencyProperty CommandProperty =
DependencyProperty.RegisterAttached("Command", typeof(ICommand), typeof(BindableApplicationBarMenuItem), null);
public ICommand Command
{
get { return (ICommand)GetValue(CommandProperty); }
set { SetValue(CommandProperty, value); }
}
public static readonly DependencyProperty CommandParameterProperty =
DependencyProperty.RegisterAttached("CommandParameter", typeof(object), typeof(BindableApplicationBarMenuItem), null);
public object CommandParameter
{
get { return GetValue(CommandParameterProperty); }
set { SetValue(CommandParameterProperty, value); }
}
public static readonly DependencyProperty CommandParameterValueProperty =
DependencyProperty.RegisterAttached("CommandParameterValue", typeof(object), typeof(BindableApplicationBarMenuItem), null);
public object CommandParameterValue
{
get { return GetValue(CommandParameterValueProperty); }
set { SetValue(CommandParameterValueProperty, value); }
}
public static readonly DependencyProperty IsEnabledProperty =
DependencyProperty.RegisterAttached("IsEnabled", typeof(bool), typeof(BindableApplicationBarMenuItem), new PropertyMetadata(true, OnEnabledChanged));
private static void OnEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (e.NewValue != e.OldValue)
{
((BindableApplicationBarMenuItem)d).MenuItem.IsEnabled = (bool)e.NewValue;
}
}
public static readonly DependencyProperty TextProperty =
DependencyProperty.RegisterAttached("Text", typeof(string), typeof(BindableApplicationBarMenuItem), new PropertyMetadata(OnTextChanged));
private static void OnTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (e.NewValue != e.OldValue)
{
((BindableApplicationBarMenuItem)d).MenuItem.Text = e.NewValue.ToString();
}
}
public ApplicationBarMenuItem MenuItem { get; set; }
public BindableApplicationBarMenuItem()
{
MenuItem = new ApplicationBarMenuItem();
MenuItem.Text = "Text";
MenuItem.Click += ApplicationBarMenuItemClick;
}
void ApplicationBarMenuItemClick(object sender, EventArgs e)
{
if (Command != null && CommandParameter != null)
Command.Execute(CommandParameter);
else if (Command != null)
Command.Execute(CommandParameterValue);
}
public bool IsEnabled
{
get { return (bool)GetValue(IsEnabledProperty); }
set { SetValue(IsEnabledProperty, value); }
}
public string Text
{
get { return (string)GetValue(TextProperty); }
set { SetValue(TextProperty, value); }
}
public event EventHandler Click;
}
}
+190
View File
@@ -0,0 +1,190 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.IsolatedStorage;
using System.Linq;
using System.Runtime.Serialization;
namespace Phone7.Fx.Preview
{
/// <summary>
///
/// </summary>
public class Cache
{
public static readonly DateTime NoAbsoluteExpiration = DateTime.MaxValue;
public static readonly TimeSpan NoSlidingExpiration = TimeSpan.Zero;
readonly IsolatedStorageFile _myStore = IsolatedStorageFile.GetUserStoreForApplication();
private object _sync = new object();
private static Cache _current;
/// <summary>
/// Gets the current instance of the cache
/// </summary>
/// <value>The current.</value>
public static Cache Current
{
get { return _current ?? (_current = new Cache()); }
}
/// <summary>
/// Adds the specified key.
/// </summary>
/// <param name="key">The key.</param>
/// <param name="value">The value.</param>
/// <param name="absoluteExpiration">The absolute expiration.</param>
/// <param name="slidingExpiration">The sliding expiration.</param>
public void Add(string key, object value, DateTime absoluteExpiration, TimeSpan slidingExpiration)
{
lock (_sync)
{
if (Contains(key))
Remove(key);
if (absoluteExpiration == NoAbsoluteExpiration)
Add(key, DateTime.UtcNow + slidingExpiration, value);
if (slidingExpiration == NoSlidingExpiration)
Add(key, absoluteExpiration, value);
}
}
/// <summary>
/// Adds the specified key.
/// </summary>
/// <param name="key">The key.</param>
/// <param name="expirationDate">The expiration date.</param>
/// <param name="value">The value.</param>
private void Add(string key, DateTime expirationDate, object value)
{
lock (_sync)
{
if (!_myStore.DirectoryExists(key))
_myStore.CreateDirectory(key);
else
{
string currentFile = GetFileNames(key).FirstOrDefault();
if (currentFile != null)
_myStore.DeleteFile(string.Format("{0}\\{1}", key, currentFile));
_myStore.DeleteDirectory(key);
_myStore.CreateDirectory(key);
}
string fileName = string.Format("{0}\\{1}.cache", key, expirationDate.ToFileTimeUtc());
if (_myStore.FileExists(fileName))
_myStore.DeleteFile(fileName);
NormalWrite(fileName, value);
}
}
/// <summary>
/// Determines whether the cache contains the specified key.
/// </summary>
/// <param name="key">The key.</param>
/// <returns>
/// <c>true</c> if [contains] [the specified key]; otherwise, <c>false</c>.
/// </returns>
public bool Contains(string key)
{
lock (_sync)
{
if (_myStore.DirectoryExists(key) && GetFileNames(key).Any())
{
string currentFile = GetFileNames(key).FirstOrDefault();
if (currentFile != null)
{
var expirationDate =
DateTime.FromFileTimeUtc(long.Parse(Path.GetFileNameWithoutExtension(currentFile)));
if (expirationDate >= DateTime.UtcNow)
return true;
}
}
return false;
}
}
/// <summary>
/// Removes the specified key.
/// </summary>
/// <param name="key">The key.</param>
public void Remove(string key)
{
lock (_sync)
{
if (!Contains(key))
throw new AccessViolationException("The key does not exist in the cache");
string currentFile = GetFileNames(key).FirstOrDefault();
if (currentFile != null)
_myStore.DeleteFile(string.Format("{0}\\{1}", key, currentFile));
_myStore.DeleteDirectory(key);
}
}
/// <summary>
/// Gets the file names.
/// </summary>
/// <param name="key">The key.</param>
/// <returns></returns>
private IEnumerable<string> GetFileNames(string key)
{
return _myStore.GetFileNames(string.Format("{0}\\*.cache", key));
}
/// <summary>
/// Gets the specified key.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key">The key.</param>
/// <returns></returns>
public T Get<T>(string key)
{
lock (_sync)
{
string currentFile = GetFileNames(key).FirstOrDefault();
if (currentFile != null)
{
var expirationDate =
DateTime.FromFileTimeUtc(long.Parse(Path.GetFileNameWithoutExtension(currentFile)));
if (expirationDate >= DateTime.UtcNow)
{
return NormalRead<T>(string.Format(@"{0}\{1}", key, currentFile));
}
Remove(key);
}
return default(T);
}
}
#region Serialization
private T NormalRead<T>(string fileName)
{
using (var isolatedStorageFileStream = new IsolatedStorageFileStream(fileName, FileMode.Open, _myStore))
{
DataContractSerializer s = new DataContractSerializer(typeof(T));
var value = s.ReadObject(isolatedStorageFileStream);
isolatedStorageFileStream.Close();
return (T)value;
}
}
private void NormalWrite(string fileName, object value)
{
using (var isolatedStorageFileStream = new IsolatedStorageFileStream(fileName, FileMode.OpenOrCreate, _myStore))
{
DataContractSerializer s = new DataContractSerializer(value.GetType());
s.WriteObject(isolatedStorageFileStream, value);
}
}
#endregion
}
}
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.20506</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{B55A0F90-2B5A-4C4B-88F4-013AA1629866}</ProjectGuid>
<ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Phone7.Fx.Preview</RootNamespace>
<AssemblyName>Phone7.Fx.Preview</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<TargetFrameworkProfile>WindowsPhone</TargetFrameworkProfile>
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
<SilverlightApplication>false</SilverlightApplication>
<ValidateXaml>true</ValidateXaml>
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Bin\Debug</OutputPath>
<DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Bin\Release</OutputPath>
<DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Phone" />
<Reference Include="mscorlib" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Windows" />
<Reference Include="system" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
<Reference Include="System.Net" />
</ItemGroup>
<ItemGroup>
<Compile Include="BindableApplicationBar.xaml.cs" />
<Compile Include="BindableApplicationBarIconButton.xaml.cs" />
<Compile Include="BindableApplicationBarMenuItem.xaml.cs" />
<Compile Include="Cache.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="VisualTreeHelperExtensions.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.$(TargetFrameworkProfile).Overrides.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.CSharp.targets" />
<ProjectExtensions />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 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("Phone7.Fx.Preview")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Phone7.Fx.Preview")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
[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("f2bd3027-1a6d-4c83-9434-4ad1349fd608")]
// 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")]
@@ -0,0 +1,394 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Media;
namespace Phone7.Fx.Preview
{
public static class VisualTreeHelperExtensions
{
/// <summary>
/// Equivalent of FindName, but works on the visual tree to go through templates, etc.
/// </summary>
/// <param name="root">The node to search from</param>
/// <param name="name">The name to look for</param>
/// <returns>The found node, or null if not found</returns>
public static FrameworkElement FindVisualChild(this FrameworkElement root, string name)
{
FrameworkElement temp = root.FindName(name) as FrameworkElement;
if (temp != null)
return temp;
foreach (FrameworkElement element in root.GetVisualChildren())
{
temp = element.FindName(name) as FrameworkElement;
if (temp != null)
return temp;
}
return null;
}
/// <summary>
/// Gets the visual parent of the element
/// </summary>
/// <param name="node">The element to check</param>
/// <returns>The visual parent</returns>
public static FrameworkElement GetVisualParent(this FrameworkElement node)
{
return VisualTreeHelper.GetParent(node) as FrameworkElement;
}
/// <summary>
/// Gets a visual child of the element
/// </summary>
/// <param name="node">The element to check</param>
/// <param name="index">The index of the child</param>
/// <returns>The found child</returns>
public static FrameworkElement GetVisualChild(this FrameworkElement node, int index)
{
return VisualTreeHelper.GetChild(node, index) as FrameworkElement;
}
/// <summary>
/// Gets all the visual children of the element
/// </summary>
/// <param name="root">The element to get children of</param>
/// <returns>An enumerator of the children</returns>
public static IEnumerable<FrameworkElement> GetVisualChildren(this FrameworkElement root)
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(root); i++)
yield return VisualTreeHelper.GetChild(root, i) as FrameworkElement;
}
/// <summary>
/// Gets the ancestors of the element, up to the root
/// </summary>
/// <param name="node">The element to start from</param>
/// <returns>An enumerator of the ancestors</returns>
public static IEnumerable<FrameworkElement> GetVisualAncestors(this FrameworkElement node)
{
FrameworkElement parent = node.GetVisualParent();
while (parent != null)
{
yield return parent;
parent = parent.GetVisualParent();
}
}
/// <summary>
/// Gets the VisualStateGroup with the given name, looking up the visual tree
/// </summary>
/// <param name="root">Element to start from</param>
/// <param name="groupName">Name of the group to look for</param>
/// <param name="searchAncestors">Whether or not to look up the tree</param>
/// <returns>The group, if found</returns>
public static VisualStateGroup GetVisualStateGroup(this FrameworkElement root, string groupName, bool searchAncestors)
{
IList groups = VisualStateManager.GetVisualStateGroups(root);
foreach (object o in groups)
{
VisualStateGroup group = o as VisualStateGroup;
if (group != null && group.Name == groupName)
return group;
}
if (searchAncestors)
{
FrameworkElement parent = root.GetVisualParent();
if (parent != null)
return parent.GetVisualStateGroup(groupName, true);
}
return null;
}
/// <summary>
/// Finds the VisualStateGroup with the given name
/// </summary>
/// <param name="root">The root.</param>
/// <param name="name">The name.</param>
/// <returns></returns>
public static VisualStateGroup FindVisualState(this FrameworkElement root, string name)
{
if (root == null)
return null;
IList groups = VisualStateManager.GetVisualStateGroups(root);
return groups.Cast<VisualStateGroup>().FirstOrDefault(group => group.Name == name);
}
/// <summary>
/// Performs a breadth-first enumeration of all the descendents in the tree
/// </summary>
/// <param name="root">The root node</param>
/// <returns>An enumerator of all the children</returns>
public static IEnumerable<FrameworkElement> GetVisualDescendents(this FrameworkElement root)
{
Queue<IEnumerable<FrameworkElement>> toDo = new Queue<IEnumerable<FrameworkElement>>();
toDo.Enqueue(root.GetVisualChildren());
while (toDo.Count > 0)
{
IEnumerable<FrameworkElement> children = toDo.Dequeue();
foreach (FrameworkElement child in children)
{
yield return child;
toDo.Enqueue(child.GetVisualChildren());
}
}
}
/// <summary>
/// Provides a debug string that represents the visual child tree
/// </summary>
/// <param name="root">The root node</param>
/// <param name="result">StringBuilder into which the text is appended</param>
/// <remarks>This method only works in DEBUG mode</remarks>
[Conditional("DEBUG")]
public static void GetVisualChildTreeDebugText(this FrameworkElement root, StringBuilder result)
{
List<string> results = new List<string>();
root.GetChildTree("", " ", results);
foreach (string s in results)
result.AppendLine(s);
}
private static void GetChildTree(this FrameworkElement root, string prefix, string addPrefix, List<string> results)
{
string thisElement = "";
if (String.IsNullOrEmpty(root.Name))
thisElement = "[Anonymous]";
else
thisElement = string.Format("[{0}]", root.Name);
thisElement += string.Format(" : {0}", root.GetType().Name);
results.Add(prefix + thisElement);
foreach (FrameworkElement directChild in root.GetVisualChildren())
{
directChild.GetChildTree(prefix + addPrefix, addPrefix, results);
}
}
/// <summary>
/// Provides a debug string that represents the visual child tree
/// </summary>
/// <param name="node">The root node</param>
/// <param name="result">StringBuilder into which the text is appended</param>
/// <remarks>This method only works in DEBUG mode</remarks>
[Conditional("DEBUG")]
public static void GetAncestorVisualTreeDebugText(this FrameworkElement node, StringBuilder result)
{
List<string> tree = new List<string>();
node.GetAncestorVisualTree(tree);
string prefix = "";
foreach (string s in tree)
{
result.AppendLine(prefix + s);
prefix = prefix + " ";
}
}
private static void GetAncestorVisualTree(this FrameworkElement node, List<string> children)
{
string name = String.IsNullOrEmpty(node.Name) ? "[Anon]" : node.Name;
string thisNode = name + ": " + node.GetType().Name;
// Ensure list is in reverse order going up the tree
children.Insert(0, thisNode);
FrameworkElement parent = node.GetVisualParent();
if (parent != null)
GetAncestorVisualTree(parent, children);
}
/// <summary>
/// Returns a render transform of the specified type from the element, creating it if necessary
/// </summary>
/// <typeparam name="TRequestedTransform">The type of transform (Rotate, Translate, etc)</typeparam>
/// <param name="element">The element to check</param>
/// <param name="mode">The mode to use for creating transforms, if not found</param>
/// <returns>The specified transform, or null if not found and not created</returns>
public static TRequestedTransform GetTransform<TRequestedTransform>(this UIElement element, TransformCreationMode mode) where TRequestedTransform : Transform, new()
{
Transform originalTransform = element.RenderTransform;
TRequestedTransform requestedTransform = null;
MatrixTransform matrixTransform = null;
TransformGroup transformGroup = null;
// Current transform is null -- create if necessary and return
if (originalTransform == null)
{
if ((mode & TransformCreationMode.Create) == TransformCreationMode.Create)
{
requestedTransform = new TRequestedTransform();
element.RenderTransform = requestedTransform;
return requestedTransform;
}
return null;
}
// Transform is exactly what we want -- return it
requestedTransform = originalTransform as TRequestedTransform;
if (requestedTransform != null)
return requestedTransform;
// The existing transform is matrix transform - overwrite if necessary and return
matrixTransform = originalTransform as MatrixTransform;
if (matrixTransform != null)
{
if (matrixTransform.Matrix.IsIdentity
&& (mode & TransformCreationMode.Create) == TransformCreationMode.Create
&& (mode & TransformCreationMode.IgnoreIdentityMatrix) == TransformCreationMode.IgnoreIdentityMatrix)
{
requestedTransform = new TRequestedTransform();
element.RenderTransform = requestedTransform;
return requestedTransform;
}
return null;
}
// Transform is actually a group -- check for the requested type
transformGroup = originalTransform as TransformGroup;
if (transformGroup != null)
{
foreach (Transform child in transformGroup.Children)
{
// Child is the right type -- return it
if (child is TRequestedTransform)
return child as TRequestedTransform;
}
// Right type was not found, but we are OK to add it
if ((mode & TransformCreationMode.AddToGroup) == TransformCreationMode.AddToGroup)
{
requestedTransform = new TRequestedTransform();
transformGroup.Children.Add(requestedTransform);
return requestedTransform;
}
return null;
}
// Current ransform is not a group and is not what we want;
// create a new group containing the existing transform and the new one
if ((mode & TransformCreationMode.CombineIntoGroup) == TransformCreationMode.CombineIntoGroup)
{
transformGroup = new TransformGroup();
transformGroup.Children.Add(originalTransform);
transformGroup.Children.Add(requestedTransform);
element.RenderTransform = transformGroup;
return requestedTransform;
}
Debug.Assert(false, "Shouldn't get here");
return null;
}
/// <summary>
/// Returns a string representation of a property path needed to update a Storyboard
/// </summary>
/// <param name="element">The element to get the path for</param>
/// <param name="subProperty">The property of the transform</param>
/// <typeparam name="TRequestedType">The type of transform to look fo</typeparam>
/// <returns>A property path</returns>
public static string GetTransformPropertyPath<TRequestedType>(this FrameworkElement element, string subProperty) where TRequestedType : Transform
{
Transform t = element.RenderTransform;
if (t is TRequestedType)
return String.Format("(RenderTransform).({0}.{1})", typeof(TRequestedType).Name, subProperty);
else if (t is TransformGroup)
{
TransformGroup g = t as TransformGroup;
for (int i = 0; i < g.Children.Count; i++)
{
if (g.Children[i] is TRequestedType)
return String.Format("(RenderTransform).(TransformGroup.Children)[" + i + "].({0}.{1})",
typeof(TRequestedType).Name, subProperty);
}
}
return "";
}
/// <summary>
/// Returns a plane projection, creating it if necessary
/// </summary>
/// <param name="element">The element</param>
/// <param name="create">Whether or not to create the projection if it doesn't already exist</param>
/// <returns>The plane project, or null if not found / created</returns>
public static PlaneProjection GetPlaneProjection(this UIElement element, bool create)
{
Projection originalProjection = element.Projection;
PlaneProjection projection = null;
// Projection is already a plane projection; return it
if (originalProjection is PlaneProjection)
return originalProjection as PlaneProjection;
// Projection is null; create it if necessary
if (originalProjection == null)
{
if (create)
{
projection = new PlaneProjection();
element.Projection = projection;
}
}
// Note that if the project is a Matrix projection, it will not be
// changed and null will be returned.
return projection;
}
}
/// <summary>
/// Possible modes for creating a transform
/// </summary>
[Flags]
public enum TransformCreationMode
{
/// <summary>
/// Don't try and create a transform if it doesn't already exist
/// </summary>
None = 0,
/// <summary>
/// Create a transform if none exists
/// </summary>
Create = 1,
/// <summary>
/// Create and add to an existing group
/// </summary>
AddToGroup = 2,
/// <summary>
/// Create a group and combine with existing transform; may break existing animations
/// </summary>
CombineIntoGroup = 4,
/// <summary>
/// Treat identity matrix as if it wasn't there; may break existing animations
/// </summary>
IgnoreIdentityMatrix = 8,
/// <summary>
/// Create a new transform or add to group
/// </summary>
CreateOrAddAndIgnoreMatrix = Create | AddToGroup | IgnoreIdentityMatrix,
/// <summary>
/// Default behaviour, equivalent to CreateOrAddAndIgnoreMatrix
/// </summary>
Default = CreateOrAddAndIgnoreMatrix,
}
}
Binary file not shown.
@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<DataSchemaModel FileFormatVersion="1.2" SchemaVersion="1.1" DspName="Microsoft.Data.Schema.Sql.Sql100DatabaseSchemaProvider" CollationLcid="1033" CollationCaseSensitive="False">
<Header>
<CustomData Category="ModelCapability">
<Metadata Name="ModelCapability" Value="Default" />
</CustomData>
<CustomData Category="ClrTypesDbSchema" Type="DbSchema">
<Metadata Name="ClrTypesDbSchema" Value="True" />
</CustomData>
<CustomData Category="AnsiNulls">
<Metadata Name="AnsiNulls" Value="True" />
</CustomData>
<CustomData Category="QuotedIdentifier">
<Metadata Name="QuotedIdentifier" Value="True" />
</CustomData>
<CustomData Category="CompatibilityMode">
<Metadata Name="CompatibilityMode" Value="100" />
</CustomData>
<CustomData Category="Permissions" Type="XmlPermissions">
<Metadata Name="FileName" Value="C:\PROJECTS\MYFRIENDSAROUND\MYFRIENDSAROUND.DB\PROPERTIES\DATABASE.SQLPERMISSIONS" />
</CustomData>
</Header>
<Model>
<Element Type="ISql100DatabaseOptions">
<Property Name="Collation" Value="SQL_Latin1_General_CP1_CI_AS" />
<Property Name="IsAnsiNullDefaultOn" Value="True" />
<Property Name="IsAnsiNullsOn" Value="True" />
<Property Name="IsAnsiWarningsOn" Value="True" />
<Property Name="IsArithAbortOn" Value="True" />
<Property Name="IsConcatNullYieldsNullOn" Value="True" />
<Property Name="IsTornPageProtectionOn" Value="False" />
<Property Name="IsFullTextEnabled" Value="True" />
<Property Name="PageVerifyMode" Value="3" />
<Relationship Name="DefaultFilegroup">
<Entry>
<References ExternalSource="BuiltIns" Name="[PRIMARY]" />
</Entry>
</Relationship>
</Element>
</Model>
</DataSchemaModel>
@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TargetDatabase>MyFriendsAround.DB</TargetDatabase>
<DeployToDatabase>False</DeployToDatabase>
<DeployToScript>True</DeployToScript>
<SourceModel>MyFriendsAround.DB.dbschema</SourceModel>
<DeployScriptFileName>MyFriendsAround.DB.sql</DeployScriptFileName>
<DeploymentConfigurationFile>MyFriendsAround.DB_Database.sqldeployment</DeploymentConfigurationFile>
</PropertyGroup>
<PropertyGroup>
<SqlCommandVariablesFile>MyFriendsAround.DB_Database.sqlcmdvars</SqlCommandVariablesFile>
</PropertyGroup>
<ItemGroup>
<DeploymentExtensionConfiguration Include="MyFriendsAround.DB_Script.PostDeployment.sql">
<__PostdeploymentMetadata>
</__PostdeploymentMetadata>
</DeploymentExtensionConfiguration>
<DeploymentExtensionConfiguration Include="MyFriendsAround.DB_Script.PreDeployment.sql">
<__PredeploymentMetadata>
</__PredeploymentMetadata>
</DeploymentExtensionConfiguration>
</ItemGroup>
<ItemGroup>
<DeploymentExtension Include="Microsoft.Data.Schema.Sql.Build.SqlPlanOrderModifier">
<Assembly>Microsoft.Data.Schema.Sql</Assembly>
<Version>10.0.0.0</Version>
<Token>sD9ffxHVCjo=</Token>
</DeploymentExtension>
<DeploymentExtension Include="Microsoft.Data.Schema.Sql.Build.SqlPrePostDeploymentModifier">
<Assembly>Microsoft.Data.Schema.Sql</Assembly>
<Version>10.0.0.0</Version>
<Token>sD9ffxHVCjo=</Token>
</DeploymentExtension>
<DeploymentExtension Include="Microsoft.Data.Schema.Sql.Refactoring.SqlRefactoringDeploymentContributor">
<Assembly>Microsoft.Data.Schema.Sql</Assembly>
<Version>10.0.0.0</Version>
<Token>sD9ffxHVCjo=</Token>
</DeploymentExtension>
</ItemGroup>
</Project>
@@ -1,211 +0,0 @@
/*
Deployment script for MyFriendsAround.DB
*/
GO
SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER ON;
SET NUMERIC_ROUNDABORT OFF;
GO
:setvar DatabaseName "MyFriendsAround.DB"
:setvar DefaultDataPath ""
:setvar DefaultLogPath ""
GO
:on error exit
GO
USE [master]
GO
IF (DB_ID(N'$(DatabaseName)') IS NOT NULL
AND DATABASEPROPERTYEX(N'$(DatabaseName)','Status') <> N'ONLINE')
BEGIN
RAISERROR(N'The state of the target database, %s, is not set to ONLINE. To deploy to this database, its state must be set to ONLINE.', 16, 127,N'$(DatabaseName)') WITH NOWAIT
RETURN
END
GO
IF (DB_ID(N'$(DatabaseName)') IS NOT NULL)
BEGIN
ALTER DATABASE [$(DatabaseName)]
SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
DROP DATABASE [$(DatabaseName)];
END
GO
PRINT N'Creating $(DatabaseName)...'
GO
CREATE DATABASE [$(DatabaseName)] COLLATE SQL_Latin1_General_CP1_CI_AS
GO
EXECUTE sp_dbcmptlevel [$(DatabaseName)], 100;
GO
IF EXISTS (SELECT 1
FROM [master].[dbo].[sysdatabases]
WHERE [name] = N'$(DatabaseName)')
BEGIN
ALTER DATABASE [$(DatabaseName)]
SET ANSI_NULLS ON,
ANSI_PADDING ON,
ANSI_WARNINGS ON,
ARITHABORT ON,
CONCAT_NULL_YIELDS_NULL ON,
NUMERIC_ROUNDABORT OFF,
QUOTED_IDENTIFIER ON,
ANSI_NULL_DEFAULT ON,
CURSOR_DEFAULT LOCAL,
RECOVERY FULL,
CURSOR_CLOSE_ON_COMMIT OFF,
AUTO_CREATE_STATISTICS ON,
AUTO_SHRINK OFF,
AUTO_UPDATE_STATISTICS ON,
RECURSIVE_TRIGGERS OFF
WITH ROLLBACK IMMEDIATE;
ALTER DATABASE [$(DatabaseName)]
SET AUTO_CLOSE OFF
WITH ROLLBACK IMMEDIATE;
END
GO
IF EXISTS (SELECT 1
FROM [master].[dbo].[sysdatabases]
WHERE [name] = N'$(DatabaseName)')
BEGIN
ALTER DATABASE [$(DatabaseName)]
SET ALLOW_SNAPSHOT_ISOLATION OFF;
END
GO
IF EXISTS (SELECT 1
FROM [master].[dbo].[sysdatabases]
WHERE [name] = N'$(DatabaseName)')
BEGIN
ALTER DATABASE [$(DatabaseName)]
SET READ_COMMITTED_SNAPSHOT OFF;
END
GO
IF EXISTS (SELECT 1
FROM [master].[dbo].[sysdatabases]
WHERE [name] = N'$(DatabaseName)')
BEGIN
ALTER DATABASE [$(DatabaseName)]
SET AUTO_UPDATE_STATISTICS_ASYNC OFF,
PAGE_VERIFY NONE,
DATE_CORRELATION_OPTIMIZATION OFF,
DISABLE_BROKER,
PARAMETERIZATION SIMPLE,
SUPPLEMENTAL_LOGGING OFF
WITH ROLLBACK IMMEDIATE;
END
GO
IF IS_SRVROLEMEMBER(N'sysadmin') = 1
BEGIN
IF EXISTS (SELECT 1
FROM [master].[dbo].[sysdatabases]
WHERE [name] = N'$(DatabaseName)')
BEGIN
EXECUTE sp_executesql N'ALTER DATABASE [$(DatabaseName)]
SET TRUSTWORTHY OFF,
DB_CHAINING OFF
WITH ROLLBACK IMMEDIATE';
END
END
ELSE
BEGIN
PRINT N'The database settings cannot be modified. You must be a SysAdmin to apply these settings.';
END
GO
IF IS_SRVROLEMEMBER(N'sysadmin') = 1
BEGIN
IF EXISTS (SELECT 1
FROM [master].[dbo].[sysdatabases]
WHERE [name] = N'$(DatabaseName)')
BEGIN
EXECUTE sp_executesql N'ALTER DATABASE [$(DatabaseName)]
SET HONOR_BROKER_PRIORITY OFF
WITH ROLLBACK IMMEDIATE';
END
END
ELSE
BEGIN
PRINT N'The database settings cannot be modified. You must be a SysAdmin to apply these settings.';
END
GO
USE [$(DatabaseName)]
GO
IF fulltextserviceproperty(N'IsFulltextInstalled') = 1
EXECUTE sp_fulltext_database 'enable';
GO
/*
Pre-Deployment Script Template
--------------------------------------------------------------------------------------
This file contains SQL statements that will be executed before the build script.
Use SQLCMD syntax to include a file in the pre-deployment script.
Example: :r .\myfile.sql
Use SQLCMD syntax to reference a variable in the pre-deployment script.
Example: :setvar TableName MyTable
SELECT * FROM [$(TableName)]
--------------------------------------------------------------------------------------
*/
GO
-- Refactoring step to update target server with deployed transaction logs
CREATE TABLE [dbo].[__RefactorLog] (OperationKey UNIQUEIDENTIFIER NOT NULL PRIMARY KEY)
GO
sp_addextendedproperty N'microsoft_database_tools_support', N'refactoring log', N'schema', N'dbo', N'table', N'__RefactorLog'
GO
GO
/*
Post-Deployment Script Template
--------------------------------------------------------------------------------------
This file contains SQL statements that will be appended to the build script.
Use SQLCMD syntax to include a file in the post-deployment script.
Example: :r .\myfile.sql
Use SQLCMD syntax to reference a variable in the post-deployment script.
Example: :setvar TableName MyTable
SELECT * FROM [$(TableName)]
--------------------------------------------------------------------------------------
*/
GO
IF EXISTS (SELECT 1
FROM [master].[dbo].[sysdatabases]
WHERE [name] = N'$(DatabaseName)')
BEGIN
DECLARE @VarDecimalSupported AS BIT;
SELECT @VarDecimalSupported = 0;
IF ((ServerProperty(N'EngineEdition') = 3)
AND (((@@microsoftversion / power(2, 24) = 9)
AND (@@microsoftversion & 0xffff >= 3024))
OR ((@@microsoftversion / power(2, 24) = 10)
AND (@@microsoftversion & 0xffff >= 1600))))
SELECT @VarDecimalSupported = 1;
IF (@VarDecimalSupported > 0)
BEGIN
EXECUTE sp_db_vardecimal_storage_format N'$(DatabaseName)', 'ON';
END
END
GO
ALTER DATABASE [$(DatabaseName)]
SET MULTI_USER
WITH ROLLBACK IMMEDIATE;
GO
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<SqlCommandVariables xmlns="urn:Microsoft.VisualStudio.Data.Schema.Package.SqlCmdVars" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Version>1.0</Version>
<Properties>
</Properties>
</SqlCommandVariables>
@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<DeploymentConfigurationSettings xmlns="urn:Microsoft.VisualStudio.Data.Schema.Package.DeploymentConfigurationSettings" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Version>1.0</Version>
<Properties>
<AlwaysCreateNewDatabase>False</AlwaysCreateNewDatabase>
<BlockIncrementalDeploymentIfDataLoss>True</BlockIncrementalDeploymentIfDataLoss>
<DeployDatabaseProperties>True</DeployDatabaseProperties>
<DeploymentCollationPreference>UseSourceModelCollation</DeploymentCollationPreference>
<DoNotUseAlterAssemblyStatementsToUpdateCLRTypes>False</DoNotUseAlterAssemblyStatementsToUpdateCLRTypes>
<GenerateDropsIfNotInProject>False</GenerateDropsIfNotInProject>
<PerformDatabaseBackup>False</PerformDatabaseBackup>
<SingleUserMode>False</SingleUserMode>
</Properties>
</DeploymentConfigurationSettings>
@@ -1,52 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<CatalogProperties xmlns="urn:Microsoft.VisualStudio.Data.Schema.Package.CatalogProperties" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Version>1.0</Version>
<Properties>
<!--Sql Server 2000-->
<DefaultCollation>SQL_Latin1_General_CP1_CI_AS</DefaultCollation>
<AnsiNullDefault>True</AnsiNullDefault>
<AnsiNulls>True</AnsiNulls>
<AnsiPadding>True</AnsiPadding>
<AnsiWarnings>True</AnsiWarnings>
<ArithAbort>True</ArithAbort>
<ConcatNullYieldsNull>True</ConcatNullYieldsNull>
<QuotedIdentifier>True</QuotedIdentifier>
<NumericRoundAbort>False</NumericRoundAbort>
<RecursiveTriggersEnabled>False</RecursiveTriggersEnabled>
<DatabaseState>ONLINE</DatabaseState>
<UpdateOptions>READ_WRITE</UpdateOptions>
<CloseCursorOnCommitEnabled>False</CloseCursorOnCommitEnabled>
<DefaultCursor>LOCAL</DefaultCursor>
<AutoClose>False</AutoClose>
<AutoCreateStatistics>True</AutoCreateStatistics>
<AutoShrink>False</AutoShrink>
<AutoUpdateStatistics>True</AutoUpdateStatistics>
<TornPageDetection>False</TornPageDetection>
<DatabaseAccess>MULTI_USER</DatabaseAccess>
<Recovery>FULL</Recovery>
<EnableFullTextSearch>True</EnableFullTextSearch>
<DatabaseChaining>False</DatabaseChaining>
<DefaultFilegroup>PRIMARY</DefaultFilegroup>
<!--Sql Server 2005-->
<!--<CompatibilityMode></CompatibilityMode>-->
<Trustworthy>False</Trustworthy>
<AutoUpdateStatisticsAsynchronously>False</AutoUpdateStatisticsAsynchronously>
<PageVerify>NONE</PageVerify>
<ServiceBrokerOption>DisableBroker</ServiceBrokerOption>
<DateCorrelationOptimizationOn>False</DateCorrelationOptimizationOn>
<Parameterization>SIMPLE</Parameterization>
<AllowSnapshotIsolation>False</AllowSnapshotIsolation>
<ReadCommittedSnapshot>False</ReadCommittedSnapshot>
<VardecimalStorageFormatOn>True</VardecimalStorageFormatOn>
<SupplementalLoggingOn>False</SupplementalLoggingOn>
<!--Sql Server 2008-->
<DefaultFileStreamFilegroup></DefaultFileStreamFilegroup>
<IsChangeTrackingOn>False</IsChangeTrackingOn>
<IsChangeTrackingAutoCleanupOn>True</IsChangeTrackingAutoCleanupOn>
<ChangeTrackingRetentionPeriod>2</ChangeTrackingRetentionPeriod>
<ChangeTrackingRetentionUnit>Days</ChangeTrackingRetentionUnit>
<IsEncryptionOn>False</IsEncryptionOn>
<IsBrokerPriorityHonored>False</IsBrokerPriorityHonored>
</Properties>
</CatalogProperties>
@@ -1,11 +0,0 @@
/*
Post-Deployment Script Template
--------------------------------------------------------------------------------------
This file contains SQL statements that will be appended to the build script.
Use SQLCMD syntax to include a file in the post-deployment script.
Example: :r .\myfile.sql
Use SQLCMD syntax to reference a variable in the post-deployment script.
Example: :setvar TableName MyTable
SELECT * FROM [$(TableName)]
--------------------------------------------------------------------------------------
*/
@@ -1,11 +0,0 @@
/*
Pre-Deployment Script Template
--------------------------------------------------------------------------------------
This file contains SQL statements that will be executed before the build script.
Use SQLCMD syntax to include a file in the pre-deployment script.
Example: :r .\myfile.sql
Use SQLCMD syntax to reference a variable in the pre-deployment script.
Example: :setvar TableName MyTable
SELECT * FROM [$(TableName)]
--------------------------------------------------------------------------------------
*/
@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<DataSchemaModel FileFormatVersion="1.2" SchemaVersion="1.1" DspName="Microsoft.Data.Schema.Sql.Sql100DatabaseSchemaProvider" CollationLcid="1033" CollationCaseSensitive="False">
<Header>
<CustomData Category="ModelCapability">
<Metadata Name="ModelCapability" Value="Default" />
</CustomData>
<CustomData Category="ClrTypesDbSchema" Type="DbSchema">
<Metadata Name="ClrTypesDbSchema" Value="True" />
</CustomData>
<CustomData Category="AnsiNulls">
<Metadata Name="AnsiNulls" Value="True" />
</CustomData>
<CustomData Category="QuotedIdentifier">
<Metadata Name="QuotedIdentifier" Value="True" />
</CustomData>
<CustomData Category="CompatibilityMode">
<Metadata Name="CompatibilityMode" Value="100" />
</CustomData>
<CustomData Category="Permissions" Type="XmlPermissions">
<Metadata Name="FileName" Value="C:\PROJECTS\MYFRIENDSAROUND\MYFRIENDSAROUND.DB\PROPERTIES\DATABASE.SQLPERMISSIONS" />
</CustomData>
</Header>
<Model>
<Element Type="ISql100DatabaseOptions">
<Property Name="Collation" Value="SQL_Latin1_General_CP1_CI_AS" />
<Property Name="IsAnsiNullDefaultOn" Value="True" />
<Property Name="IsAnsiNullsOn" Value="True" />
<Property Name="IsAnsiWarningsOn" Value="True" />
<Property Name="IsArithAbortOn" Value="True" />
<Property Name="IsConcatNullYieldsNullOn" Value="True" />
<Property Name="IsTornPageProtectionOn" Value="False" />
<Property Name="IsFullTextEnabled" Value="True" />
<Property Name="PageVerifyMode" Value="3" />
<Relationship Name="DefaultFilegroup">
<Entry>
<References ExternalSource="BuiltIns" Name="[PRIMARY]" />
</Entry>
</Relationship>
</Element>
</Model>
</DataSchemaModel>
@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TargetDatabase>MyFriendsAround.DB</TargetDatabase>
<DeployToDatabase>False</DeployToDatabase>
<DeployToScript>True</DeployToScript>
<SourceModel>MyFriendsAround.DB.dbschema</SourceModel>
<DeployScriptFileName>MyFriendsAround.DB.sql</DeployScriptFileName>
<DeploymentConfigurationFile>MyFriendsAround.DB_Database.sqldeployment</DeploymentConfigurationFile>
</PropertyGroup>
<PropertyGroup>
<SqlCommandVariablesFile>MyFriendsAround.DB_Database.sqlcmdvars</SqlCommandVariablesFile>
</PropertyGroup>
<ItemGroup>
<DeploymentExtensionConfiguration Include="MyFriendsAround.DB_Script.PostDeployment.sql">
<__PostdeploymentMetadata>
</__PostdeploymentMetadata>
</DeploymentExtensionConfiguration>
<DeploymentExtensionConfiguration Include="MyFriendsAround.DB_Script.PreDeployment.sql">
<__PredeploymentMetadata>
</__PredeploymentMetadata>
</DeploymentExtensionConfiguration>
</ItemGroup>
<ItemGroup>
<DeploymentExtension Include="Microsoft.Data.Schema.Sql.Build.SqlPlanOrderModifier">
<Assembly>Microsoft.Data.Schema.Sql</Assembly>
<Version>10.0.0.0</Version>
<Token>sD9ffxHVCjo=</Token>
</DeploymentExtension>
<DeploymentExtension Include="Microsoft.Data.Schema.Sql.Build.SqlPrePostDeploymentModifier">
<Assembly>Microsoft.Data.Schema.Sql</Assembly>
<Version>10.0.0.0</Version>
<Token>sD9ffxHVCjo=</Token>
</DeploymentExtension>
<DeploymentExtension Include="Microsoft.Data.Schema.Sql.Refactoring.SqlRefactoringDeploymentContributor">
<Assembly>Microsoft.Data.Schema.Sql</Assembly>
<Version>10.0.0.0</Version>
<Token>sD9ffxHVCjo=</Token>
</DeploymentExtension>
</ItemGroup>
</Project>
@@ -1,211 +0,0 @@
/*
Deployment script for MyFriendsAround.DB
*/
GO
SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER ON;
SET NUMERIC_ROUNDABORT OFF;
GO
:setvar DatabaseName "MyFriendsAround.DB"
:setvar DefaultDataPath ""
:setvar DefaultLogPath ""
GO
:on error exit
GO
USE [master]
GO
IF (DB_ID(N'$(DatabaseName)') IS NOT NULL
AND DATABASEPROPERTYEX(N'$(DatabaseName)','Status') <> N'ONLINE')
BEGIN
RAISERROR(N'The state of the target database, %s, is not set to ONLINE. To deploy to this database, its state must be set to ONLINE.', 16, 127,N'$(DatabaseName)') WITH NOWAIT
RETURN
END
GO
IF (DB_ID(N'$(DatabaseName)') IS NOT NULL)
BEGIN
ALTER DATABASE [$(DatabaseName)]
SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
DROP DATABASE [$(DatabaseName)];
END
GO
PRINT N'Creating $(DatabaseName)...'
GO
CREATE DATABASE [$(DatabaseName)] COLLATE SQL_Latin1_General_CP1_CI_AS
GO
EXECUTE sp_dbcmptlevel [$(DatabaseName)], 100;
GO
IF EXISTS (SELECT 1
FROM [master].[dbo].[sysdatabases]
WHERE [name] = N'$(DatabaseName)')
BEGIN
ALTER DATABASE [$(DatabaseName)]
SET ANSI_NULLS ON,
ANSI_PADDING ON,
ANSI_WARNINGS ON,
ARITHABORT ON,
CONCAT_NULL_YIELDS_NULL ON,
NUMERIC_ROUNDABORT OFF,
QUOTED_IDENTIFIER ON,
ANSI_NULL_DEFAULT ON,
CURSOR_DEFAULT LOCAL,
RECOVERY FULL,
CURSOR_CLOSE_ON_COMMIT OFF,
AUTO_CREATE_STATISTICS ON,
AUTO_SHRINK OFF,
AUTO_UPDATE_STATISTICS ON,
RECURSIVE_TRIGGERS OFF
WITH ROLLBACK IMMEDIATE;
ALTER DATABASE [$(DatabaseName)]
SET AUTO_CLOSE OFF
WITH ROLLBACK IMMEDIATE;
END
GO
IF EXISTS (SELECT 1
FROM [master].[dbo].[sysdatabases]
WHERE [name] = N'$(DatabaseName)')
BEGIN
ALTER DATABASE [$(DatabaseName)]
SET ALLOW_SNAPSHOT_ISOLATION OFF;
END
GO
IF EXISTS (SELECT 1
FROM [master].[dbo].[sysdatabases]
WHERE [name] = N'$(DatabaseName)')
BEGIN
ALTER DATABASE [$(DatabaseName)]
SET READ_COMMITTED_SNAPSHOT OFF;
END
GO
IF EXISTS (SELECT 1
FROM [master].[dbo].[sysdatabases]
WHERE [name] = N'$(DatabaseName)')
BEGIN
ALTER DATABASE [$(DatabaseName)]
SET AUTO_UPDATE_STATISTICS_ASYNC OFF,
PAGE_VERIFY NONE,
DATE_CORRELATION_OPTIMIZATION OFF,
DISABLE_BROKER,
PARAMETERIZATION SIMPLE,
SUPPLEMENTAL_LOGGING OFF
WITH ROLLBACK IMMEDIATE;
END
GO
IF IS_SRVROLEMEMBER(N'sysadmin') = 1
BEGIN
IF EXISTS (SELECT 1
FROM [master].[dbo].[sysdatabases]
WHERE [name] = N'$(DatabaseName)')
BEGIN
EXECUTE sp_executesql N'ALTER DATABASE [$(DatabaseName)]
SET TRUSTWORTHY OFF,
DB_CHAINING OFF
WITH ROLLBACK IMMEDIATE';
END
END
ELSE
BEGIN
PRINT N'The database settings cannot be modified. You must be a SysAdmin to apply these settings.';
END
GO
IF IS_SRVROLEMEMBER(N'sysadmin') = 1
BEGIN
IF EXISTS (SELECT 1
FROM [master].[dbo].[sysdatabases]
WHERE [name] = N'$(DatabaseName)')
BEGIN
EXECUTE sp_executesql N'ALTER DATABASE [$(DatabaseName)]
SET HONOR_BROKER_PRIORITY OFF
WITH ROLLBACK IMMEDIATE';
END
END
ELSE
BEGIN
PRINT N'The database settings cannot be modified. You must be a SysAdmin to apply these settings.';
END
GO
USE [$(DatabaseName)]
GO
IF fulltextserviceproperty(N'IsFulltextInstalled') = 1
EXECUTE sp_fulltext_database 'enable';
GO
/*
Pre-Deployment Script Template
--------------------------------------------------------------------------------------
This file contains SQL statements that will be executed before the build script.
Use SQLCMD syntax to include a file in the pre-deployment script.
Example: :r .\myfile.sql
Use SQLCMD syntax to reference a variable in the pre-deployment script.
Example: :setvar TableName MyTable
SELECT * FROM [$(TableName)]
--------------------------------------------------------------------------------------
*/
GO
-- Refactoring step to update target server with deployed transaction logs
CREATE TABLE [dbo].[__RefactorLog] (OperationKey UNIQUEIDENTIFIER NOT NULL PRIMARY KEY)
GO
sp_addextendedproperty N'microsoft_database_tools_support', N'refactoring log', N'schema', N'dbo', N'table', N'__RefactorLog'
GO
GO
/*
Post-Deployment Script Template
--------------------------------------------------------------------------------------
This file contains SQL statements that will be appended to the build script.
Use SQLCMD syntax to include a file in the post-deployment script.
Example: :r .\myfile.sql
Use SQLCMD syntax to reference a variable in the post-deployment script.
Example: :setvar TableName MyTable
SELECT * FROM [$(TableName)]
--------------------------------------------------------------------------------------
*/
GO
IF EXISTS (SELECT 1
FROM [master].[dbo].[sysdatabases]
WHERE [name] = N'$(DatabaseName)')
BEGIN
DECLARE @VarDecimalSupported AS BIT;
SELECT @VarDecimalSupported = 0;
IF ((ServerProperty(N'EngineEdition') = 3)
AND (((@@microsoftversion / power(2, 24) = 9)
AND (@@microsoftversion & 0xffff >= 3024))
OR ((@@microsoftversion / power(2, 24) = 10)
AND (@@microsoftversion & 0xffff >= 1600))))
SELECT @VarDecimalSupported = 1;
IF (@VarDecimalSupported > 0)
BEGIN
EXECUTE sp_db_vardecimal_storage_format N'$(DatabaseName)', 'ON';
END
END
GO
ALTER DATABASE [$(DatabaseName)]
SET MULTI_USER
WITH ROLLBACK IMMEDIATE;
GO
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<SqlCommandVariables xmlns="urn:Microsoft.VisualStudio.Data.Schema.Package.SqlCmdVars" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Version>1.0</Version>
<Properties>
</Properties>
</SqlCommandVariables>
@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<DeploymentConfigurationSettings xmlns="urn:Microsoft.VisualStudio.Data.Schema.Package.DeploymentConfigurationSettings" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Version>1.0</Version>
<Properties>
<AlwaysCreateNewDatabase>False</AlwaysCreateNewDatabase>
<BlockIncrementalDeploymentIfDataLoss>True</BlockIncrementalDeploymentIfDataLoss>
<DeployDatabaseProperties>True</DeployDatabaseProperties>
<DeploymentCollationPreference>UseSourceModelCollation</DeploymentCollationPreference>
<DoNotUseAlterAssemblyStatementsToUpdateCLRTypes>False</DoNotUseAlterAssemblyStatementsToUpdateCLRTypes>
<GenerateDropsIfNotInProject>False</GenerateDropsIfNotInProject>
<PerformDatabaseBackup>False</PerformDatabaseBackup>
<SingleUserMode>False</SingleUserMode>
</Properties>
</DeploymentConfigurationSettings>
@@ -1,52 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<CatalogProperties xmlns="urn:Microsoft.VisualStudio.Data.Schema.Package.CatalogProperties" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Version>1.0</Version>
<Properties>
<!--Sql Server 2000-->
<DefaultCollation>SQL_Latin1_General_CP1_CI_AS</DefaultCollation>
<AnsiNullDefault>True</AnsiNullDefault>
<AnsiNulls>True</AnsiNulls>
<AnsiPadding>True</AnsiPadding>
<AnsiWarnings>True</AnsiWarnings>
<ArithAbort>True</ArithAbort>
<ConcatNullYieldsNull>True</ConcatNullYieldsNull>
<QuotedIdentifier>True</QuotedIdentifier>
<NumericRoundAbort>False</NumericRoundAbort>
<RecursiveTriggersEnabled>False</RecursiveTriggersEnabled>
<DatabaseState>ONLINE</DatabaseState>
<UpdateOptions>READ_WRITE</UpdateOptions>
<CloseCursorOnCommitEnabled>False</CloseCursorOnCommitEnabled>
<DefaultCursor>LOCAL</DefaultCursor>
<AutoClose>False</AutoClose>
<AutoCreateStatistics>True</AutoCreateStatistics>
<AutoShrink>False</AutoShrink>
<AutoUpdateStatistics>True</AutoUpdateStatistics>
<TornPageDetection>False</TornPageDetection>
<DatabaseAccess>MULTI_USER</DatabaseAccess>
<Recovery>FULL</Recovery>
<EnableFullTextSearch>True</EnableFullTextSearch>
<DatabaseChaining>False</DatabaseChaining>
<DefaultFilegroup>PRIMARY</DefaultFilegroup>
<!--Sql Server 2005-->
<!--<CompatibilityMode></CompatibilityMode>-->
<Trustworthy>False</Trustworthy>
<AutoUpdateStatisticsAsynchronously>False</AutoUpdateStatisticsAsynchronously>
<PageVerify>NONE</PageVerify>
<ServiceBrokerOption>DisableBroker</ServiceBrokerOption>
<DateCorrelationOptimizationOn>False</DateCorrelationOptimizationOn>
<Parameterization>SIMPLE</Parameterization>
<AllowSnapshotIsolation>False</AllowSnapshotIsolation>
<ReadCommittedSnapshot>False</ReadCommittedSnapshot>
<VardecimalStorageFormatOn>True</VardecimalStorageFormatOn>
<SupplementalLoggingOn>False</SupplementalLoggingOn>
<!--Sql Server 2008-->
<DefaultFileStreamFilegroup></DefaultFileStreamFilegroup>
<IsChangeTrackingOn>False</IsChangeTrackingOn>
<IsChangeTrackingAutoCleanupOn>True</IsChangeTrackingAutoCleanupOn>
<ChangeTrackingRetentionPeriod>2</ChangeTrackingRetentionPeriod>
<ChangeTrackingRetentionUnit>Days</ChangeTrackingRetentionUnit>
<IsEncryptionOn>False</IsEncryptionOn>
<IsBrokerPriorityHonored>False</IsBrokerPriorityHonored>
</Properties>
</CatalogProperties>
@@ -1,11 +0,0 @@
/*
Post-Deployment Script Template
--------------------------------------------------------------------------------------
This file contains SQL statements that will be appended to the build script.
Use SQLCMD syntax to include a file in the post-deployment script.
Example: :r .\myfile.sql
Use SQLCMD syntax to reference a variable in the post-deployment script.
Example: :setvar TableName MyTable
SELECT * FROM [$(TableName)]
--------------------------------------------------------------------------------------
*/
@@ -1,11 +0,0 @@
/*
Pre-Deployment Script Template
--------------------------------------------------------------------------------------
This file contains SQL statements that will be executed before the build script.
Use SQLCMD syntax to include a file in the pre-deployment script.
Example: :r .\myfile.sql
Use SQLCMD syntax to reference a variable in the pre-deployment script.
Example: :setvar TableName MyTable
SELECT * FROM [$(TableName)]
--------------------------------------------------------------------------------------
*/
+40 -11
View File
@@ -1,4 +1,4 @@
<phone:PhoneApplicationPage x:Class="MyFriendsAround.WP7.MainPage"
<phone:PhoneApplicationPage xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" x:Class="MyFriendsAround.WP7.MainPage"
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"
@@ -14,7 +14,7 @@
d:DesignHeight="768"
shell:SystemTray.IsVisible="True"
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">
<!--LayoutRoot contains the root grid where all other page content is placed-->
@@ -50,30 +50,36 @@
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentGrid"
Grid.Row="1">
Grid.Row="1"
Margin="0,0,0,70">
<TextBlock Text="{Binding Welcome}"
Style="{StaticResource PhoneTextNormalStyle}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="40" />
<Button Content="Publish" Height="72" HorizontalAlignment="Left" Margin="6,539,0,0" Name="btnPublishLocation" VerticalAlignment="Top" Width="468">
<!--<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>
</Button>-->
<TextBox Height="72" HorizontalAlignment="Left" Margin="6,471,0,0" Name="txtMyName" Text="{Binding Path=MyName, Mode=TwoWay}" VerticalAlignment="Top" Width="468" />
<TextBox Height="67" HorizontalAlignment="Left" Margin="6,0,0,6" Name="txtMyName" Text="{Binding Path=MyName, Mode=TwoWay}" VerticalAlignment="Bottom" Width="468" />
<my:Map x:Name="map"
Height="459"
Height="468"
HorizontalAlignment="Left"
Margin="6,6,0,0"
Margin="6,0,0,0"
VerticalAlignment="Top"
Width="468"
Center="{Binding Path=MapCenter, Mode=TwoWay}">
<my:MapItemsControl ItemsSource="{Binding PushPins}">
<my:MapItemsControl ItemsSource="{Binding PushPins}"
>
<my:MapItemsControl.ItemTemplate>
<DataTemplate>
<my:Pushpin Location="{Binding Location}"
@@ -83,9 +89,31 @@
</my:MapItemsControl.ItemTemplate>
</my:MapItemsControl>
</my:Map>
<toolkit:PerformanceProgressBar HorizontalAlignment="Left"
Margin="0,-151,0,0"
Name="performanceProgressBar1"
VerticalAlignment="Top"
Height="18"
Width="480"
ActualIsIndeterminate="{Binding Path=IsBusy}"
IsIndeterminate="{Binding Path=IsBusy}" />
</Grid>
</Grid>
<Preview:BindableApplicationBar x:Name="AppBar"
BarOpacity="0.5">
<Preview:BindableApplicationBarIconButton Command="{Binding PublishLocationCommand}"
IconUri="/icons/appbar.publish.png"
Text="{Binding AppBarTextPublish}" />
<Preview:BindableApplicationBarIconButton Command="{Binding DisplayAboutCommand}"
IconUri="/icons/appbar.questionmark.rest.png"
Text="{Binding AppBarTextAbout}" />
<Preview:BindableApplicationBar.MenuItems>
<Preview:BindableApplicationBarMenuItem Text="Settings"
Command="{Binding InputBoxCommand}" />
</Preview:BindableApplicationBar.MenuItems>
</Preview:BindableApplicationBar>
</Grid>
<!-- Sample code showing usage of ApplicationBar
<phone:PhoneApplicationPage.ApplicationBar>
@@ -100,5 +128,6 @@
</phone:PhoneApplicationPage.ApplicationBar>
-->
</phone:PhoneApplicationPage>
@@ -152,6 +152,12 @@
<Content Include="Background.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="icons\appbar.publish.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="icons\appbar.questionmark.rest.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="README_FIRST.txt" />
<Content Include="SplashScreenImage.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -165,6 +171,16 @@
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Libs\GpsEmulator\GpsEmulatorClient\GpsEmulatorClient.csproj">
<Project>{A128812A-1249-4562-BDF4-5E17951B8434}</Project>
<Name>GpsEmulatorClient</Name>
</ProjectReference>
<ProjectReference Include="..\Libs\Phone7.Fx.Preview\Phone7.Fx.Preview.csproj">
<Project>{B55A0F90-2B5A-4C4B-88F4-013AA1629866}</Project>
<Name>Phone7.Fx.Preview</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.$(TargetFrameworkProfile).Overrides.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@@ -39,7 +39,7 @@ namespace MyFriendsAround.WP7.ViewModel
{
get
{
return "MVVM LIGHT";
return "MyFriendsAround";
}
}
@@ -47,8 +47,7 @@ namespace MyFriendsAround.WP7.ViewModel
{
get
{
//myfriendsservice
return "My page:";
return "Friends Map";
}
}
@@ -67,6 +66,9 @@ namespace MyFriendsAround.WP7.ViewModel
{
MyName = "Guest";
PublishLocationCommand = new RelayCommand(() => PublishLocationAction());
DisplayAboutCommand = new RelayCommand(() => DisplayAbout());
InputBoxCommand = new RelayCommand(() => InputBox());
if (IsInDesignMode)
{
// Code runs in Blend --> create design time data.
@@ -74,11 +76,24 @@ namespace MyFriendsAround.WP7.ViewModel
else
{
// Code runs "for real"
IsBusy = true;
ServiceAgent.GetFriends(this.GetFriendsResult);
}
}
private void InputBox()
{
MessageBox.Show("Input box");
}
private void DisplayAbout()
{
MessageBox.Show("About");
}
private void PopulatePushPins(List<Friend> list)
{
ObservableCollection<PushPinModel> result = new ObservableCollection<PushPinModel>();
@@ -92,7 +107,6 @@ namespace MyFriendsAround.WP7.ViewModel
});
});
PushPins = result;
}
@@ -103,6 +117,7 @@ namespace MyFriendsAround.WP7.ViewModel
myInfo.FriendName = MyName;
myInfo.LastUpdated = DateTime.UtcNow;
myInfo.LocationStr = string.Format("POINT({0} {1})", MapCenter.Latitude, MapCenter.Longitude);
IsBusy = true;
ServiceAgent.PublishLocation(myInfo, new EventHandler<PublishLocationEventArgs>(PublishLocationResult));
}
@@ -112,6 +127,7 @@ namespace MyFriendsAround.WP7.ViewModel
DispatcherHelper.CheckBeginInvokeOnUI(() =>
{
PopulatePushPins(list);
IsBusy = false;
}
);
}
@@ -146,8 +162,20 @@ namespace MyFriendsAround.WP7.ViewModel
}
public RelayCommand PublishLocationCommand { get; set; }
public RelayCommand DisplayAboutCommand { get; set; }
public RelayCommand InputBoxCommand { get; set; }
public string MyName { get; set; }
public string AppBarTextAbout {
get { return "About"; }
}
public string AppBarTextPublish
{
get { return "Publish"; }
}
////public override void Cleanup()
////{
//// // Clean up if needed
@@ -224,5 +252,38 @@ namespace MyFriendsAround.WP7.ViewModel
//RaisePropertyChanged(MapCenterPropertyName, oldValue, value, true);
}
}
/// <summary>
/// The <see cref="IsBusy" /> property's name.
/// </summary>
public const string IsBusyPropertyName = "IsBusy";
private bool _isBusy = false;
/// <summary>
/// Gets the IsBusy property.
/// </summary>
public bool IsBusy
{
get
{
return _isBusy;
}
set
{
if (_isBusy == value)
{
return;
}
var oldValue = _isBusy;
_isBusy = value;
// Update bindings, no broadcast
RaisePropertyChanged(IsBusyPropertyName);
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 912 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

@@ -18,7 +18,7 @@
});
}
$(document).ready(function () {
setInterval('getTimeFromserver();', 3000);
setInterval('getTimeFromserver();', 10000);
});
</script>
</p>
+18
View File
@@ -26,6 +26,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GpsEmulatorClient", "Libs\G
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GpsEmulatorPhoneTestClient", "Libs\GpsEmulator\GpsEmulatorPhoneTestClient\GpsEmulatorPhoneTestClient.csproj", "{BF7316A8-A2C5-4176-8D7F-672AD12F474D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Phone7.Fx.Preview", "Libs\Phone7.Fx.Preview\Phone7.Fx.Preview.csproj", "{B55A0F90-2B5A-4C4B-88F4-013AA1629866}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -205,6 +207,21 @@ Global
{BF7316A8-A2C5-4176-8D7F-672AD12F474D}.Tests|Mixed Platforms.Build.0 = Tests|Any CPU
{BF7316A8-A2C5-4176-8D7F-672AD12F474D}.Tests|Mixed Platforms.Deploy.0 = Tests|Any CPU
{BF7316A8-A2C5-4176-8D7F-672AD12F474D}.Tests|x86.ActiveCfg = Tests|Any CPU
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Debug|x86.ActiveCfg = Debug|Any CPU
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Release|Any CPU.Build.0 = Release|Any CPU
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Release|x86.ActiveCfg = Release|Any CPU
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Tests|Any CPU.ActiveCfg = Release|Any CPU
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Tests|Any CPU.Build.0 = Release|Any CPU
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Tests|Mixed Platforms.ActiveCfg = Release|Any CPU
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Tests|Mixed Platforms.Build.0 = Release|Any CPU
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Tests|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -213,5 +230,6 @@ Global
{566AEE14-134C-4EE4-93B5-1FFB021DE678} = {340549A1-45EA-4B49-B194-347C0078BAD8}
{A128812A-1249-4562-BDF4-5E17951B8434} = {340549A1-45EA-4B49-B194-347C0078BAD8}
{BF7316A8-A2C5-4176-8D7F-672AD12F474D} = {340549A1-45EA-4B49-B194-347C0078BAD8}
{B55A0F90-2B5A-4C4B-88F4-013AA1629866} = {340549A1-45EA-4B49-B194-347C0078BAD8}
EndGlobalSection
EndGlobal