# HG changeset patch # User Steven Hollidge # Date 1335032428 -3600 # Node ID 3591c26bd63ef5b5693f95fa01b1a3108092e4e0 # Parent 241e2f22ed3c040a3159066c0f80de13c7eef969 MVVMLight added diff -r 241e2f22ed3c -r 3591c26bd63e .hgignore --- a/.hgignore Sat Apr 21 15:06:48 2012 +0100 +++ b/.hgignore Sat Apr 21 19:20:28 2012 +0100 @@ -8,3 +8,4 @@ *.DotSettings.user */packages/* *.stats +*/Bin/* diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelector/DataTemplateSelector.sln --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelector/DataTemplateSelector.sln Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataTemplateSelector", "DataTemplateSelector\DataTemplateSelector.csproj", "{F8908AA9-E5B7-4236-8B06-3DBF2F9DFDAE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F8908AA9-E5B7-4236-8B06-3DBF2F9DFDAE}.Debug|x86.ActiveCfg = Debug|x86 + {F8908AA9-E5B7-4236-8B06-3DBF2F9DFDAE}.Debug|x86.Build.0 = Debug|x86 + {F8908AA9-E5B7-4236-8B06-3DBF2F9DFDAE}.Release|x86.ActiveCfg = Release|x86 + {F8908AA9-E5B7-4236-8B06-3DBF2F9DFDAE}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelector/DataTemplateSelector/App.xaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelector/DataTemplateSelector/App.xaml Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,8 @@ + + + + + diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelector/DataTemplateSelector/App.xaml.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelector/DataTemplateSelector/App.xaml.cs Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Windows; + +namespace DataTemplateSelector +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelector/DataTemplateSelector/Class1.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelector/DataTemplateSelector/Class1.cs Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace DataTemplateSelector +{ + class Class1 + { + } +} diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelector/DataTemplateSelector/DataTemplateSelector.csproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelector/DataTemplateSelector/DataTemplateSelector.csproj Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,103 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {F8908AA9-E5B7-4236-8B06-3DBF2F9DFDAE} + WinExe + Properties + DataTemplateSelector + DataTemplateSelector + v4.0 + Client + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + \ No newline at end of file diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelector/DataTemplateSelector/MainWindow.xaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelector/DataTemplateSelector/MainWindow.xaml Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,8 @@ + + + + + diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelector/DataTemplateSelector/MainWindow.xaml.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelector/DataTemplateSelector/MainWindow.xaml.cs Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace DataTemplateSelector +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + } +} diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelector/DataTemplateSelector/Properties/AssemblyInfo.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelector/DataTemplateSelector/Properties/AssemblyInfo.cs Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// 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("DataTemplateSelector")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("DataTemplateSelector")] +[assembly: AssemblyCopyright("Copyright © 2012")] +[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)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// 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 Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelector/DataTemplateSelector/Properties/Resources.Designer.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelector/DataTemplateSelector/Properties/Resources.Designer.cs Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.17379 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace DataTemplateSelector.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DataTemplateSelector.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelector/DataTemplateSelector/Properties/Resources.resx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelector/DataTemplateSelector/Properties/Resources.resx Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelector/DataTemplateSelector/Properties/Settings.Designer.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelector/DataTemplateSelector/Properties/Settings.Designer.cs Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.17379 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace DataTemplateSelector.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelector/DataTemplateSelector/Properties/Settings.settings --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelector/DataTemplateSelector/Properties/Settings.settings Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelector/DataTemplateSelector/Transaction.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelector/DataTemplateSelector/Transaction.cs Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,139 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; + +namespace DataTemplateSelector +{ + public enum Currency + { + NotSet = 0, + Euro, + GBP, + USD, + } + + public enum Type + { + NotSet = 0, + Buy, + Sell + } + + public class Transaction : INotifyPropertyChanged + { + #region Fields + + private decimal _cost; + private Currency _currency; + private string _isin; + private decimal _quantity; + private string _ticker; + private DateTime _tradeDate; + private Type _type; + private decimal _unitPrice; + + #endregion + + #region Properties + + public decimal Cost + { + get { return _cost; } + set { if (_cost == value) return; _cost = value; OnPropertyChanged("Cost"); } + } + + public Currency Currency + { + get { return _currency; } + set { if (_currency == value) return; _currency = value; OnPropertyChanged("Currency"); } + } + + public string ISIN + { + get { return _isin; } + set { if (_isin == value) return; _isin = value; OnPropertyChanged("ISIN"); } + } + + public decimal Quantity + { + get { return _quantity; } + set { if (_quantity == value) return; _quantity = value; OnPropertyChanged("Quantity"); } + } + + public string Ticker + { + get { return _ticker; } + set { if (_ticker == value) return; _ticker = value; OnPropertyChanged("Ticker"); } + } + + public DateTime TradeDate + { + get { return _tradeDate; } + set { if (_tradeDate == value) return; _tradeDate = value; OnPropertyChanged("TradeDate"); } + } + + public Type Type + { + get { return _type; } + set { if (_type == value) return; _type = value; OnPropertyChanged("Type"); } + } + + public decimal UnitPrice + { + get { return _unitPrice; } + set { if (_unitPrice == value) return; _unitPrice = value; OnPropertyChanged("UnitPrice"); } + } + + #endregion + + #region Factory + + public static Transaction Create(decimal cost, + Currency currency, + string isin, + decimal quantity, + string ticker, + DateTime tradeDate, + Type type, + decimal unitPrice) + { + return new Transaction() + { + _cost = cost, + _currency = currency, + _isin = isin, + _quantity = quantity, + _ticker = ticker, + _tradeDate = tradeDate, + _type = type, + _unitPrice = unitPrice + }; + } + + #endregion + + #region INPC + + public event PropertyChangedEventHandler PropertyChanged = delegate { }; + + protected void OnPropertyChanged(string propertyName) + { + PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + + #endregion + } + + public class Factory + { + public static List CreateTransactions() + { + return new List + { + Transaction.Create(627710m, Currency.USD, "US38259P5089", 1000, "GOOG", new DateTime(2012, 04, 10, 14, 34, 00), Type.Buy, 627.71m), + Transaction.Create(632410m, Currency.USD, "US0378331005", 1000, "AAPL", new DateTime(2012, 04, 10, 14, 35, 00), Type.Buy, 632.41m), + + }; + } + } +} diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelectorDemo/DataTemplateSelectorDemo.sln --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelectorDemo/DataTemplateSelectorDemo.sln Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataTemplateSelectorDemo", "DataTemplateSelectorDemo\DataTemplateSelectorDemo.csproj", "{C7EDDADE-F9E0-4478-A1A5-9E8FC1F706CF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C7EDDADE-F9E0-4478-A1A5-9E8FC1F706CF}.Debug|x86.ActiveCfg = Debug|x86 + {C7EDDADE-F9E0-4478-A1A5-9E8FC1F706CF}.Debug|x86.Build.0 = Debug|x86 + {C7EDDADE-F9E0-4478-A1A5-9E8FC1F706CF}.Release|x86.ActiveCfg = Release|x86 + {C7EDDADE-F9E0-4478-A1A5-9E8FC1F706CF}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelectorDemo/DataTemplateSelectorDemo/App.xaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelectorDemo/DataTemplateSelectorDemo/App.xaml Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,8 @@ + + + + + diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelectorDemo/DataTemplateSelectorDemo/App.xaml.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelectorDemo/DataTemplateSelectorDemo/App.xaml.cs Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Windows; + +namespace DataTemplateSelectorDemo +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelectorDemo/DataTemplateSelectorDemo/DataTemplateSelectorDemo.csproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelectorDemo/DataTemplateSelectorDemo/DataTemplateSelectorDemo.csproj Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,106 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {C7EDDADE-F9E0-4478-A1A5-9E8FC1F706CF} + WinExe + Properties + DataTemplateSelectorDemo + DataTemplateSelectorDemo + v4.0 + Client + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + \ No newline at end of file diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelectorDemo/DataTemplateSelectorDemo/Factory.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelectorDemo/DataTemplateSelectorDemo/Factory.cs Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,14 @@ +using System; +using System.Collections.ObjectModel; + +namespace DataTemplateSelectorDemo +{ + public class Factory : ObservableCollection + { + public Factory() + { + Add(Transaction.Create(1000, "GOOG", new DateTime(2012, 04, 10, 14, 34, 00), Type.BUY, 627.71m)); + Add(Transaction.Create(1000, "AAPL", new DateTime(2012, 04, 10, 14, 35, 00), Type.BUY, 632.41m)); + } + } +} diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelectorDemo/DataTemplateSelectorDemo/MainWindow.xaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelectorDemo/DataTemplateSelectorDemo/MainWindow.xaml Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelectorDemo/DataTemplateSelectorDemo/MainWindow.xaml.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelectorDemo/DataTemplateSelectorDemo/MainWindow.xaml.cs Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace DataTemplateSelectorDemo +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + } +} diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelectorDemo/DataTemplateSelectorDemo/Properties/AssemblyInfo.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelectorDemo/DataTemplateSelectorDemo/Properties/AssemblyInfo.cs Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// 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("DataTemplateSelectorDemo")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("DataTemplateSelectorDemo")] +[assembly: AssemblyCopyright("Copyright © 2012")] +[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)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// 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 Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelectorDemo/DataTemplateSelectorDemo/Properties/Resources.Designer.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelectorDemo/DataTemplateSelectorDemo/Properties/Resources.Designer.cs Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.17379 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace DataTemplateSelectorDemo.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DataTemplateSelectorDemo.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelectorDemo/DataTemplateSelectorDemo/Properties/Resources.resx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelectorDemo/DataTemplateSelectorDemo/Properties/Resources.resx Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelectorDemo/DataTemplateSelectorDemo/Properties/Settings.Designer.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelectorDemo/DataTemplateSelectorDemo/Properties/Settings.Designer.cs Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.17379 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace DataTemplateSelectorDemo.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelectorDemo/DataTemplateSelectorDemo/Properties/Settings.settings --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelectorDemo/DataTemplateSelectorDemo/Properties/Settings.settings Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelectorDemo/DataTemplateSelectorDemo/Transaction.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelectorDemo/DataTemplateSelectorDemo/Transaction.cs Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,91 @@ +using System; +using System.ComponentModel; + +namespace DataTemplateSelectorDemo +{ + #region Enums + + public enum Type { NotSet = 0, BUY, SELL} + + #endregion + + public class Transaction : INotifyPropertyChanged + { + #region Fields + + private decimal _quantity; + private string _ticker; + private DateTime _tradeDate; + private Type _type; + private decimal _unitPrice; + + #endregion + + #region Properties + + public decimal Cost { get { return _type == Type.BUY ? (_unitPrice * _quantity) : ((_unitPrice * -1) * _quantity) ; } } + + public decimal Quantity + { + get { return _quantity; } + set { if (_quantity == value) return; _quantity = value; OnPropertyChanged("Quantity"); OnPropertyChanged("Cost"); } + } + + public string Ticker + { + get { return _ticker; } + set { if (_ticker == value) return; _ticker = value; OnPropertyChanged("Ticker"); } + } + + public DateTime TradeDate + { + get { return _tradeDate; } + set { if (_tradeDate == value) return; _tradeDate = value; OnPropertyChanged("TradeDate"); } + } + + public Type Type + { + get { return _type; } + set { if (_type == value) return; _type = value; OnPropertyChanged("Type"); OnPropertyChanged("Cost"); } + } + + public decimal UnitPrice + { + get { return _unitPrice; } + set { if (_unitPrice == value) return; _unitPrice = value; OnPropertyChanged("UnitPrice"); OnPropertyChanged("Cost"); } + } + + #endregion + + #region Factory + + public static Transaction Create(decimal quantity, + string ticker, + DateTime tradeDate, + Type type, + decimal unitPrice) + { + return new Transaction() + { + _quantity = quantity, + _ticker = ticker, + _tradeDate = tradeDate, + _type = type, + _unitPrice = unitPrice + }; + } + + #endregion + + #region INPC + + public event PropertyChangedEventHandler PropertyChanged = delegate { }; + + protected void OnPropertyChanged(string propertyName) + { + PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + + #endregion + } +} diff -r 241e2f22ed3c -r 3591c26bd63e DataTemplateSelectorDemo/DataTemplateSelectorDemo/TransactionListDataTemplateSelector.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DataTemplateSelectorDemo/DataTemplateSelectorDemo/TransactionListDataTemplateSelector.cs Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,27 @@ +using System.Windows; +using System.Windows.Controls; + +namespace DataTemplateSelectorDemo +{ + public class TransactionListDataTemplateSelector : DataTemplateSelector + { + public override DataTemplate SelectTemplate(object item, DependencyObject container) + { + var element = container as FrameworkElement; + + if (element != null && item != null && item is Transaction) + { + var transaction = item as Transaction; + + if (transaction.Type == Type.BUY) + return + element.FindResource("buyTransactionTemplate") as DataTemplate; + else + return + element.FindResource("sellTransactionTemplate") as DataTemplate; + } + + return null; + } + } +} diff -r 241e2f22ed3c -r 3591c26bd63e Glimpse/Glimpse Controls/BrokenBindingsViewer.xaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Glimpse/Glimpse Controls/BrokenBindingsViewer.xaml Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,9 @@ + + + + + + + diff -r 241e2f22ed3c -r 3591c26bd63e Glimpse/Glimpse Controls/BrokenBindingsViewer.xaml.vb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Glimpse/Glimpse Controls/BrokenBindingsViewer.xaml.vb Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,79 @@ +Imports System.Reflection +Imports System.Windows.Data +Partial Public Class BrokenBindingsViewer + Inherits UserControl + + Public Sub New() + InitializeComponent() + End Sub + + Private Sub BrokenBindings_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded + Me.icBrokenBindings.Items.Clear() + LoadBrokenBindings(GlimpseService.CreateInstance.RootVisual) + End Sub + + Private Sub LoadBrokenBindings(ByVal uie As UIElement) + + Dim fwe As FrameworkElement = TryCast(uie, FrameworkElement) + + If fwe IsNot Nothing Then + + For Each fi As FieldInfo In fwe.GetType.GetFields(BindingFlags.Public Or BindingFlags.FlattenHierarchy Or BindingFlags.Instance Or BindingFlags.Static) + + If fi.FieldType Is GetType(DependencyProperty) Then + + Dim be As BindingExpression = fwe.GetBindingExpression(DirectCast(fi.GetValue(Nothing), DependencyProperty)) + + If be IsNot Nothing AndAlso be.ParentBinding.Source Is Nothing AndAlso be.ParentBinding.RelativeSource Is Nothing Then + + Dim bolIsInherited As Boolean = False + + If fwe.DataContext IsNot Nothing AndAlso Not String.IsNullOrEmpty(be.ParentBinding.Path.Path) Then + + For Each p As PropertyInfo In fwe.DataContext.GetType.GetProperties(BindingFlags.Public Or BindingFlags.FlattenHierarchy Or BindingFlags.Static Or BindingFlags.Instance) + + If String.Compare(p.Name, be.ParentBinding.Path.Path) = 0 Then + bolIsInherited = True + Exit For + End If + + Next + + End If + + If bolIsInherited Then + Exit For + End If + + 'this code handles empty bindings on the Button controls + 'I'll have to look into why the Button has an empty or unresolved binding + If fwe.Name = "" AndAlso fwe.GetType.Name = "TextBlock" AndAlso fi.Name = "TextProperty" AndAlso be.ParentBinding.Path.Path = "" Then + Exit For + End If + + Dim objBrokenBinding As New BrokenBinding(fwe.Name, fwe.GetType.Name, fi.Name, be.ParentBinding.Path.Path) + Me.icBrokenBindings.Items.Add(objBrokenBinding) + System.Diagnostics.Debug.WriteLine(String.Format("Broken Binding - ", objBrokenBinding.ToString)) + End If + + End If + + Next + + Dim children As Integer = VisualTreeHelper.GetChildrenCount(fwe) + + For intX As Integer = 0 To children - 1 + + Dim child As FrameworkElement = TryCast(VisualTreeHelper.GetChild(fwe, intX), FrameworkElement) + + If child IsNot Nothing Then + LoadBrokenBindings(child) + End If + + Next + + End If + + End Sub + +End Class diff -r 241e2f22ed3c -r 3591c26bd63e Glimpse/Glimpse Controls/ExceptionsViewer.xaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Glimpse/Glimpse Controls/ExceptionsViewer.xaml Sat Apr 21 19:20:28 2012 +0100 @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +