internal class StorageManager where T : class
{
private readonly string _dataKey;
///
/// The StorageManager abstracts the access
/// for Loading and Saving data. It also offers defaultContextCreation.
///
/// IsolatedStorage unique key public StorageManager(string key)
{
_dataKey = key;
}
[...]
Windows Phone Performance Analysis (SDK Tool):
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202932%28v=vs.92%29.aspx
http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff967560%28v=vs.92%29.aspx
Good article about the differences between WPF and Silverlight rendering
http://jmorrill.hjtcentral.com/Home/tabid/428/EntryId/446/Differences-between-WPF-and-Silverlight-Rendering-Stacks.aspx
http://blogs.msdn.com/b/dwayneneed/archive/2007/04/26/multithreaded-ui-hostvisual.aspx
http://khason.net/blog/how-to-high-performance-graphics-in-wpf/
I needed to add a Summary TextBlock to my app that contained multiple colors in a single TextBlock. This is easily achieved using TextBlock.Inlines, but that is not a DependencyProperty and I wanted to stick to my MVVM pattern. So I decided to use a few small models, converter and an ItemsControl.
I used [...]
This has come in very useful on a recent project whereby the View was bound directly to a Model for reasons too verbose to explain here.
I found that a Textbox value was not updating back to the Model if focus remained on that Textbox when the user clicked on a Toolbar Button bound [...]
Here is a nice helper class for comparing primitive numeric types using a simple epsilon value.
public static class MathsHelper { private const double Epsilon = 0.0001D; public static bool AreEqualValues(float v1, float v2) { return Math.Abs(v1 – v2) < Epsilon; } public static bool AreEqualValues(double v1, double v2) { return Math.Abs(v1 – [...]
This is the best way I have found to sort an IList collection:
ArrayList.Adapter(targetIList).Sort();
An example of how to launch a WPF window from a Winforms host and enable intercommunication using the excellent EventAggregator from PRISM.
Create a Winforms application. Add a button and label to the Form1. Add WPF Custom Control library to the solution. Add a WPF Window. Reference the WPF project from the Winforms project add [...]
This guide will get you started with web services using wcf.
1. Create a new project in Visual Studio 2010 of type “WCF Service Library”
2. Add these classes (delete the pre-made ones)
[ServiceContract] public interface ILicenceKeyService { [OperationContract] ClientKeyResponse GetChartClientKey(ClientKeyRequest composite); } [DataContract] public class ClientKeyRequest { [DataMember] public string CompanyName { get; [...]
This very simple little behavior is MVVM safe and allows you to execute a Command and pass a CommandParameter when the Esc or Enter/Return key is pressed on any UIElement. I originally developed this so that I could execute a ICommand on a TextBox when the user pressed those keys, but you could add any [...]
Here is a simple DeepCopy method I use in my projects. To use it I just decorate my objects using the DataContract attribute.
public static T DeepCopy<T>(T obj) { using (var stream = new MemoryStream()) { var serializer = new DataContractSerializer(typeof(T)); serializer.WriteObject(stream, obj); stream.Position = 0; return (T) serializer.ReadObject(stream); } }
Categories


