Mercurial > silverbladetech
changeset 24:a8b50a087544
Stocks and FxRates working, new menu introduced. Working nicely so far
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.Common/Ccy.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,16 @@ +namespace FxRates.Common +{ + public enum Ccy + { + EURtoUSD, + USDtoJPY, + GBPtoUSD, + EURtoGBP, + USDtoCHF, + EURtoJPY, + EURtoCHF, + USDtoCAD, + AUDtoUSD, + GBPtoJPY + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.Common/FxRate.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,39 @@ +using System; + +namespace FxRates.Common +{ + public class FxRate : IFxRate + { + private FxRate(Ccy ccy, decimal bid, decimal offer, DateTime timestamp) + { + Ccy = ccy; + Bid = bid; + PreviousOffer = offer; + Offer = offer; + Timestamp = timestamp; + } + + #region IFxRate Members + + public decimal Bid { get; private set; } + public Ccy Ccy { get; private set; } + public decimal Offer { get; private set; } + public decimal PreviousOffer { get; private set; } + public DateTime Timestamp { get; private set; } + + #endregion + + public static FxRate Create(Ccy ccy, decimal bid, decimal offer, DateTime timestamp) + { + return new FxRate(ccy, bid, offer, timestamp); + } + + public void UpdatePrice(decimal bid, decimal offer, DateTime timestamp) + { + Bid = bid; + PreviousOffer = Offer; + Offer = offer; + Timestamp = timestamp; + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.Common/FxRates.Common.csproj Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,53 @@ +<?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>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{789B8256-13E5-41B0-84B5-29A98A3F6E74}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>FxRates.Common</RootNamespace> + <AssemblyName>FxRates.Common</AssemblyName> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <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</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Core" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Ccy.cs" /> + <Compile Include="FxRate.cs" /> + <Compile Include="IFxRate.cs" /> + <Compile Include="IPricingService.cs" /> + <Compile Include="PriceUpdateEventArgs.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- 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> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.Common/IFxRate.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,13 @@ +using System; + +namespace FxRates.Common +{ + public interface IFxRate + { + decimal Bid { get; } + Ccy Ccy { get; } + decimal Offer { get; } + decimal PreviousOffer { get; } + DateTime Timestamp { get; } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.Common/IPricingService.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; + +namespace FxRates.Common +{ + public interface IPricingService + { + bool IsRunning { get; } + List<FxRate> GetFullCurrentPrices(); + void Start(); + void Stop(); + event EventHandler<PriceUpdateEventArgs> PriceUpdate; + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.Common/PriceUpdateEventArgs.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,9 @@ +using System; + +namespace FxRates.Common +{ + public class PriceUpdateEventArgs : EventArgs + { + public FxRate LatestPrice { get; set; } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.Common/Properties/AssemblyInfo.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,39 @@ +using System.Reflection; +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("FxRates.Common")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("FxRates.Common")] +[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)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM + +[assembly: Guid("bd6efb1c-907d-4a6f-9599-42e64a863603")] + +// 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")] \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.Service/FxRates.Service.csproj Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,56 @@ +<?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>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{0AFFFD20-14C7-44A9-B27E-93165001241C}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>FxRates.Service</RootNamespace> + <AssemblyName>FxRates.Service</AssemblyName> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <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</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Core" /> + </ItemGroup> + <ItemGroup> + <Compile Include="PriceFactory.cs" /> + <Compile Include="PricingService.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\FxRates.Common\FxRates.Common.csproj"> + <Project>{789B8256-13E5-41B0-84B5-29A98A3F6E74}</Project> + <Name>FxRates.Common</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- 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> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.Service/PriceFactory.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using FxRates.Common; + +namespace FxRates.Service +{ + class PriceFactory + { + private int _numberOfCcys; + + public PriceFactory() + { + _numberOfCcys = (int) Enum.GetValues(typeof(Ccy)).Cast<Ccy>().Max() + 1; + } + + public readonly List<FxRate> CurrentPrices = new List<FxRate> + { + FxRate.Create(Ccy.AUDtoUSD, (decimal) 1.0724, (decimal) 1.0731, DateTime.Now), + FxRate.Create(Ccy.EURtoCHF, (decimal) 1.2075, (decimal) 1.2094, DateTime.Now), + FxRate.Create(Ccy.EURtoGBP, (decimal) 0.8375, (decimal) 0.8401, DateTime.Now), + FxRate.Create(Ccy.EURtoJPY, (decimal) 103.2930, (decimal) 103.3180, DateTime.Now), + FxRate.Create(Ccy.EURtoUSD, (decimal) 1.3154, (decimal) 1.3276, DateTime.Now), + FxRate.Create(Ccy.GBPtoJPY, (decimal) 123.3250, (decimal) 123.3350, DateTime.Now), + FxRate.Create(Ccy.GBPtoUSD, (decimal) 1.5707, (decimal) 1.5723, DateTime.Now), + FxRate.Create(Ccy.USDtoCAD, (decimal) 0.9974, (decimal) 0.9999, DateTime.Now), + FxRate.Create(Ccy.USDtoCHF, (decimal) 0.9179, (decimal) 0.9191, DateTime.Now), + FxRate.Create(Ccy.USDtoJPY, (decimal) 78.5090, (decimal) 78.5187, DateTime.Now) + }; + + public FxRate GetNextPrice() + { + Random random = new Random(); + + var ccyIndex = random.Next(0, _numberOfCcys); + var rate = CurrentPrices[ccyIndex]; + + int randomSpread = random.Next(-100, 100); + decimal deltaPercentage = (decimal) randomSpread / 10000; + if (deltaPercentage != 0) + { + var bid = Math.Round(rate.Bid * (1 + deltaPercentage), 4); + var offer = Math.Round(rate.Offer * (1 + deltaPercentage), 4); + rate.UpdatePrice(bid, offer, DateTime.Now); + } + return rate; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.Service/PricingService.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,47 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using FxRates.Common; +using System.Collections.Generic; + +namespace FxRates.Service +{ + public class PricingService : IPricingService + { + PriceFactory factory; + bool _isRunning = false; + public bool IsRunning { get { return _isRunning; } } + + public PricingService() + { + factory = new PriceFactory(); + } + + public void Start() + { + Task.Factory.StartNew(() => + { + _isRunning = true; + while (_isRunning) + { + Thread.Sleep(10); + if (PriceUpdate == null) continue; + var latestPrice = factory.GetNextPrice(); + PriceUpdate(null, new PriceUpdateEventArgs { LatestPrice = latestPrice }); + } + }); + } + + public void Stop() + { + _isRunning = false; + } + + public List<FxRate> GetFullCurrentPrices() + { + return factory.CurrentPrices; + } + + public event EventHandler<PriceUpdateEventArgs> PriceUpdate; + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.Service/Properties/AssemblyInfo.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,36 @@ +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("FxRates.Service")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("FxRates.Service")] +[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)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("9a0b61cc-fb8c-4208-8248-90665e07b757")] + +// 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")]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.UI/Controls/TimerTextBlock.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,187 @@ +using System; +using System.Threading; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; + +namespace FxRates.UI.Controls +{ + public delegate void Invoker(); + + public class TimerTextBlock : TextBlock + { + //private static Timer _UpdateTimer = new Timer(UpdateTimer, null, 1000, 1000); + + public static readonly DependencyProperty TimeSpanProperty = + DependencyProperty.Register("TimeSpan", typeof (TimeSpan), typeof (TimerTextBlock), + new UIPropertyMetadata(TimeSpan.Zero)); + + public static readonly DependencyProperty IsStartedProperty = + DependencyProperty.Register("IsStarted", typeof (bool), typeof (TimerTextBlock), + new UIPropertyMetadata(false)); + + public static readonly DependencyProperty TimeFormatProperty = + DependencyProperty.Register("TimeFormat", typeof (string), typeof (TimerTextBlock), + new UIPropertyMetadata(null)); + + public static readonly DependencyProperty IsCountDownProperty = + DependencyProperty.Register("IsCountDown", typeof (bool), typeof (TimerTextBlock), + new UIPropertyMetadata(false)); + + private Invoker _UpdateTimeInvoker; + + public TimerTextBlock() + { + Init(); + } + + public TimerTextBlock(Inline inline) : base(inline) + { + Init(); + } + + /// <summary> + /// Represents the time remaining for the count down to complete if + /// the control is initialized as a count down timer otherwise, it + /// represents the time elapsed since the timer has started. + /// </summary> + /// <exception cref="System.ArgumentException"> + /// </exception> + public TimeSpan TimeSpan + { + get { return (TimeSpan) GetValue(TimeSpanProperty); } + set + { + if (value < TimeSpan.Zero) + throw new ArgumentException(); + + SetValue(TimeSpanProperty, value); + } + } + + // Using a DependencyProperty as the backing store for TimeSpan. This enables animation, styling, binding, etc... + + public bool IsStarted + { + get { return (bool) GetValue(IsStartedProperty); } + set { SetValue(IsStartedProperty, value); } + } + + // Using a DependencyProperty as the backing store for IsStarted. This enables animation, styling, binding, etc... + + /// <summary> + /// Format string for displaying the time span value. + /// </summary> + public string TimeFormat + { + get { return (string) GetValue(TimeFormatProperty); } + set { SetValue(TimeFormatProperty, value); } + } + + // Using a DependencyProperty as the backing store for TimeFormat. This enables animation, styling, binding, etc... + + /// <summary> + /// Represents whether the control is a CountDown or regular timer. + /// </summary> + public bool IsCountDown + { + get { return (bool) GetValue(IsCountDownProperty); } + set { SetValue(IsCountDownProperty, value); } + } + + public event EventHandler OnCountDownComplete; + + private static event EventHandler OnTick; + + private void Init() + { + Loaded += TimerTextBlock_Loaded; + Unloaded += TimerTextBlock_Unloaded; + } + + ~TimerTextBlock() + { + Dispose(); + } + + public void Dispose() + { + OnTick -= TimerTextBlock_OnTick; + } + + // Using a DependencyProperty as the backing store for IsCountDown. This enables animation, styling, binding, etc... + + /// <summary> + /// Sets the time span to zero and stops the timer. + /// </summary> + public void Reset() + { + IsStarted = false; + TimeSpan = TimeSpan.Zero; + } + + private static void UpdateTimer(object state) + { + EventHandler onTick = OnTick; + if (onTick != null) + onTick(null, EventArgs.Empty); + } + + private void TimerTextBlock_Loaded(object sender, RoutedEventArgs e) + { + var binding = new Binding("TimeSpan"); + binding.Source = this; + binding.Mode = BindingMode.OneWay; + binding.StringFormat = TimeFormat; + + SetBinding(TextProperty, binding); + + _UpdateTimeInvoker = UpdateTime; + + OnTick += TimerTextBlock_OnTick; + } + + private void TimerTextBlock_Unloaded(object sender, RoutedEventArgs e) + { + OnTick -= TimerTextBlock_OnTick; + } + + private void TimerTextBlock_OnTick(object sender, EventArgs e) + { + Dispatcher.Invoke(_UpdateTimeInvoker); + } + + private void UpdateTime() + { + if (IsStarted) + { + TimeSpan step = TimeSpan.FromSeconds(1); + if (IsCountDown) + { + if (TimeSpan >= TimeSpan.FromSeconds(1)) + { + TimeSpan -= step; + if (TimeSpan.TotalSeconds <= 0) + { + TimeSpan = TimeSpan.Zero; + IsStarted = false; + NotifyCountDownComplete(); + } + } + } + else + { + TimeSpan += step; + } + } + } + + private void NotifyCountDownComplete() + { + EventHandler handler = OnCountDownComplete; + if (handler != null) + handler(this, EventArgs.Empty); + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.UI/Converters/AbsoluteNumberConverter.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,22 @@ +using System; +using System.Windows.Data; + +namespace FxRates.UI.Converters +{ + public class AbsoluteNumberConverter : IValueConverter + { + #region IValueConverter Members + + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + return Math.Abs((decimal) value); + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotImplementedException(); + } + + #endregion + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.UI/Converters/BoolToServiceRunningTextConverter.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,22 @@ +using System; +using System.Windows.Data; + +namespace FxRates.UI.Converters +{ + public class BoolToServiceRunningTextConverter : IValueConverter + { + #region IValueConverter Members + + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + return (bool) value ? "Service Running" : "Service Stopped"; + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotImplementedException(); + } + + #endregion + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.UI/Converters/BoolToSubscribedTextConverter.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,22 @@ +using System; +using System.Windows.Data; + +namespace FxRates.UI.Converters +{ + public class BoolToSubscribedTextConverter : IValueConverter + { + #region IValueConverter Members + + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + return (bool) value ? "Subscribed" : "Unsubscribed"; + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotImplementedException(); + } + + #endregion + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.UI/Converters/CcyFromIconConverter.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,23 @@ +using System; +using System.Windows.Data; +using FxRates.UI.Helpers; + +namespace FxRates.UI.Converters +{ + public class CcyFromIconConverter : IValueConverter + { + #region IValueConverter Members + + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + return IconHelper.GetCcyIcon(value.ToString().Substring(0,3)); + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotImplementedException(); + } + + #endregion + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.UI/Converters/CcyToDisplayNameConverter.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,78 @@ +using System; +using System.Windows.Data; +using FxRates.Common; + +namespace FxRates.UI.Converters +{ + public class CcyToDisplayNameConverter : IValueConverter + { + #region IValueConverter Members + + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + string result; + try + { + switch ((Ccy)value) + { + case Ccy.AUDtoUSD: + result = "AUD to USD"; + break; + + case Ccy.EURtoCHF: + result = "EUR to CHF"; + break; + + case Ccy.EURtoGBP: + result = "EUR to GBP"; + break; + + case Ccy.EURtoJPY: + result = "EUR to JPY"; + break; + + case Ccy.EURtoUSD: + result = "EUR to USD"; + break; + + case Ccy.GBPtoJPY: + result = "GBP to JPY"; + break; + + case Ccy.GBPtoUSD: + result = "GBP to USD"; + break; + + case Ccy.USDtoCAD: + result = "USD to CAD"; + break; + + case Ccy.USDtoCHF: + result = "USD to CHF"; + break; + + case Ccy.USDtoJPY: + result = "USD to JPY"; + break; + + default: + result = "Unknown"; + break; + } + } + catch + { + result = "Unknown"; + } + + return result; + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotImplementedException(); + } + + #endregion + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.UI/Converters/CcyToIconConverter.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,23 @@ +using System; +using System.Windows.Data; +using FxRates.UI.Helpers; + +namespace FxRates.UI.Converters +{ + public class CcyToIconConverter : IValueConverter + { + #region IValueConverter Members + + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + return IconHelper.GetCcyIcon(value.ToString().Substring(5, 3)); + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotImplementedException(); + } + + #endregion + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.UI/Converters/DateTimeToTimeConverter.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,24 @@ +using System; +using System.Windows.Data; + +namespace FxRates.UI.Converters +{ + public class DateTimeToTimeConverter : IValueConverter + { + #region IValueConverter Members + + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + string dateTimeString = ((DateTime) value).ToString("HH:mm:ss.ffff"); + + return dateTimeString; + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotImplementedException(); + } + + #endregion + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.UI/Converters/DeltaToIconConverter.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,46 @@ +using System; +using System.Windows.Data; +using System.Windows.Media.Imaging; + +namespace FxRates.UI.Converters +{ + public class DeltaToIconConverter : IValueConverter + { + #region IValueConverter Members + + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + string uri; + BitmapImage image; + decimal delta; + string file = "UNK"; + + try + { + delta = (decimal) value; + { + if (delta > 0) + file = "UP"; + else if (delta < 0) + file = "DOWN"; + else + file = "LEVEL"; + } + } + finally + { + uri = string.Format("../Images/{0}.png", file); + image = new BitmapImage(new Uri(uri, UriKind.Relative)); + } + + return image; + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotImplementedException(); + } + + #endregion + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.UI/FxRates.UI.csproj Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,113 @@ +<?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>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{4BD124E6-F437-47F4-93C9-E09170EB06A2}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>FxRates.UI</RootNamespace> + <AssemblyName>FxRates.UI</AssemblyName> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <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</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="GalaSoft.MvvmLight.WPF4"> + <HintPath>..\Libs\MvvmLight.4.0.0\GalaSoft.MvvmLight.WPF4.dll</HintPath> + </Reference> + <Reference Include="PresentationCore" /> + <Reference Include="PresentationFramework" /> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.Reactive"> + <HintPath>..\Libs\Rx-Main.1.0.11226\lib\Net4\System.Reactive.dll</HintPath> + </Reference> + <Reference Include="System.Xaml" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + <Reference Include="WindowsBase" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Controls\TimerTextBlock.cs" /> + <Compile Include="Converters\AbsoluteNumberConverter.cs" /> + <Compile Include="Converters\BoolToServiceRunningTextConverter.cs" /> + <Compile Include="Converters\BoolToSubscribedTextConverter.cs" /> + <Compile Include="Converters\CcyFromIconConverter.cs" /> + <Compile Include="Converters\CcyToDisplayNameConverter.cs" /> + <Compile Include="Converters\CcyToIconConverter.cs" /> + <Compile Include="Converters\DateTimeToTimeConverter.cs" /> + <Compile Include="Converters\DeltaToIconConverter.cs" /> + <Compile Include="Helpers\IconHelper.cs" /> + <Compile Include="Helpers\XamlHelper.cs" /> + <Compile Include="Models\DisplayFxRate.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="ViewModels\FxRatesViewModel.cs" /> + <Compile Include="Views\FxRatesView.xaml.cs"> + <DependentUpon>FxRatesView.xaml</DependentUpon> + </Compile> + </ItemGroup> + <ItemGroup> + <Page Include="Views\FxRatesView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + </ItemGroup> + <ItemGroup /> + <ItemGroup> + <Resource Include="Images\AUD.png" /> + <Resource Include="Images\BRL.png" /> + <Resource Include="Images\CAD.png" /> + <Resource Include="Images\CHF.png" /> + <Resource Include="Images\CNY.png" /> + <Resource Include="Images\DOWN.png" /> + <Resource Include="Images\EUR.png" /> + <Resource Include="Images\GBP.png" /> + <Resource Include="Images\help.png" /> + <Resource Include="Images\INR.png" /> + <Resource Include="Images\JPY.png" /> + <Resource Include="Images\LEVEL.png" /> + <Resource Include="Images\NZD.png" /> + <Resource Include="Images\RUB.png" /> + <Resource Include="Images\THB.png" /> + <Resource Include="Images\UNK.png" /> + <Resource Include="Images\UP.png" /> + <Resource Include="Images\USD.png" /> + <Resource Include="Images\ZAR.png" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\FxRates.Common\FxRates.Common.csproj"> + <Project>{789B8256-13E5-41B0-84B5-29A98A3F6E74}</Project> + <Name>FxRates.Common</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- 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> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.UI/Helpers/IconHelper.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,26 @@ +using System; +using System.Windows.Media.Imaging; + +namespace FxRates.UI.Helpers +{ + class IconHelper + { + public static BitmapImage GetCcyIcon(string isocode) + { + string uri; + BitmapImage image; + try + { + uri = string.Format("../Images/{0}.png", isocode); + image = new BitmapImage(new Uri(uri, UriKind.Relative)); + } + catch + { + uri = string.Format("../Images/{0}.png", "UNK"); + image = new BitmapImage(new Uri(uri, UriKind.Relative)); + } + + return image; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.UI/Helpers/XamlHelper.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,22 @@ +using System.Windows; +using System.Windows.Media; + +namespace FxRates.UI.Helpers +{ + public static class XamlHelper + { + /// <summary> + /// Finds a parent of a given control/item on the visual tree. + /// </summary> + /// <typeparam name="T">Type of Parent</typeparam> + /// <param name="child">Child whose parent is queried</param> + /// <returns>Returns the first parent item that matched the type (T), if no match found then it will return null</returns> + public static T TryFindParent<T>(this DependencyObject child) where T : DependencyObject + { + var parentObject = VisualTreeHelper.GetParent(child); + if (parentObject == null) return null; + var parent = parentObject as T; + return parent ?? TryFindParent<T>(parentObject); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.UI/Models/DisplayFxRate.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,138 @@ +using System; +using FxRates.Common; +using GalaSoft.MvvmLight; + +namespace FxRates.UI.Models +{ + public class DisplayFxRate : ObservableObject, IFxRate + { + private DisplayFxRate() { } + + public static DisplayFxRate Create(FxRate rate) + { + var display = new DisplayFxRate() + { + Ccy = rate.Ccy, + Bid = rate.Bid, + Offer = rate.Offer, + PreviousOffer = rate.PreviousOffer, + Timestamp = rate.Timestamp, + Spread = getSpread(rate), + Delta = getDelta(rate) + }; + + return display; + } + + public void Update(FxRate rate) + { + this.Bid = rate.Bid; + this.Offer = rate.Offer; + this.PreviousOffer = rate.PreviousOffer; + this.Timestamp = rate.Timestamp; + this.Spread = getSpread(rate); + this.Delta = getDelta(rate); + } + + private static decimal getSpread(IFxRate rate) + { + return Math.Round(rate.Offer - rate.Bid, 4); + } + + private static decimal getDelta(IFxRate rate) + { + return Math.Round(rate.Offer - rate.PreviousOffer, 4); + } + + public const string CcyPropertyName = "Ccy"; + private Ccy _ccy; + public Ccy Ccy + { + get { return _ccy; } + private set + { + if (_ccy == value) return; + _ccy = value; + RaisePropertyChanged(CcyPropertyName); + } + } + + public const string BidPropertyName = "Bid"; + private decimal _bid = 0; + public decimal Bid + { + get { return _bid; } + private set + { + if (_bid == value) return; + _bid = value; + RaisePropertyChanged(BidPropertyName); + } + } + + public const string OfferPropertyName = "Offer"; + private decimal _offer = 0; + public decimal Offer + { + get { return _offer; } + private set + { + if (_offer == value) return; + _offer = value; + RaisePropertyChanged(OfferPropertyName); + } + } + + public const string PreviousOfferPropertyName = "PreviousOffer"; + private decimal _previousOffer = 0; + public decimal PreviousOffer + { + get { return _previousOffer; } + private set + { + if (_previousOffer == value) return; + _previousOffer = value; + RaisePropertyChanged(PreviousOfferPropertyName); + } + } + + public const string DeltaPropertyName = "Delta"; + private decimal _delta = 0; + public decimal Delta + { + get { return _delta; } + private set + { + if (_delta == value) return; + _delta = value; + RaisePropertyChanged(DeltaPropertyName); + } + } + + public const string SpreadPropertyName = "Spread"; + private decimal _spread = 0; + public decimal Spread + { + get { return _spread; } + private set + { + if (_spread == value) return; + _spread = value; + RaisePropertyChanged(SpreadPropertyName); + } + } + + public const string TimestampPropertyName = "Timestamp"; + private DateTime _timestamp = DateTime.MinValue; + public DateTime Timestamp + { + get { return _timestamp;} + private set + { + if (_timestamp == value) return; + _timestamp = value; + RaisePropertyChanged(TimestampPropertyName); + } + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.UI/Properties/AssemblyInfo.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,36 @@ +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("FxRates.UI")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("FxRates.UI")] +[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)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("d7408b4d-c599-40a9-88be-099fc8f6c3ed")] + +// 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")]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.UI/ViewModels/FxRatesViewModel.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,109 @@ +using System; +using System.ComponentModel; +using System.Linq; +using System.Reactive; +using System.Reactive.Linq; +using System.Windows.Input; +using FxRates.Common; +using FxRates.UI.Models; +using GalaSoft.MvvmLight; +using GalaSoft.MvvmLight.Command; + +namespace FxRates.UI.ViewModels +{ + public class FxRatesViewModel : ViewModelBase + { + private IPricingService pricingService; + + public BindingList<DisplayFxRate> DisplayFxRates { get; set; } + public ICommand ServiceRunningCommand { get; set; } + public ICommand SubscriptionCommand { get; set; } + + public FxRatesViewModel(IPricingService service) + { + pricingService = service; + GetLatestPrices(); + + SubscriptionCommand = new RelayCommand(SubscriptionCommand_Execute); + ServiceRunningCommand = new RelayCommand(ServiceRunningCommand_Execute); + + var priceUpdates = Observable.FromEventPattern<PriceUpdateEventArgs>( + pricingService, "PriceUpdate"); + + priceUpdates.Where(e => (Subscribed) + // && (e.EventArgs.LatestPrice.Ccy == Ccy.EURtoGBP) example of filter + ) + //.Throttle(TimeSpan.FromSeconds(1)) example of throttling + .Subscribe(PriceUpdate); + } + + public void PriceUpdate(EventPattern<PriceUpdateEventArgs> e) + { + var displayRate = DisplayFxRates.First(rate => rate.Ccy == e.EventArgs.LatestPrice.Ccy); + + if (displayRate != null) + displayRate.Update(e.EventArgs.LatestPrice); + } + + + private void GetLatestPrices() + { + DisplayFxRates = new BindingList<DisplayFxRate>(); + var currentRates = pricingService.GetFullCurrentPrices(); + foreach (var latestRate in currentRates) + { + var displayRate = DisplayFxRate.Create(latestRate); + DisplayFxRates.Add(displayRate); + } + } + + private const string SubscribedPropertyName = "Subscribed"; + private bool _subscribed = false; + public bool Subscribed + { + get { return _subscribed; } + set + { + if (_subscribed == value) return; + _subscribed = value; + RaisePropertyChanged(SubscribedPropertyName); + } + } + + private const string ServiceRunningPropertyName = "ServiceRunning"; + private bool _serviceRunning; + public bool ServiceRunning + { + get + { + return _serviceRunning; + } + set + { + if (_serviceRunning == value) return; + _serviceRunning = value; + RaisePropertyChanged(ServiceRunningPropertyName); + } + } + + void ServiceRunningCommand_Execute() + { + if (pricingService.IsRunning) + { + pricingService.Stop(); + ServiceRunning = false; + } + else + { + pricingService.Start(); + ServiceRunning = true; + } + } + + void SubscriptionCommand_Execute() + { + //toggle subscribed + Subscribed = !Subscribed; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.UI/Views/FxRatesView.xaml Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,98 @@ +<UserControl x:Class="FxRates.UI.Views.FxRatesView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:Converters="clr-namespace:FxRates.UI.Converters" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:ViewModels="clr-namespace:FxRates.UI.ViewModels" + d:DataContext="{d:DesignInstance ViewModels:FxRatesViewModel}" + d:DesignHeight="50" + d:DesignWidth="350" + mc:Ignorable="d"> + + <Grid x:Name="LayoutRoot"> + <Grid.RowDefinitions> + <RowDefinition Height="60" /> + <RowDefinition Height="20" /> + <RowDefinition Height="280" /> + <RowDefinition Height="180" /> + </Grid.RowDefinitions> + <Grid.Resources> + <Converters:BoolToServiceRunningTextConverter x:Key="BoolToServiceRunningTextConverter" /> + <Converters:BoolToSubscribedTextConverter x:Key="BoolToSubscribedTextConverter" /> + <Converters:CcyFromIconConverter x:Key="CcyFromIconConverter" /> + <Converters:CcyToDisplayNameConverter x:Key="CcyToDisplayNameConverter" /> + <Converters:CcyToIconConverter x:Key="CcyToIconConverter" /> + <Converters:DeltaToIconConverter x:Key="DeltaToIconConverter" /> + <Converters:AbsoluteNumberConverter x:Key="AbsoluteNumberConverter" /> + <Converters:DateTimeToTimeConverter x:Key="DateTimeToTimeConverter" /> + </Grid.Resources> + + <StackPanel Grid.Row="0" Orientation="Horizontal"> + <Button x:Name="btnServiceRunning" + Width="100" + Height="30" + Margin="5,0,0,0" + HorizontalAlignment="Left" + Command="{Binding ServiceRunningCommand, + Mode=TwoWay}" + Content="{Binding ServiceRunning, + Converter={StaticResource BoolToServiceRunningTextConverter}}" /> + <Button x:Name="btnSubscribe" + Width="100" + Height="30" + Margin="10,0,0,0" + HorizontalAlignment="Left" + Command="{Binding SubscriptionCommand, + Mode=TwoWay}" + Content="{Binding Subscribed, + Converter={StaticResource BoolToSubscribedTextConverter}}" /> + </StackPanel> + + <StackPanel Grid.Row="1" Orientation="Horizontal"> + <TextBlock Width="170" Text="Currency" /> + <TextBlock Width="100" Text="Bid" /> + <TextBlock Width="100" Text="Offer" /> + <TextBlock Width="105" Text="Change" /> + <TextBlock Width="100" Text="Spread" /> + </StackPanel> + <ListBox x:Name="lbFxRates" + Grid.Row="2" + BorderThickness="0" + FontFamily="Segoe UI" + ItemsSource="{Binding Path=DisplayFxRates}"> + <ListBox.ItemTemplate> + <DataTemplate> + <StackPanel Height="25" Orientation="Horizontal"> + <Image Width="20" Source="{Binding Ccy, Converter={StaticResource CcyFromIconConverter}}" /> + <TextBlock Width="85" + Margin="10,0,0,0" + FontSize="15" + Text="{Binding Ccy, + Converter={StaticResource CcyToDisplayNameConverter}}" /> + <Image Width="20" + Margin="10,0,27,0" + Source="{Binding Ccy, + Converter={StaticResource CcyToIconConverter}}" /> + <TextBlock Width="100" + FontSize="15" + Text="{Binding Bid}" /> + <TextBlock Width="100" + FontSize="15" + Text="{Binding Offer}" /> + <Image Width="20" Source="{Binding Delta, Converter={StaticResource DeltaToIconConverter}}" /> + <TextBlock Width="85" + FontSize="15" + Text="{Binding Delta, + Converter={StaticResource AbsoluteNumberConverter}}" /> + <TextBlock Width="100" + HorizontalAlignment="Right" + FontSize="15" + Text="{Binding Spread}" /> + <!-- <TextBlock Text="{Binding Timestamp, Converter={StaticResource DateTimeToTimeConverter}}" Width="100" FontSize="15" /> --> + </StackPanel> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + </Grid> +</UserControl> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/FxRates.UI/Views/FxRatesView.xaml.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,15 @@ +using System.Windows.Controls; + +namespace FxRates.UI.Views +{ + /// <summary> + /// Interaction logic for FxRatesView.xaml + /// </summary> + public partial class FxRatesView + { + public FxRatesView() + { + InitializeComponent(); + } + } +}
--- a/MetroWpf/MetroWpf.Framework/MetroWpf.Framework.csproj Tue Mar 20 16:53:29 2012 +0000 +++ b/MetroWpf/MetroWpf.Framework/MetroWpf.Framework.csproj Tue Mar 20 20:18:35 2012 +0000 @@ -37,9 +37,6 @@ <Reference Include="System.Core" /> <Reference Include="System.Xaml" /> <Reference Include="System.Xml.Linq" /> - <Reference Include="System.Data.DataSetExtensions" /> - <Reference Include="Microsoft.CSharp" /> - <Reference Include="System.Data" /> <Reference Include="System.Xml" /> <Reference Include="WindowsBase" /> </ItemGroup>
--- a/MetroWpf/MetroWpf.Services/Interfaces/IInitialize.cs Tue Mar 20 16:53:29 2012 +0000 +++ b/MetroWpf/MetroWpf.Services/Interfaces/IInitialize.cs Tue Mar 20 20:18:35 2012 +0000 @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; namespace MetroWpf.Services.Interfaces
--- a/MetroWpf/MetroWpf.Services/MetroWpf.Services.csproj Tue Mar 20 16:53:29 2012 +0000 +++ b/MetroWpf/MetroWpf.Services/MetroWpf.Services.csproj Tue Mar 20 20:18:35 2012 +0000 @@ -31,20 +31,8 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> - <Reference Include="GalaSoft.MvvmLight.Extras.WPF4"> - <HintPath>..\Libs\MvvmLight.Extras.4.0.0\GalaSoft.MvvmLight.Extras.WPF4.dll</HintPath> - </Reference> - <Reference Include="GalaSoft.MvvmLight.WPF4"> - <HintPath>..\Libs\MvvmLight.4.0.0\GalaSoft.MvvmLight.WPF4.dll</HintPath> - </Reference> - <Reference Include="PresentationFramework" /> <Reference Include="System" /> <Reference Include="System.Core" /> - <Reference Include="System.Xml.Linq" /> - <Reference Include="System.Data.DataSetExtensions" /> - <Reference Include="Microsoft.CSharp" /> - <Reference Include="System.Data" /> - <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="Interfaces\ButtonExtras.cs" />
--- a/MetroWpf/MetroWpf.Services/Windows/WindowManager.cs Tue Mar 20 16:53:29 2012 +0000 +++ b/MetroWpf/MetroWpf.Services/Windows/WindowManager.cs Tue Mar 20 20:18:35 2012 +0000 @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; namespace MetroWpf.Services.Windows
--- a/MetroWpf/MetroWpf.Xaml/Extensions/AdornerExtensions.cs Tue Mar 20 16:53:29 2012 +0000 +++ b/MetroWpf/MetroWpf.Xaml/Extensions/AdornerExtensions.cs Tue Mar 20 20:18:35 2012 +0000 @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Windows.Documents; using System.Windows;
--- a/MetroWpf/MetroWpf.Xaml/MetroWpf.Xaml.csproj Tue Mar 20 16:53:29 2012 +0000 +++ b/MetroWpf/MetroWpf.Xaml/MetroWpf.Xaml.csproj Tue Mar 20 20:18:35 2012 +0000 @@ -35,15 +35,7 @@ <Reference Include="PresentationFramework" /> <Reference Include="System" /> <Reference Include="System.Core" /> - <Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\Libs\System.Windows.Interactivity\System.Windows.Interactivity.dll</HintPath> - </Reference> <Reference Include="System.Xaml" /> - <Reference Include="System.Xml.Linq" /> - <Reference Include="System.Data.DataSetExtensions" /> - <Reference Include="Microsoft.CSharp" /> - <Reference Include="System.Data" /> <Reference Include="System.Xml" /> <Reference Include="WindowsBase" /> </ItemGroup> @@ -77,6 +69,12 @@ <Compile Include="Extensions\DependencyObject.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Styles\Colors.cs" /> + <Compile Include="Transitions\Fade.cs" /> + <Compile Include="Transitions\StoryboardTransition.cs" /> + <Compile Include="Transitions\Transition.cs" /> + <Compile Include="Transitions\TransitionPresenter.cs" /> + <Compile Include="Transitions\TransitionSelector.cs" /> + <Compile Include="Transitions\TranslateTransition.cs" /> </ItemGroup> <ItemGroup> <Page Include="Styles\Controls.WatermarkTextBox.xaml">
--- a/MetroWpf/MetroWpf.Xaml/Styles/Colors.cs Tue Mar 20 16:53:29 2012 +0000 +++ b/MetroWpf/MetroWpf.Xaml/Styles/Colors.cs Tue Mar 20 20:18:35 2012 +0000 @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Windows.Media;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf.Xaml/Transitions/Fade.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,39 @@ +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media.Animation; + +namespace MetroWpf.Xaml.Transitions +{ + // Simple transition that fades out the old content + public class FadeTransition : Transition + { + static FadeTransition() + { + IsNewContentTopmostProperty.OverrideMetadata(typeof(FadeTransition), new FrameworkPropertyMetadata(false)); + } + + public Duration Duration + { + get { return (Duration)GetValue(DurationProperty); } + set { SetValue(DurationProperty, value); } + } + + public static readonly DependencyProperty DurationProperty = + DependencyProperty.Register("Duration", typeof(Duration), typeof(FadeTransition), new UIPropertyMetadata(Duration.Automatic)); + + protected internal override void BeginTransition(TransitionPresenter transitionElement, ContentPresenter oldContent, ContentPresenter newContent) + { + DoubleAnimation da = new DoubleAnimation(0, Duration); + da.Completed += delegate + { + EndTransition(transitionElement, oldContent, newContent); + }; + oldContent.BeginAnimation(UIElement.OpacityProperty, da); + } + + protected override void OnTransitionEnded(TransitionPresenter transitionElement, ContentPresenter oldContent, ContentPresenter newContent) + { + oldContent.BeginAnimation(UIElement.OpacityProperty, null); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf.Xaml/Transitions/StoryboardTransition.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,118 @@ +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media.Animation; + +namespace MetroWpf.Xaml.Transitions +{ + // Transition with storyboards for the old and new content presenters + [StyleTypedProperty(Property = "OldContentStyle", StyleTargetType = typeof(ContentPresenter))] + [StyleTypedProperty(Property = "NewContentStyle", StyleTargetType = typeof(ContentPresenter))] + public class StoryboardTransition : Transition + { + public Style OldContentStyle + { + get { return (Style)GetValue(OldContentStyleProperty); } + set { SetValue(OldContentStyleProperty, value); } + } + + public static readonly DependencyProperty OldContentStyleProperty = + DependencyProperty.Register("OldContentStyle", + typeof(Style), + typeof(StoryboardTransition), + new UIPropertyMetadata(null)); + + public Storyboard OldContentStoryboard + { + get { return (Storyboard)GetValue(OldContentStoryboardProperty); } + set { SetValue(OldContentStoryboardProperty, value); } + } + + public static readonly DependencyProperty OldContentStoryboardProperty = + DependencyProperty.Register("OldContentStoryboard", + typeof(Storyboard), + typeof(StoryboardTransition), + new UIPropertyMetadata(null)); + + public Style NewContentStyle + { + get { return (Style)GetValue(NewContentStyleProperty); } + set { SetValue(NewContentStyleProperty, value); } + } + + public static readonly DependencyProperty NewContentStyleProperty = + DependencyProperty.Register("NewContentStyle", + typeof(Style), + typeof(StoryboardTransition), + new UIPropertyMetadata(null)); + + public Storyboard NewContentStoryboard + { + get { return (Storyboard)GetValue(NewContentStoryboardProperty); } + set { SetValue(NewContentStoryboardProperty, value); } + } + + public static readonly DependencyProperty NewContentStoryboardProperty = + DependencyProperty.Register("NewContentStoryboard", + typeof(Storyboard), + typeof(StoryboardTransition), + new UIPropertyMetadata(null)); + + protected internal override void BeginTransition(TransitionPresenter transitionElement, ContentPresenter oldContent, ContentPresenter newContent) + { + Storyboard oldStoryboard = OldContentStoryboard; + Storyboard newStoryboard = NewContentStoryboard; + + if (oldStoryboard != null || newStoryboard != null) + { + oldContent.Style = OldContentStyle; + newContent.Style = NewContentStyle; + + // Flag to determine when both storyboards are done + bool done = oldStoryboard == null || newStoryboard == null; + + if (oldStoryboard != null) + { + oldStoryboard = oldStoryboard.Clone(); + oldContent.SetValue(OldContentStoryboardProperty, oldStoryboard); + oldStoryboard.Completed += delegate + { + if (done) + EndTransition(transitionElement, oldContent, newContent); + done = true; + }; + oldStoryboard.Begin(oldContent, true); + } + + if (newStoryboard != null) + { + newStoryboard = newStoryboard.Clone(); + newContent.SetValue(NewContentStoryboardProperty, newStoryboard); + newStoryboard.Completed += delegate + { + if (done) + EndTransition(transitionElement, oldContent, newContent); + done = true; + }; + newStoryboard.Begin(newContent, true); + } + } + else + { + EndTransition(transitionElement, oldContent, newContent); + } + } + + protected override void OnTransitionEnded(TransitionPresenter transitionElement, ContentPresenter oldContent, ContentPresenter newContent) + { + Storyboard oldStoryboard = (Storyboard)oldContent.GetValue(OldContentStoryboardProperty); + if (oldStoryboard != null) + oldStoryboard.Stop(oldContent); + oldContent.ClearValue(ContentPresenter.StyleProperty); + + Storyboard newStoryboard = (Storyboard)newContent.GetValue(NewContentStoryboardProperty); + if (newStoryboard != null) + newStoryboard.Stop(newContent); + newContent.ClearValue(ContentPresenter.StyleProperty); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf.Xaml/Transitions/Transition.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,65 @@ +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; + +namespace MetroWpf.Xaml.Transitions +{ + // Base class for all transitions. + public class Transition : DependencyObject + { + public bool ClipToBounds + { + get { return (bool)GetValue(ClipToBoundsProperty); } + set { SetValue(ClipToBoundsProperty, value); } + } + + public static readonly DependencyProperty ClipToBoundsProperty = + DependencyProperty.Register("ClipToBounds", + typeof(bool), + typeof(Transition), + new UIPropertyMetadata(false)); + + public bool IsNewContentTopmost + { + get { return (bool)GetValue(IsNewContentTopmostProperty); } + set { SetValue(IsNewContentTopmostProperty, value); } + } + + public static readonly DependencyProperty IsNewContentTopmostProperty = + DependencyProperty.Register("IsNewContentTopmost", + typeof(bool), + typeof(Transition), + new UIPropertyMetadata(true)); + + // Called when an element is Removed from the TransitionPresenter's visual tree + protected internal virtual void BeginTransition(TransitionPresenter transitionElement, ContentPresenter oldContent, ContentPresenter newContent) + { + EndTransition(transitionElement, oldContent, newContent); + } + + //Transitions should call this method when they are done + protected void EndTransition(TransitionPresenter transitionElement, ContentPresenter oldContent, ContentPresenter newContent) + { + OnTransitionEnded(transitionElement, oldContent, newContent); + + transitionElement.OnTransitionCompleted(); + } + + //Transitions can override this to perform cleanup at the end of the transition + protected virtual void OnTransitionEnded(TransitionPresenter transitionElement, ContentPresenter oldContent, ContentPresenter newContent) + { + } + + // Returns a clone of the element and hides it in the main tree + protected static Brush CreateBrush(ContentPresenter content) + { + ((Decorator)content.Parent).Visibility = Visibility.Hidden; + + VisualBrush brush = new VisualBrush(content); + brush.ViewportUnits = BrushMappingMode.Absolute; + RenderOptions.SetCachingHint(brush, CachingHint.Cache); + RenderOptions.SetCacheInvalidationThresholdMinimum(brush, 40); + return brush; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf.Xaml/Transitions/TransitionPresenter.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,249 @@ +using System; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; +using System.Windows.Media; + +namespace MetroWpf.Xaml.Transitions +{ + [System.Windows.Markup.ContentProperty("Content")] + public class TransitionPresenter : FrameworkElement + { + static TransitionPresenter() + { + ClipToBoundsProperty.OverrideMetadata(typeof(TransitionPresenter), new FrameworkPropertyMetadata(null, CoerceClipToBounds)); + } + + // Force clip to be true if the active Transition requires it + private static object CoerceClipToBounds(object element, object value) + { + TransitionPresenter transitionElement = (TransitionPresenter)element; + bool clip = (bool)value; + if (!clip && transitionElement.IsTransitioning) + { + Transition transition = transitionElement.Transition; + if (transition.ClipToBounds) + return true; + } + return value; + } + + public object Content + { + get { return (object)GetValue(ContentProperty); } + set { SetValue(ContentProperty, value); } + } + + public static readonly DependencyProperty ContentProperty = + DependencyProperty.Register("Content", + typeof(object), + typeof(TransitionPresenter), + new UIPropertyMetadata(null, OnContentChanged, CoerceContent)); + + // Don't update content until done transitioning + private static object CoerceContent(object element, object value) + { + TransitionPresenter te = (TransitionPresenter)element; + if (te.IsTransitioning) + return te.CurrentContentPresenter.Content; + return value; + } + + private static void OnContentChanged(object element, DependencyPropertyChangedEventArgs e) + { + TransitionPresenter te = (TransitionPresenter)element; + te.BeginTransition(); + } + + public DataTemplate ContentTemplate + { + get { return (DataTemplate)GetValue(ContentTemplateProperty); } + set { SetValue(ContentTemplateProperty, value); } + } + + public static readonly DependencyProperty ContentTemplateProperty = + DependencyProperty.Register("ContentTemplate", + typeof(DataTemplate), + typeof(TransitionPresenter), + new UIPropertyMetadata(null, OnContentTemplateChanged)); + + private static void OnContentTemplateChanged(object element, DependencyPropertyChangedEventArgs e) + { + TransitionPresenter te = (TransitionPresenter)element; + te.CurrentContentPresenter.ContentTemplate = (DataTemplate)e.NewValue; + } + + public DataTemplateSelector ContentTemplateSelector + { + get { return (DataTemplateSelector)GetValue(ContentTemplateSelectorProperty); } + set { SetValue(ContentTemplateSelectorProperty, value); } + } + + public static readonly DependencyProperty ContentTemplateSelectorProperty = + DependencyProperty.Register("ContentTemplateSelector", + typeof(DataTemplateSelector), + typeof(TransitionPresenter), + new UIPropertyMetadata(null, OnContentTemplateSelectorChanged)); + + private static void OnContentTemplateSelectorChanged(object element, DependencyPropertyChangedEventArgs e) + { + TransitionPresenter te = (TransitionPresenter)element; + te.CurrentContentPresenter.ContentTemplateSelector = (DataTemplateSelector)e.NewValue; + } + + public bool IsTransitioning + { + get { return (bool)GetValue(IsTransitioningProperty); } + private set { SetValue(IsTransitioningPropertyKey, value); } + } + + private static readonly DependencyPropertyKey IsTransitioningPropertyKey = + DependencyProperty.RegisterReadOnly("IsTransitioning", + typeof(bool), + typeof(TransitionPresenter), + new UIPropertyMetadata(false)); + + public static readonly DependencyProperty IsTransitioningProperty = + IsTransitioningPropertyKey.DependencyProperty; + + public Transition Transition + { + get { return (Transition)GetValue(TransitionProperty); } + set { SetValue(TransitionProperty, value); } + } + + public static readonly DependencyProperty TransitionProperty = + DependencyProperty.Register("Transition", typeof(Transition), typeof(TransitionPresenter), new UIPropertyMetadata(null, null, CoerceTransition)); + + private static object CoerceTransition(object element, object value) + { + TransitionPresenter te = (TransitionPresenter)element; + if (te.IsTransitioning) return te._activeTransition; + return value; + } + + public TransitionSelector TransitionSelector + { + get { return (TransitionSelector)GetValue(TransitionSelectorProperty); } + set { SetValue(TransitionSelectorProperty, value); } + } + + public static readonly DependencyProperty TransitionSelectorProperty = + DependencyProperty.Register("TransitionSelector", typeof(TransitionSelector), typeof(TransitionPresenter), new UIPropertyMetadata(null)); + + public TransitionPresenter() + { + _children = new UIElementCollection(this, null); + ContentPresenter currentContent = new ContentPresenter(); + _currentHost = new AdornerDecorator(); + _currentHost.Child = currentContent; + _children.Add(_currentHost); + + ContentPresenter previousContent = new ContentPresenter(); + _previousHost = new AdornerDecorator(); + _previousHost.Child = previousContent; + } + + private void BeginTransition() + { + TransitionSelector selector = TransitionSelector; + + Transition transition = selector != null ? + selector.SelectTransition(CurrentContentPresenter.Content, Content) : + Transition; + + if (transition != null) + { + // Swap content presenters + AdornerDecorator temp = _previousHost; + _previousHost = _currentHost; + _currentHost = temp; + } + + ContentPresenter currentContent = CurrentContentPresenter; + // Set the current content + currentContent.Content = Content; + currentContent.ContentTemplate = ContentTemplate; + currentContent.ContentTemplateSelector = ContentTemplateSelector; + + if (transition != null) + { + ContentPresenter previousContent = PreviousContentPresenter; + + if (transition.IsNewContentTopmost) + Children.Add(_currentHost); + else + Children.Insert(0, _currentHost); + + IsTransitioning = true; + _activeTransition = transition; + CoerceValue(TransitionProperty); + CoerceValue(ClipToBoundsProperty); + transition.BeginTransition(this, previousContent, currentContent); + } + } + + // Clean up after the transition is complete + internal void OnTransitionCompleted() + { + _children.Clear(); + _children.Add(_currentHost); + _currentHost.Visibility = Visibility.Visible; + _previousHost.Visibility = Visibility.Visible; + ((ContentPresenter)_previousHost.Child).Content = null; + + IsTransitioning = false; + _activeTransition = null; + CoerceValue(TransitionProperty); + CoerceValue(ClipToBoundsProperty); + CoerceValue(ContentProperty); + } + + protected override Size MeasureOverride(Size availableSize) + { + _currentHost.Measure(availableSize); + return _currentHost.DesiredSize; + } + + protected override Size ArrangeOverride(Size finalSize) + { + foreach (UIElement uie in _children) + uie.Arrange(new Rect(finalSize)); + return finalSize; + } + + protected override int VisualChildrenCount + { + get { return _children.Count; } + } + + protected override Visual GetVisualChild(int index) + { + if (index < 0 || index >= _children.Count) + throw new ArgumentOutOfRangeException("index"); + return _children[index]; + } + + internal UIElementCollection Children + { + get { return _children; } + } + + private ContentPresenter PreviousContentPresenter + { + get { return ((ContentPresenter)_previousHost.Child); } + } + + private ContentPresenter CurrentContentPresenter + { + get { return ((ContentPresenter)_currentHost.Child); } + } + + private UIElementCollection _children; + + private AdornerDecorator _currentHost; + private AdornerDecorator _previousHost; + + private Transition _activeTransition; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf.Xaml/Transitions/TransitionSelector.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,14 @@ +using System.Windows; + +namespace MetroWpf.Xaml.Transitions +{ + // Allows different transitions to run based on the old and new contents + // Override the SelectTransition method to return the transition to apply + public class TransitionSelector : DependencyObject + { + public virtual Transition SelectTransition(object oldContent, object newContent) + { + return null; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf.Xaml/Transitions/TranslateTransition.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,71 @@ +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; +using System.Windows.Media.Animation; + +namespace MetroWpf.Xaml.Transitions +{ + // Applies a Translation to the content. You can specify the starting point of the new + // content or the ending point of the old content using relative coordinates. + // Set start point to (-1,0) to have the content slide from the left + public class TranslateTransition : Transition + { + static TranslateTransition() + { + ClipToBoundsProperty.OverrideMetadata(typeof(TranslateTransition), new FrameworkPropertyMetadata(true)); + } + + public Duration Duration + { + get { return (Duration)GetValue(DurationProperty); } + set { SetValue(DurationProperty, value); } + } + + public static readonly DependencyProperty DurationProperty = + DependencyProperty.Register("Duration", typeof(Duration), typeof(TranslateTransition), new UIPropertyMetadata(Duration.Automatic)); + + public Point StartPoint + { + get { return (Point)GetValue(StartPointProperty); } + set { SetValue(StartPointProperty, value); } + } + + public static readonly DependencyProperty StartPointProperty = + DependencyProperty.Register("StartPoint", typeof(Point), typeof(TranslateTransition), new UIPropertyMetadata(new Point())); + + public Point EndPoint + { + get { return (Point)GetValue(EndPointProperty); } + set { SetValue(EndPointProperty, value); } + } + + public static readonly DependencyProperty EndPointProperty = + DependencyProperty.Register("EndPoint", typeof(Point), typeof(TranslateTransition), new UIPropertyMetadata(new Point())); + + protected internal override void BeginTransition(TransitionPresenter transitionElement, ContentPresenter oldContent, ContentPresenter newContent) + { + TranslateTransform tt = new TranslateTransform(StartPoint.X * transitionElement.ActualWidth, StartPoint.Y * transitionElement.ActualHeight); + + if (IsNewContentTopmost) + newContent.RenderTransform = tt; + else + oldContent.RenderTransform = tt; + + DoubleAnimation da = new DoubleAnimation(EndPoint.X * transitionElement.ActualWidth, Duration); + tt.BeginAnimation(TranslateTransform.XProperty, da); + + da.To = EndPoint.Y * transitionElement.ActualHeight; + da.Completed += delegate + { + EndTransition(transitionElement, oldContent, newContent); + }; + tt.BeginAnimation(TranslateTransform.YProperty, da); + } + + protected override void OnTransitionEnded(TransitionPresenter transitionElement, ContentPresenter oldContent, ContentPresenter newContent) + { + newContent.ClearValue(ContentPresenter.RenderTransformProperty); + oldContent.ClearValue(ContentPresenter.RenderTransformProperty); + } + } +}
--- a/MetroWpf/MetroWpf.sln Tue Mar 20 16:53:29 2012 +0000 +++ b/MetroWpf/MetroWpf.sln Tue Mar 20 20:18:35 2012 +0000 @@ -15,6 +15,12 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stocks.UI", "Stocks.UI\Stocks.UI.csproj", "{BF20711D-4863-4FD3-9B6C-42D4E677D85C}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FxRates.UI", "FxRates.UI\FxRates.UI.csproj", "{4BD124E6-F437-47F4-93C9-E09170EB06A2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FxRates.Common", "FxRates.Common\FxRates.Common.csproj", "{789B8256-13E5-41B0-84B5-29A98A3F6E74}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FxRates.Service", "FxRates.Service\FxRates.Service.csproj", "{0AFFFD20-14C7-44A9-B27E-93165001241C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -95,6 +101,36 @@ {BF20711D-4863-4FD3-9B6C-42D4E677D85C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {BF20711D-4863-4FD3-9B6C-42D4E677D85C}.Release|Mixed Platforms.Build.0 = Release|Any CPU {BF20711D-4863-4FD3-9B6C-42D4E677D85C}.Release|x86.ActiveCfg = Release|Any CPU + {4BD124E6-F437-47F4-93C9-E09170EB06A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4BD124E6-F437-47F4-93C9-E09170EB06A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4BD124E6-F437-47F4-93C9-E09170EB06A2}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {4BD124E6-F437-47F4-93C9-E09170EB06A2}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {4BD124E6-F437-47F4-93C9-E09170EB06A2}.Debug|x86.ActiveCfg = Debug|Any CPU + {4BD124E6-F437-47F4-93C9-E09170EB06A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4BD124E6-F437-47F4-93C9-E09170EB06A2}.Release|Any CPU.Build.0 = Release|Any CPU + {4BD124E6-F437-47F4-93C9-E09170EB06A2}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {4BD124E6-F437-47F4-93C9-E09170EB06A2}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {4BD124E6-F437-47F4-93C9-E09170EB06A2}.Release|x86.ActiveCfg = Release|Any CPU + {789B8256-13E5-41B0-84B5-29A98A3F6E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {789B8256-13E5-41B0-84B5-29A98A3F6E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {789B8256-13E5-41B0-84B5-29A98A3F6E74}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {789B8256-13E5-41B0-84B5-29A98A3F6E74}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {789B8256-13E5-41B0-84B5-29A98A3F6E74}.Debug|x86.ActiveCfg = Debug|Any CPU + {789B8256-13E5-41B0-84B5-29A98A3F6E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {789B8256-13E5-41B0-84B5-29A98A3F6E74}.Release|Any CPU.Build.0 = Release|Any CPU + {789B8256-13E5-41B0-84B5-29A98A3F6E74}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {789B8256-13E5-41B0-84B5-29A98A3F6E74}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {789B8256-13E5-41B0-84B5-29A98A3F6E74}.Release|x86.ActiveCfg = Release|Any CPU + {0AFFFD20-14C7-44A9-B27E-93165001241C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0AFFFD20-14C7-44A9-B27E-93165001241C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0AFFFD20-14C7-44A9-B27E-93165001241C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {0AFFFD20-14C7-44A9-B27E-93165001241C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {0AFFFD20-14C7-44A9-B27E-93165001241C}.Debug|x86.ActiveCfg = Debug|Any CPU + {0AFFFD20-14C7-44A9-B27E-93165001241C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0AFFFD20-14C7-44A9-B27E-93165001241C}.Release|Any CPU.Build.0 = Release|Any CPU + {0AFFFD20-14C7-44A9-B27E-93165001241C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {0AFFFD20-14C7-44A9-B27E-93165001241C}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {0AFFFD20-14C7-44A9-B27E-93165001241C}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE
--- a/MetroWpf/MetroWpf/App.xaml Tue Mar 20 16:53:29 2012 +0000 +++ b/MetroWpf/MetroWpf/App.xaml Tue Mar 20 20:18:35 2012 +0000 @@ -4,13 +4,12 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:MetroWpf" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - mc:Ignorable="d" - StartupUri="Presentation/Shell/MainWindow.xaml"> + StartupUri="UI\Shell/ShellView.xaml" + mc:Ignorable="d"> <Application.Resources> <ResourceDictionary> - <!--Global IoC Locator--> - <local:Locator x:Key="Locator" - d:IsDataSource="True" /> + <!-- Global IoC Locator --> + <local:Locator x:Key="Locator" d:IsDataSource="True" /> </ResourceDictionary> </Application.Resources> </Application>
--- a/MetroWpf/MetroWpf/App.xaml.cs Tue Mar 20 16:53:29 2012 +0000 +++ b/MetroWpf/MetroWpf/App.xaml.cs Tue Mar 20 20:18:35 2012 +0000 @@ -1,7 +1,6 @@ using System.Diagnostics; using System.Reflection; using System.Windows; -using GalaSoft.MvvmLight.Ioc; using MetroWpf.Framework.Interfaces; using MetroWpf.Xaml.Binding; using Microsoft.Practices.ServiceLocation;
--- a/MetroWpf/MetroWpf/IoCModule.cs Tue Mar 20 16:53:29 2012 +0000 +++ b/MetroWpf/MetroWpf/IoCModule.cs Tue Mar 20 20:18:35 2012 +0000 @@ -1,17 +1,20 @@ - -using GalaSoft.MvvmLight.Messaging; +using System.Threading.Tasks; +using FxRates.Common; +using FxRates.Service; +using FxRates.UI.ViewModels; +using FxRates.UI.Views; using MetroWpf.Framework; using MetroWpf.Framework.Interfaces; -using MetroWpf.Presentation.About; -using MetroWpf.Presentation.Login; -using MetroWpf.Presentation.Menu; -using MetroWpf.Presentation.Settings; -using MetroWpf.Presentation.Shell; using MetroWpf.Presentation.UserProfile; +using MetroWpf.UI.About; +using MetroWpf.UI.Login; +using MetroWpf.UI.Settings; +using MetroWpf.UI.Shell; using Ninject.Modules; using Stocks.Common; using Stocks.Service; using Stocks.UI.ViewModels; +using Stocks.UI.Views; namespace MetroWpf { @@ -19,20 +22,32 @@ { public override void Load() { + // start up + Bind<IWpfApplication>().To<WpfApplication>(); + Bind<ShellViewModel>().ToSelf(); + Bind<LoginViewModel>().ToSelf(); + + Task.Factory.StartNew(AsyncOtherDependencies); + } + + private void AsyncOtherDependencies() + { + // stocks Bind<IConfigurationService>() .To<ConfigurationService>() .WithConstructorArgument("filename", "companyData.json"); Bind<IWebClientShim>().To<WebClientShim>(); Bind<IStocksService>().To<StocksService>(); - - Bind<IMessenger>().To<Messenger>(); - Bind<IWpfApplication>().To<WpfApplication>(); + Bind<StocksViewModel>().ToSelf(); + Bind<StocksView>().ToSelf(); - Bind<StocksViewModel>().ToSelf(); - Bind<MainWindowViewModel>().ToSelf(); - Bind<MenuViewModel>().ToSelf(); - Bind<LoginViewModel>().ToSelf(); + // fx rates + Bind<IPricingService>().To<PricingService>(); + Bind<FxRatesViewModel>().ToSelf(); + Bind<FxRatesView>().ToSelf(); + + // other views Bind<UserProfileViewModel>().ToSelf(); Bind<SettingsViewModel>().ToSelf(); Bind<AboutViewModel>().ToSelf();
--- a/MetroWpf/MetroWpf/Locator.cs Tue Mar 20 16:53:29 2012 +0000 +++ b/MetroWpf/MetroWpf/Locator.cs Tue Mar 20 20:18:35 2012 +0000 @@ -1,12 +1,10 @@ +using FxRates.UI.ViewModels; using GalaSoft.MvvmLight; -using MetroWpf.Framework; -using MetroWpf.Framework.Interfaces; -using MetroWpf.Presentation.Shell; -using MetroWpf.Presentation.Settings; -using MetroWpf.Presentation.Login; using MetroWpf.Presentation.UserProfile; -using MetroWpf.Presentation.About; -using MetroWpf.Presentation.Menu; +using MetroWpf.UI.About; +using MetroWpf.UI.Login; +using MetroWpf.UI.Settings; +using MetroWpf.UI.Shell; using Microsoft.Practices.ServiceLocation; using Stocks.UI.ViewModels; @@ -27,14 +25,9 @@ } } - public MainWindowViewModel MainWindowViewModel + public ShellViewModel ShellViewModel { - get { return ServiceLocator.Current.GetInstance<MainWindowViewModel>(); } - } - - public MenuViewModel MenuViewModel - { - get { return ServiceLocator.Current.GetInstance<MenuViewModel>(); } + get { return ServiceLocator.Current.GetInstance<ShellViewModel>(); } } public LoginViewModel LoginViewModel @@ -62,9 +55,14 @@ get { return ServiceLocator.Current.GetInstance<StocksViewModel>(); } } - public IWpfApplication WpfApplication + public FxRatesViewModel FxRatesViewModel { - get { return ServiceLocator.Current.GetInstance<WpfApplication>(); } + get { return ServiceLocator.Current.GetInstance<FxRatesViewModel>(); } } + + //public IWpfApplication WpfApplication + //{ + // get { return ServiceLocator.Current.GetInstance<WpfApplication>(); } + //} } } \ No newline at end of file
--- a/MetroWpf/MetroWpf/MetroWpf.csproj Tue Mar 20 16:53:29 2012 +0000 +++ b/MetroWpf/MetroWpf/MetroWpf.csproj Tue Mar 20 20:18:35 2012 +0000 @@ -36,10 +36,6 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> - <Reference Include="GalaSoft.MvvmLight.Extras.WPF4, Version=0.0.0.0, Culture=neutral, PublicKeyToken=1673db7d5906b0ad, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\Libs\MvvmLight.Extras.4.0.0\GalaSoft.MvvmLight.Extras.WPF4.dll</HintPath> - </Reference> <Reference Include="GalaSoft.MvvmLight.WPF4, Version=0.0.0.0, Culture=neutral, PublicKeyToken=63eb5c012e0b3c1c, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\Libs\MvvmLight.4.0.0\GalaSoft.MvvmLight.WPF4.dll</HintPath> @@ -58,19 +54,11 @@ <HintPath>..\Libs\CommonServiceLocator.NinjectAdapter.1.0.0.0\lib\NinjectAdapter.dll</HintPath> </Reference> <Reference Include="System" /> - <Reference Include="System.ComponentModel.Composition" /> - <Reference Include="System.Data" /> - <Reference Include="System.Reactive, Version=1.0.10621.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> - <HintPath>..\Libs\Rx-Main.1.0.11226\lib\Net4\System.Reactive.dll</HintPath> - </Reference> <Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\packages\Caliburn.Micro.1.3.1\lib\net40\System.Windows.Interactivity.dll</HintPath> </Reference> <Reference Include="System.Xml" /> - <Reference Include="Microsoft.CSharp" /> <Reference Include="System.Core" /> - <Reference Include="System.Xml.Linq" /> - <Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Xaml"> <RequiredTargetFramework>4.0</RequiredTargetFramework> </Reference> @@ -98,38 +86,34 @@ <Compile Include="NinjectServiceLocatorExt.cs" /> <Compile Include="Services\Interfaces\INavigationService.cs" /> <Compile Include="Services\NavigationService.cs" /> - <Compile Include="Presentation\About\AboutView.xaml.cs"> + <Compile Include="UI\About\AboutView.xaml.cs"> <DependentUpon>AboutView.xaml</DependentUpon> </Compile> - <Compile Include="Presentation\Login\LoginView.xaml.cs"> + <Compile Include="UI\Login\LoginView.xaml.cs"> <DependentUpon>LoginView.xaml</DependentUpon> </Compile> - <Compile Include="Presentation\Menu\MenuViewModel.cs" /> - <Compile Include="Presentation\Screen.cs" /> - <Compile Include="Presentation\Settings\SettingsView.xaml.cs"> + <Compile Include="UI\Screen.cs" /> + <Compile Include="UI\Settings\SettingsView.xaml.cs"> <DependentUpon>SettingsView.xaml</DependentUpon> </Compile> - <Compile Include="Presentation\UserProfile\UserProfileView.xaml.cs"> + <Compile Include="UI\UserProfile\UserProfileView.xaml.cs"> <DependentUpon>UserProfileView.xaml</DependentUpon> </Compile> - <Compile Include="Presentation\UserProfile\UserProfileViewModel.cs" /> + <Compile Include="UI\UserProfile\UserProfileViewModel.cs" /> <Compile Include="Styles\ApplicationStyle.cs" /> - <Compile Include="Presentation\Settings\SettingsViewModel.cs" /> + <Compile Include="UI\Settings\SettingsViewModel.cs" /> <Compile Include="Messages\ApplicationStyleChangeMessage.cs" /> - <Compile Include="Presentation\Menu\MenuView.xaml.cs"> - <DependentUpon>MenuView.xaml</DependentUpon> + <Compile Include="UI\Shell\ShellView.xaml.cs"> + <DependentUpon>ShellView.xaml</DependentUpon> </Compile> - <Compile Include="Presentation\Shell\MainWindow.xaml.cs"> - <DependentUpon>MainWindow.xaml</DependentUpon> - </Compile> - <Compile Include="Presentation\Shell\MainWindowViewModel.cs" /> - <Compile Include="Presentation\Exceptions\ExceptionDialog.xaml.cs"> + <Compile Include="UI\Shell\ShellViewModel.cs" /> + <Compile Include="UI\Exceptions\ExceptionDialog.xaml.cs"> <DependentUpon>ExceptionDialog.xaml</DependentUpon> </Compile> <Compile Include="Locator.cs" /> - <Compile Include="Presentation\About\AboutViewModel.cs" /> - <Compile Include="Presentation\Login\LoginViewModel.cs" /> - <Compile Include="Presentation\Login\UserLogin.cs" /> + <Compile Include="UI\About\AboutViewModel.cs" /> + <Compile Include="UI\Login\LoginViewModel.cs" /> + <Compile Include="UI\Login\UserLogin.cs" /> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs"> @@ -156,31 +140,27 @@ <AppDesigner Include="Properties\" /> </ItemGroup> <ItemGroup> - <Page Include="Presentation\About\AboutView.xaml"> - <SubType>Designer</SubType> - <Generator>MSBuild:Compile</Generator> - </Page> - <Page Include="Presentation\Exceptions\ExceptionDialog.xaml"> - <Generator>MSBuild:Compile</Generator> - <SubType>Designer</SubType> - </Page> - <Page Include="Presentation\Login\LoginView.xaml"> + <Page Include="UI\About\AboutView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> - <Page Include="Presentation\Menu\MenuView.xaml"> + <Page Include="UI\Exceptions\ExceptionDialog.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="UI\Login\LoginView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> - <Page Include="Presentation\Settings\SettingsView.xaml"> + <Page Include="UI\Settings\SettingsView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> - <Page Include="Presentation\Shell\MainWindow.xaml"> + <Page Include="UI\Shell\ShellView.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> - <Page Include="Presentation\UserProfile\UserProfileView.xaml"> + <Page Include="UI\UserProfile\UserProfileView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> @@ -190,18 +170,26 @@ </Page> </ItemGroup> <ItemGroup> - <SplashScreen Include="Presentation\Splash\splash.png" /> - <Resource Include="Presentation\logo.ico" /> + <SplashScreen Include="UI\Splash\splash.png" /> + <Resource Include="UI\logo.ico" /> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\FxRates.Common\FxRates.Common.csproj"> + <Project>{789B8256-13E5-41B0-84B5-29A98A3F6E74}</Project> + <Name>FxRates.Common</Name> + </ProjectReference> + <ProjectReference Include="..\FxRates.Service\FxRates.Service.csproj"> + <Project>{0AFFFD20-14C7-44A9-B27E-93165001241C}</Project> + <Name>FxRates.Service</Name> + </ProjectReference> + <ProjectReference Include="..\FxRates.UI\FxRates.UI.csproj"> + <Project>{4BD124E6-F437-47F4-93C9-E09170EB06A2}</Project> + <Name>FxRates.UI</Name> + </ProjectReference> <ProjectReference Include="..\MetroWpf.Framework\MetroWpf.Framework.csproj"> <Project>{F0D99F7E-D4A6-4DBB-B492-D4BE9EA61EE2}</Project> <Name>MetroWpf.Framework</Name> </ProjectReference> - <ProjectReference Include="..\MetroWpf.Services\MetroWpf.Services.csproj"> - <Project>{E1B9AA29-C609-4CF1-87E9-7CE4D2EED8A4}</Project> - <Name>MetroWpf.Services</Name> - </ProjectReference> <ProjectReference Include="..\MetroWpf.Xaml\MetroWpf.Xaml.csproj"> <Project>{A5D99423-4BAE-4FC0-A0CB-F7238EC2C402}</Project> <Name>MetroWpf.Xaml</Name>
--- a/MetroWpf/MetroWpf/Presentation/About/AboutView.xaml Tue Mar 20 16:53:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -<UserControl - x:Class="MetroWpf.Presentation.About.AboutView" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - mc:Ignorable="d" - DataContext="{Binding AboutViewModel, Source={StaticResource Locator}}"> - - <Grid> - <StackPanel Margin="60,10,60,0"> - <Image Margin="0" Source="{Binding ApplicationIcon, Mode=OneTime}" Height="150" Width="150" HorizontalAlignment="Center"/> - <TextBlock TextWrapping="Wrap" FontWeight="Bold" FontSize="69.333" HorizontalAlignment="Left" Margin="-4,0,0,0"><Run Text="{Binding ApplicationTitle, Mode=OneTime}"/></TextBlock> - <TextBlock Margin="0,-18,0,0" TextWrapping="Wrap" FontWeight="Bold" HorizontalAlignment="Left" Height="20.83"><Run Text="version "/><Run Text=" "/><Run Text="{Binding Version, Mode=OneTime}" /><Run Text=" "/><Run Text="{Binding Configuration, Mode=OneTime}" /></TextBlock> - <TextBlock TextWrapping="Wrap" Foreground="#FF41B1E1" Margin="0,-7,-0.001,0" VerticalAlignment="Bottom" HorizontalAlignment="Left" FontFamily="Segoe UI Light" FontSize="18.667"><Run Text="a silverblade technology project"/></TextBlock> - <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Margin="0,8,0,0" FontFamily="Segoe UI Light" FontSize="32" Text="by" /> - <TextBlock Text="{Binding Authors}" TextWrapping="Wrap" Margin="0,4,0,0" /> - <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Margin="0,10,0,0" FontFamily="Segoe UI Light" FontSize="32" ><Run Text="MetroWpf uses"/></TextBlock> - <TextBlock Text="{Binding Components}" TextWrapping="Wrap" Margin="0,4,0,0" /> - <Button x:Name="Visit" Content="StevenHollidge.com" HorizontalAlignment="Center" Margin="0,25,0,0" Style="{DynamicResource SquareButtonStyle}" Width="145"/> - </StackPanel> - </Grid> -</UserControl> \ No newline at end of file
--- a/MetroWpf/MetroWpf/Presentation/About/AboutView.xaml.cs Tue Mar 20 16:53:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -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 MetroWpf.Presentation.About -{ - /// <summary> - /// Interaction logic for AboutView.xaml - /// </summary> - public partial class AboutView : UserControl - { - public AboutView() - { - InitializeComponent(); - } - } -}
--- a/MetroWpf/MetroWpf/Presentation/About/AboutViewModel.cs Tue Mar 20 16:53:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Windows.Media.Imaging; -using GalaSoft.MvvmLight; -using MetroWpf.Framework.Interfaces; - -namespace MetroWpf.Presentation.About -{ - public class AboutViewModel : ViewModelBase - { - private readonly IWpfApplication wpfApplication; - - public AboutViewModel(IWpfApplication wpfApplication) - { - this.wpfApplication = wpfApplication; - } - - public string ApplicationTitle { get { return wpfApplication.ApplicationTitle; } } - - public BitmapSource ApplicationIcon { get { return wpfApplication.ApplicationIcon; } } - - public string Version - { - get - { - return Assembly.GetExecutingAssembly().GetName().Version.ToString(); - } - } - - public string Configuration - { - get - { - var attr = Assembly.GetExecutingAssembly() - .GetCustomAttributes(typeof(AssemblyConfigurationAttribute), false) - .OfType<AssemblyConfigurationAttribute>() - .FirstOrDefault() ?? new AssemblyConfigurationAttribute(""); - - return attr.Configuration; - } - } - - // let's evolve the app as a fully loaded starting point for an app - private readonly List<string> authors = new List<string> - { - "Steven Hollidge" - }; - public string Authors - { - get { return string.Join(", ", authors); } - } - - private readonly List<string> components = new List<string> - { - "MahApps.Metro", - "Markdown", - "MVVM Light" - }; - public string Components - { - get { return string.Join(", ", components); } - } - - public void Visit() - { - try - { - System.Diagnostics.Process.Start("http://stevenhollidge.com"); - } - catch // browser exceptions - { - - } - } - } -}
--- a/MetroWpf/MetroWpf/Presentation/Exceptions/ExceptionDialog.xaml Tue Mar 20 16:53:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -<Window x:Class="MetroWpf.Presentation.Exceptions.ExceptionDialog" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" - xmlns:Behaviours="clr-namespace:MahApps.Metro.Behaviours;assembly=MahApps.Metro" - MouseLeftButtonDown="DragMoveWindow" - SnapsToDevicePixels="True" - WindowStartupLocation="CenterOwner" Width="571" Height="374" ResizeMode="NoResize"> - <i:Interaction.Behaviors> - <Behaviours:BorderlessWindowBehavior ResizeWithGrip="False" /> - </i:Interaction.Behaviors> - - <Window.Resources> - <ResourceDictionary> - <ResourceDictionary.MergedDictionaries> - <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" /> - <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" /> - <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" /> - <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" /> - <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedSingleRowTabControl.xaml" /> - <ResourceDictionary Source="pack://application:,,,/MetroWpf;component/Xaml/Styles/MetroWpf.Accents.xaml" /> - </ResourceDictionary.MergedDictionaries> - </ResourceDictionary> - </Window.Resources> - - <Window.Background> - <LinearGradientBrush MappingMode="Absolute" StartPoint="0,0" EndPoint="0,180"> - <GradientStop Color="#EEEEEE" /> - <GradientStop Color="White" Offset="1" /> - </LinearGradientBrush> - </Window.Background> - - <Grid Margin="10"> - <Grid.RowDefinitions> - <RowDefinition Height="Auto" /> - <RowDefinition Height="Auto" /> - <RowDefinition Height="Auto" /> - <RowDefinition Height="*" /> - <RowDefinition Height="Auto" /> - </Grid.RowDefinitions> - - <TextBlock - TextWrapping="Wrap" - VerticalAlignment="Top" - FontWeight="Heavy" - FontSize="30" - Text="Don't Panic." - /> - - <Button Style="{DynamicResource ChromelessButtonStyle}" Content="r" - HorizontalAlignment="Right" - VerticalAlignment="Top" - FontFamily="Marlett" - Click="TryClose"/> - - <TextBlock - Grid.Row="1" - TextWrapping="Wrap" - FontSize="12" - Text="Something has gone horribly wrong, but don't let that worry you." - /> - - <StackPanel Grid.Row="2" Margin="0,10,0,0"> - <TextBlock Text="Message" FontSize="18.667" FontWeight="Light" /> - <Border BorderThickness="1" BorderBrush="{DynamicResource GrayBrush9}" Padding="5"> - <TextBlock x:Name="messageBox" Text="Ima exception, weeee" /> - </Border> - </StackPanel> - - <Grid Grid.Row="3" Margin="0,10,0,0"> - <Grid.RowDefinitions> - <RowDefinition Height="Auto" /> - <RowDefinition Height="*" /> - </Grid.RowDefinitions> - <TextBlock Text="Details" FontSize="18.667" FontWeight="Light" /> - <Border Grid.Row="1" BorderThickness="1" BorderBrush="{DynamicResource GrayBrush9}"> - <ScrollViewer VerticalScrollBarVisibility="Auto"> - <TextBlock x:Name="detailsBox" Text="Some long rambly text about the exception. Maybe a stack trace." /> - </ScrollViewer> - </Border> - </Grid> - - <StackPanel HorizontalAlignment="Right" Grid.Row="4" Height="25" Margin="10" Orientation="Horizontal"> - <Button Width="75" Click="CopyToClipboard" Content="Copy" Margin="0 0 5 0" /> - <Button Width="75" Click="TryClose" Content="Close" /> - </StackPanel> - - </Grid> -</Window>
--- a/MetroWpf/MetroWpf/Presentation/Exceptions/ExceptionDialog.xaml.cs Tue Mar 20 16:53:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -using System; -using System.Diagnostics; -using System.Threading; -using System.Windows; -using System.Windows.Input; - -namespace MetroWpf.Presentation.Exceptions -{ - /// <summary> - /// Interaction logic for ExceptionDialog.xaml - /// </summary> - public partial class ExceptionDialog : Window - { - private System.Exception exception; - private string details; - private string message; - - public ExceptionDialog() - { - InitializeComponent(); - } - - private void DragMoveWindow(object sender, MouseButtonEventArgs e) - { - if (e.RightButton != MouseButtonState.Pressed - && e.MiddleButton != MouseButtonState.Pressed) - DragMove(); - } - - public string Message - { - get { return message; } - set - { - message = value; - - messageBox.Text = value; - } - } - - public string Details - { - get { return details; } - set - { - details = value; - detailsBox.Text = value; - } - } - - public System.Exception Exception - { - get { return exception; } - set { exception = value; } - } - - private void TryClose(object sender, RoutedEventArgs e) - { - this.Close(); - } - - private void CopyToClipboard(object sender, RoutedEventArgs e) - { - SetData(DataFormats.Text, this.Details); - } - - // Implementation taken from the WinForms clipboard class. - // Seriously, the clipboard can fail, so it retries 10 times. - private void SetData(string format, object data) - { - if (!data.GetType().IsSerializable) - { - throw new NotSupportedException("An object being added to the clipboard must be serializable. Ensure that the entire object tree is serializable."); - } - - bool succeeded = false; - for (int i = 0; i < 10 && !succeeded; i++) - { - try - { - System.Windows.Clipboard.SetData(format, data); - succeeded = true; - } - catch (Exception e) - { - Trace.WriteLine(e, "ERROR"); - } - if (!succeeded) - Thread.Sleep(100); - } - } - } -}
--- a/MetroWpf/MetroWpf/Presentation/Login/LoginView.xaml Tue Mar 20 16:53:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -<UserControl - x:Class="MetroWpf.Presentation.Login.LoginView" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" - xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options" - xmlns:converters="clr-namespace:MetroWpf.Xaml.Converters;assembly=MetroWpf.Xaml" - xmlns:c="clr-namespace:MetroWpf.Xaml.Controls;assembly=MetroWpf.Xaml" - xmlns:controls="clr-namespace:Microsoft.Windows.Controls;assembly=MetroWpf.Xaml" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - mc:Ignorable="d" - DataContext="{Binding LoginViewModel, Source={StaticResource Locator}}"> - - <Grid x:Name="VisualRoot" Height="500" Width="570"> - <Grid.InputBindings> - <KeyBinding Gesture="Enter" Command="{Binding LoginCommand}" /> - </Grid.InputBindings> - - <Grid.RowDefinitions> - <RowDefinition Height="Auto" /> - <RowDefinition Height="10" /> - <RowDefinition Height="60" /> - <RowDefinition Height="Auto" /> - <RowDefinition Height="10" /> - <RowDefinition Height="Auto" /> - <RowDefinition Height="Auto" /> - <RowDefinition Height="90" /> - <RowDefinition Height="Auto" /> - </Grid.RowDefinitions> - - <Rectangle - x:Name="BrandBar" Grid.Row="1" - Fill="{DynamicResource BrandingBrush}" - HorizontalAlignment="Left" VerticalAlignment="Bottom" - Width="125" Height="6" IsHitTestVisible="False" /> - - <TextBlock Grid.Row="2" FontSize="24" FontFamily="{DynamicResource HeaderFontFamily}"><Run>WELCOME TO OUR METRO WORLD</Run></TextBlock> - - - <Grid Grid.Row="3"> - <Border Grid.RowSpan="4" - Grid.ColumnSpan="3" - BorderThickness="1" - BorderBrush="{DynamicResource PageBorderBrush}" - Background="{DynamicResource BackgroundGradient}" - Padding="3.5"> - - <Grid VerticalAlignment="Top"> - <Grid.RowDefinitions> - <RowDefinition Height="Auto" /> - <RowDefinition Height="Auto" /> - <RowDefinition Height="Auto" /> - <RowDefinition Height="Auto" /> - </Grid.RowDefinitions> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="*" /> - <ColumnDefinition Width="*" /> - <ColumnDefinition Width="85" /> - </Grid.ColumnDefinitions> - - <controls:WatermarkTextBox - Grid.Column="0" Grid.Row="0" - Watermark="USERNAME" - Text="{Binding UserId, Mode=TwoWay, ValidatesOnDataErrors=True}" - HorizontalAlignment="Left" VerticalAlignment="Center" - Width="220" MaxLength="50" Margin="3.5" /> - - - <PasswordBox - Grid.Column="0" Grid.Row="1" - c:PasswordBoxHelper.BoundPassword="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=Default, ValidatesOnDataErrors=True}" - HorizontalAlignment="Left" VerticalAlignment="Center" - Width="220" MaxLength="50" Margin="3.5" /> - - <Button x:Name="btnLogin" - Grid.Column="1" Grid.Row="1" - Margin="3.5" - Content="SIGN IN" - FontWeight="Bold" - FontSize="10" - HorizontalAlignment="Left" - VerticalAlignment="Center" - Command="{Binding LoginCommand}" - IsDefault="True" - Width="90"> - </Button> - - <CheckBox Grid.Column="0" Grid.Row="2" - Content="Remember my password" - Margin="3.5" VerticalAlignment="Center" - Opacity="0.6" /> - <CheckBox Grid.Column="0" Grid.Row="3" - Content="Remember me" - Margin="3.5" VerticalAlignment="Center" - Opacity="0.6" /> - <CheckBox Grid.Column="1" Grid.Row="2" - Content="Sign me in automatically" - Margin="3.5" VerticalAlignment="Center" - Opacity="0.6" /> - </Grid> - </Border> - </Grid> - - <Button Grid.Row="5" - FontWeight="Normal" FontSize="16" - Content="create new account" - HorizontalAlignment="Left" - VerticalAlignment="Bottom" - Style="{DynamicResource ChromelessButtonStyle}"> - </Button> - - <Button Grid.Row="6" - FontWeight="Normal" FontSize="16" - Content="forgot your password" - HorizontalAlignment="Left" - VerticalAlignment="Top" - Style="{DynamicResource ChromelessButtonStyle}"> - </Button> - - <Button Grid.Row="8" - Margin="3.5" - FontWeight="Bold" - Content="CANCEL" - Command="{Binding CloseCommand}" - HorizontalAlignment="Right" - VerticalAlignment="Center" - IsCancel="True" - Width="90"> - </Button> - </Grid> -</UserControl>
--- a/MetroWpf/MetroWpf/Presentation/Login/LoginView.xaml.cs Tue Mar 20 16:53:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -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 MetroWpf.Presentation.Login -{ - /// <summary> - /// Interaction logic for LoginView.xaml - /// </summary> - public partial class LoginView : UserControl - { - public LoginView() - { - InitializeComponent(); - } - } -}
--- a/MetroWpf/MetroWpf/Presentation/Login/LoginViewModel.cs Tue Mar 20 16:53:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -using GalaSoft.MvvmLight; -using GalaSoft.MvvmLight.Command; -using GalaSoft.MvvmLight.Messaging; -using MetroWpf.Messages; - -namespace MetroWpf.Presentation.Login -{ - /// <summary> - /// Login view view model class - /// </summary> - public sealed class LoginViewModel : - ViewModelBase - { - #region · Data Properties · - - /// <summary> - /// Gets or sets whether the form is busy - /// </summary> - private bool isBusy; - public bool IsBusy - { - get { return isBusy; } - set - { - if (this.isBusy != value) - { - this.isBusy = value; - RaisePropertyChanged("IsBusy"); - //relay requery? - } - } - } - - /// <summary> - /// Gets or sets the user name - /// </summary> - private string userId; - public string UserId - { - get { return this.userId; } - set - { - if (this.userId != value) - { - this.userId = value; - RaisePropertyChanged("UserId"); - LoginCommand.RaiseCanExecuteChanged(); - } - } - } - - /// <summary> - /// Gets or sets the password - /// </summary> - private string password; - public string Password - { - get { return this.password; } - set - { - if (this.password != value) - { - this.password = value; - RaisePropertyChanged("Password"); - LoginCommand.RaiseCanExecuteChanged(); - } - } - } - - #endregion - - #region · Constructors · - - /// <summary> - /// Initializes a new instance of the <see cref="LoginViewModel"/> class - /// </summary> - public LoginViewModel() - : base() - { - LoginCommand = new RelayCommand(LoginCommandExecute, CanLoginCommandExecute); - CloseCommand = new RelayCommand(CloseCommandExecute); - } - - #endregion - - #region · Command Actions · - - #region LoginCommand - - public RelayCommand LoginCommand { get; set; } - - private void LoginCommandExecute() - { - //successful login! - - Messenger.Default.Send(new UserAuthenticatedMessage() { UserId = userId }); - } - - private bool CanLoginCommandExecute() - { - if (string.IsNullOrEmpty(UserId) || - string.IsNullOrEmpty(Password)) - return false; - - return true; - } - - #endregion - - #region CloseCommand - public RelayCommand CloseCommand { get; set; } - - private void CloseCommandExecute() - { - } - #endregion - - #endregion - } -} \ No newline at end of file
--- a/MetroWpf/MetroWpf/Presentation/Login/UserLogin.cs Tue Mar 20 16:53:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -using System.Collections.Generic; -using System.ComponentModel; -using GalaSoft.MvvmLight; - -namespace MetroWpf.Presentation.Login -{ - public sealed class UserLogin : - ObservableObject, - IDataErrorInfo - { - #region · Fields · - - private Dictionary<string, string> _errors - = new Dictionary<string, string>(); - - #endregion - - #region · IDataErrorInfo Members · - - public string Error - { - get { return null; } - } - - public string this[string columnName] - { - get { return null; } - } - - #endregion - - #region · Properties · - - public string UserId { get; set; } - public string Password { get; set; } - - #endregion - - #region · Constructors · - - public UserLogin() - { - } - - #endregion - } -}
--- a/MetroWpf/MetroWpf/Presentation/Menu/MenuView.xaml Tue Mar 20 16:53:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -<UserControl x:Class="MetroWpf.Presentation.Menu.MenuView" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:about="clr-namespace:MetroWpf.Presentation.About" - xmlns:converters="clr-namespace:MetroWpf.Xaml.Converters;assembly=MetroWpf.Xaml" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:login="clr-namespace:MetroWpf.Presentation.Login" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:settings="clr-namespace:MetroWpf.Presentation.Settings" - xmlns:stocks="clr-namespace:Stocks.UI.Views;assembly=Stocks.UI" - xmlns:userprofile="clr-namespace:MetroWpf.Presentation.UserProfile" - DataContext="{Binding MenuViewModel, - Source={StaticResource Locator}}" - mc:Ignorable="d"> - <Grid> - <TabControl x:Name="tabHost" SelectedIndex="{Binding SelectedTabIndex, Converter={converters:EnumToIntConverter}}"> - - <TabItem Header="_Stocks" Visibility="{Binding ShowStocks, Converter={converters:BooleanToVisibilityConverter}}"> - <StackPanel Margin="25,10" HorizontalAlignment="Center"> - <stocks:StocksView DataContext="{Binding StocksViewModel, Source={StaticResource Locator}}" /> - </StackPanel> - </TabItem> - - <TabItem Header="_Rates" Visibility="{Binding ShowFxRates, Converter={converters:BooleanToVisibilityConverter}}"> - <StackPanel Margin="25,10" /> - </TabItem> - - <!-- Start of hidden tabs --> - <TabItem Name="tabItemLogin" Visibility="{Binding ShowLogin, Converter={converters:BooleanToVisibilityConverter}}"> - <StackPanel Margin="25,10" - HorizontalAlignment="Center" - VerticalAlignment="Center"> - <login:LoginView /> - </StackPanel> - </TabItem> - - <TabItem Name="tabItemUserProfile" Visibility="{Binding ShowUserProfile, Converter={converters:BooleanToVisibilityConverter}}"> - <StackPanel Margin="25,10"> - <userprofile:UserProfileView /> - </StackPanel> - </TabItem> - - <TabItem Name="tabItemSettings" Visibility="{Binding ShowSettings, Converter={converters:BooleanToVisibilityConverter}}"> - <StackPanel Margin="25,10"> - <settings:SettingsView /> - </StackPanel> - </TabItem> - - <TabItem Name="tabItemAbout" Visibility="{Binding ShowAbout, Converter={converters:BooleanToVisibilityConverter}}"> - <StackPanel Margin="25,10"> - <about:AboutView /> - </StackPanel> - </TabItem> - - <TabItem Name="tabItemHelp" Visibility="{Binding ShowHelp, Converter={converters:BooleanToVisibilityConverter}}"> - <StackPanel Margin="25,10"> - <about:AboutView /> - </StackPanel> - </TabItem> - <!-- End of hidden tabs --> - </TabControl> - </Grid> -</UserControl> \ No newline at end of file
--- a/MetroWpf/MetroWpf/Presentation/Menu/MenuView.xaml.cs Tue Mar 20 16:53:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -using System.Windows.Controls; -using GalaSoft.MvvmLight.Messaging; -using MetroWpf.Messages; - -namespace MetroWpf.Presentation.Menu -{ - /// <summary> - /// Interaction logic for TabMenu.xaml - /// </summary> - public partial class MenuView : UserControl - { - public MenuView() - { - InitializeComponent(); - } - } -}
--- a/MetroWpf/MetroWpf/Presentation/Menu/MenuViewModel.cs Tue Mar 20 16:53:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,214 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using GalaSoft.MvvmLight; -using GalaSoft.MvvmLight.Messaging; -using MetroWpf.Messages; - -namespace MetroWpf.Presentation.Menu -{ - public class MenuViewModel : ViewModelBase - { - private Screen selectedTabIndex; - public Screen SelectedTabIndex - { - get { return selectedTabIndex; } - set - { - if (selectedTabIndex == value) - return; - - selectedTabIndex = value; - RaisePropertyChanged("SelectedTabIndex"); - } - } - - private bool showStocks; - public bool ShowStocks - { - get { return showStocks; } - set - { - if (showStocks == value) - return; - - showStocks = value; - RaisePropertyChanged("ShowStocks"); - } - } - - private bool showFxRates; - public bool ShowFxRates - { - get { return showFxRates; } - set - { - if (showFxRates == value) - return; - - showFxRates = value; - RaisePropertyChanged("ShowFxRates"); - } - } - - private bool showLogin; - public bool ShowLogin - { - get { return showLogin; } - set - { - if (showLogin == value) - return; - - showLogin = value; - RaisePropertyChanged("ShowLogin"); - } - } - - private bool showUserProfile; - public bool ShowUserProfile - { - get { return showUserProfile; } - set - { - if (showUserProfile == value) - return; - - showUserProfile = value; - RaisePropertyChanged("ShowUserProfile"); - } - } - - private bool showSettings; - public bool ShowSettings - { - get { return showSettings; } - set - { - if (showSettings == value) - return; - - showSettings = value; - RaisePropertyChanged("ShowSettings"); - } - } - - private bool showAbout; - public bool ShowAbout - { - get { return showAbout; } - set - { - if (showAbout == value) - return; - - showAbout = value; - RaisePropertyChanged("ShowAbout"); - } - } - - private bool showHelp; - public bool ShowHelp - { - get { return showHelp; } - set - { - if (showHelp == value) - return; - - showHelp = value; - RaisePropertyChanged("ShowHelp"); - } - } - - public MenuViewModel() - { - Init(); - } - - private void Init() - { - Messenger.Default.Register<NavigationMessage>( - this, - message => ChangeDisplayScreen(message.DisplayScreen)); - - Messenger.Default.Register<UserAuthenticatedMessage>( - this, - message => UserAuthenticated(message.UserId)); - - ChangeDisplayScreen(Screen.Login); - } - - private void UserAuthenticated(string userId) - { - Messenger.Default.Send(new NavigationMessage() { DisplayScreen= Screen.Stocks }); - } - - private void ChangeDisplayScreen(Screen screen) - { - switch (screen) - { - case Screen.Login: - ShowLogin = true; - - ShowStocks = false; - ShowFxRates = false; - ShowUserProfile = false; - ShowSettings = false; - ShowAbout = false; - ShowHelp = false; - break; - case Screen.Stocks: - ShowStocks = true; - ShowFxRates = true; - - ShowLogin = false; - ShowUserProfile = false; - ShowSettings = false; - ShowAbout = false; - ShowHelp = false; - break; - case Screen.UserProfile: - ShowUserProfile = true; - - ShowStocks = false; - ShowFxRates = false; - ShowLogin = false; - ShowSettings = false; - ShowAbout = false; - ShowHelp = false; - break; - case Screen.Settings: - ShowSettings = true; - - ShowStocks = false; - ShowFxRates = false; - ShowLogin = false; - ShowUserProfile = false; - ShowAbout = false; - ShowHelp = false; - break; - case Screen.About: - ShowAbout = true; - - ShowStocks = false; - ShowFxRates = false; - ShowLogin = false; - ShowUserProfile = false; - ShowSettings = false; - ShowHelp = false; - break; - case Screen.Help: - ShowLogin = false; - ShowUserProfile = false; - ShowSettings = false; - ShowAbout = false; - ShowHelp = true; - break; - } - - SelectedTabIndex = screen; - } - } -}
--- a/MetroWpf/MetroWpf/Presentation/Screen.cs Tue Mar 20 16:53:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - -namespace MetroWpf.Presentation -{ - public enum Screen - { - Stocks, - FxRates, - Login, - UserProfile, - Settings, - About, - Help - } -}
--- a/MetroWpf/MetroWpf/Presentation/Settings/SettingsView.xaml Tue Mar 20 16:53:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -<UserControl x:Class="MetroWpf.Presentation.Settings.SettingsView" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:local="clr-namespace:MetroWpf.Presentation.Settings" - xmlns:s="clr-namespace:MetroWpf.Styles" - xmlns:System="clr-namespace:System;assembly=mscorlib" - mc:Ignorable="d" - d:DesignHeight="50" d:DesignWidth="350" - DataContext="{Binding SettingsViewModel, Source={StaticResource Locator}}"> - <UserControl.Resources> - <ObjectDataProvider x:Key="ApplicationStyleEnum" - MethodName="GetValues" - ObjectType="{x:Type System:Enum}"> - <ObjectDataProvider.MethodParameters> - <x:Type TypeName="s:ApplicationStyle"/> - </ObjectDataProvider.MethodParameters> - </ObjectDataProvider> - </UserControl.Resources> - <Grid> - <StackPanel Orientation="Horizontal" VerticalAlignment="Top"> - <Label Width="50">Style:</Label> - <ComboBox Width="300" - ItemsSource="{Binding Source={StaticResource ApplicationStyleEnum}}" - SelectedItem="{Binding Path=SelectedApplicationStyle, Mode=TwoWay}"/> - </StackPanel> - </Grid> -</UserControl>
--- a/MetroWpf/MetroWpf/Presentation/Settings/SettingsView.xaml.cs Tue Mar 20 16:53:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -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 MetroWpf.Presentation.Settings -{ - /// <summary> - /// Interaction logic for SettingsView.xaml - /// </summary> - public partial class SettingsView : UserControl - { - public SettingsView() - { - InitializeComponent(); - } - } -}
--- a/MetroWpf/MetroWpf/Presentation/Settings/SettingsViewModel.cs Tue Mar 20 16:53:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -using GalaSoft.MvvmLight; -using GalaSoft.MvvmLight.Messaging; -using MetroWpf.Messages; -using MetroWpf.Styles; - -namespace MetroWpf.Presentation.Settings -{ - public class SettingsViewModel : ViewModelBase - { - ApplicationStyle _selectedApplicationStyle; - - public SettingsViewModel() - { - _selectedApplicationStyle = ApplicationStyle.BlueLight; - } - - public ApplicationStyle SelectedApplicationStyle - { - get { return _selectedApplicationStyle; } - set - { - _selectedApplicationStyle = value; - RaisePropertyChanged("SelectedApplicationStyle"); - - Messenger.Default.Send( - new ApplicationStyleChangeMessage() - { ApplicationStyle = _selectedApplicationStyle }); - } - } - } -}
--- a/MetroWpf/MetroWpf/Presentation/Shell/MainWindow.xaml Tue Mar 20 16:53:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -<Controls:MetroWindow - x:Class="MetroWpf.Presentation.Shell.MainWindow" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - mc:Ignorable="d" - xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" - xmlns:presentation="clr-namespace:MetroWpf.Presentation" - xmlns:menu="clr-namespace:MetroWpf.Presentation.Menu" - xmlns:converters="clr-namespace:MetroWpf.Xaml.Converters;assembly=MetroWpf.Xaml" - Title="Metro WPF Demo" - Height="490" - Width="660" - Icon="../logo.ico" - ShowIconOnTitleBar="true" - ShowTitleBar="true" - WindowState="Maximized" - DataContext="{Binding MainWindowViewModel, Source={StaticResource Locator}}"> - - <Window.Resources> - <ResourceDictionary> - <ResourceDictionary.MergedDictionaries> - <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" /> - <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" /> - <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" /> - <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedSingleRowTabControl.xaml" /> - <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Icons/MergedResources.xaml" /> - <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" /> - <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" /> - <ResourceDictionary Source="pack://application:,,,/MetroWpf.Xaml;component/Styles/Controls.WatermarkTextBox.xaml" /> - </ResourceDictionary.MergedDictionaries> - </ResourceDictionary> - </Window.Resources> - - <Controls:MetroContentControl> - <Grid> - - <menu:MenuView /> - - <StackPanel x:Name="TopRightOptions" - HorizontalAlignment="Right" - VerticalAlignment="Top" - Margin="0,4,0,0" - Orientation="Horizontal" - Visibility="{Binding ShowTopRightOptions, Converter={converters:BooleanToVisibilityConverter}}"> - <Button x:Name="UserLogOnInfo" - Content="stevenh" - Style="{DynamicResource ChromelessButtonStyle}" - FontSize="10.667" - Margin="15,0,0,0" - Command="{Binding Path=MenuCommand}" - CommandParameter="{x:Static presentation:Screen.UserProfile}" /> - <Button x:Name="ShowSettings" - Content="settings" - Style="{DynamicResource ChromelessButtonStyle}" - FontSize="10.667" - Margin="15,0,0,0" - Command="{Binding Path=MenuCommand}" - CommandParameter="{x:Static presentation:Screen.Settings}" /> - <Button x:Name="ShowAbout" - Content="about" - Style="{DynamicResource ChromelessButtonStyle}" - FontSize="10.667" - Margin="15,0,0,0" - Command="{Binding Path=MenuCommand}" - CommandParameter="{x:Static presentation:Screen.About}" /> - <Button x:Name="ShowHelp" - Content="help" - Style="{DynamicResource ChromelessButtonStyle}" - FontSize="10.667" - Margin="15,0,20,0" - Command="{Binding Path=MenuCommand}" - CommandParameter="{x:Static presentation:Screen.Help}" /> - </StackPanel> - </Grid> - </Controls:MetroContentControl> -</Controls:MetroWindow>
--- a/MetroWpf/MetroWpf/Presentation/Shell/MainWindow.xaml.cs Tue Mar 20 16:53:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -using System.Windows.Input; -using GalaSoft.MvvmLight.Messaging; -using MetroWpf.Messages; -using MetroWpf.Styles; -using MahApps.Metro; -using System.Linq; - -namespace MetroWpf.Presentation.Shell -{ - public partial class MainWindow - { - public MainWindow() - { - //DataContext = new MainWindowViewModel(Dispatcher); - InitializeComponent(); - - // setup notifications - Messenger.Default.Register<ApplicationStyleChangeMessage>( - this, message => ChangeTheme(message.ApplicationStyle)); - } - - private void ChangeTheme(ApplicationStyle applicationStyle) - { - switch (applicationStyle) - { - case ApplicationStyle.BlueLight: - ThemeManager.ChangeTheme(this, ThemeManager.DefaultAccents.First(a => a.Name == "Blue"), Theme.Light); - break; - case ApplicationStyle.BlueDark: - ThemeManager.ChangeTheme(this, ThemeManager.DefaultAccents.First(a => a.Name == "Blue"), Theme.Dark); - break; - case ApplicationStyle.GreenLight: - ThemeManager.ChangeTheme(this, ThemeManager.DefaultAccents.First(a => a.Name == "Green"), Theme.Light); - break; - case ApplicationStyle.GreenDark: - ThemeManager.ChangeTheme(this, ThemeManager.DefaultAccents.First(a => a.Name == "Green"), Theme.Dark); - break; - case ApplicationStyle.RedLight: - ThemeManager.ChangeTheme(this, ThemeManager.DefaultAccents.First(a => a.Name == "Red"), Theme.Light); - break; - case ApplicationStyle.RedDark: - ThemeManager.ChangeTheme(this, ThemeManager.DefaultAccents.First(a => a.Name == "Red"), Theme.Dark); - break; - case ApplicationStyle.PurpleLight: - ThemeManager.ChangeTheme(this, ThemeManager.DefaultAccents.First(a => a.Name == "Purple"), Theme.Light); - break; - case ApplicationStyle.PurpleDark: - ThemeManager.ChangeTheme(this, ThemeManager.DefaultAccents.First(a => a.Name == "Purple"), Theme.Dark); - break; - } - } - } -}
--- a/MetroWpf/MetroWpf/Presentation/Shell/MainWindowViewModel.cs Tue Mar 20 16:53:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -using System.Windows.Threading; -using GalaSoft.MvvmLight; -using GalaSoft.MvvmLight.Command; -using GalaSoft.MvvmLight.Messaging; -using MetroWpf.Messages; - -namespace MetroWpf.Presentation.Shell -{ - public class MainWindowViewModel : ViewModelBase - { - private bool showTopRightOptions; - public bool ShowTopRightOptions - { - get { return showTopRightOptions; } - set - { - if (showTopRightOptions == value) - return; - - showTopRightOptions = value; - RaisePropertyChanged("ShowTopRightOptions"); - } - } - - public RelayCommand<Screen> MenuCommand { get; set; } - - public MainWindowViewModel() - { - MenuCommand = new RelayCommand<Screen>(MenuCommandExecute); - } - - private void MenuCommandExecute(Screen screen) - { - Messenger.Default.Send( - new NavigationMessage() - { - DisplayScreen = screen - }); - } - } -} \ No newline at end of file
--- a/MetroWpf/MetroWpf/Presentation/UserProfile/UserProfileView.xaml Tue Mar 20 16:53:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -<UserControl x:Class="MetroWpf.Presentation.UserProfile.UserProfileView" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - mc:Ignorable="d" - DataContext="{Binding UserProfileViewModel, Source={StaticResource Locator}}"> - <Grid> - - </Grid> -</UserControl>
--- a/MetroWpf/MetroWpf/Presentation/UserProfile/UserProfileView.xaml.cs Tue Mar 20 16:53:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -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 MetroWpf.Presentation.UserProfile -{ - /// <summary> - /// Interaction logic for UserProfileView.xaml - /// </summary> - public partial class UserProfileView : UserControl - { - public UserProfileView() - { - InitializeComponent(); - } - } -}
--- a/MetroWpf/MetroWpf/Presentation/UserProfile/UserProfileViewModel.cs Tue Mar 20 16:53:29 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace MetroWpf.Presentation.UserProfile -{ - public class UserProfileViewModel - { - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf/UI/About/AboutView.xaml Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,23 @@ +<UserControl + x:Class="MetroWpf.UI.About.AboutView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + mc:Ignorable="d" + DataContext="{Binding AboutViewModel, Source={StaticResource Locator}}"> + + <Grid> + <StackPanel Margin="60,10,60,0"> + <Image Margin="0" Source="{Binding ApplicationIcon, Mode=OneTime}" Height="150" Width="150" HorizontalAlignment="Center"/> + <TextBlock TextWrapping="Wrap" FontWeight="Bold" FontSize="69.333" HorizontalAlignment="Left" Margin="-4,0,0,0"><Run Text="{Binding ApplicationTitle, Mode=OneTime}"/></TextBlock> + <TextBlock Margin="0,-18,0,0" TextWrapping="Wrap" FontWeight="Bold" HorizontalAlignment="Left" Height="20.83"><Run Text="version "/><Run Text=" "/><Run Text="{Binding Version, Mode=OneTime}" /><Run Text=" "/><Run Text="{Binding Configuration, Mode=OneTime}" /></TextBlock> + <TextBlock TextWrapping="Wrap" Foreground="#FF41B1E1" Margin="0,-7,-0.001,0" VerticalAlignment="Bottom" HorizontalAlignment="Left" FontFamily="Segoe UI Light" FontSize="18.667"><Run Text="a silverblade technology project"/></TextBlock> + <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Margin="0,8,0,0" FontFamily="Segoe UI Light" FontSize="32" Text="by" /> + <TextBlock Text="{Binding Authors}" TextWrapping="Wrap" Margin="0,4,0,0" /> + <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Margin="0,10,0,0" FontFamily="Segoe UI Light" FontSize="32" ><Run Text="MetroWpf uses"/></TextBlock> + <TextBlock Text="{Binding Components}" TextWrapping="Wrap" Margin="0,4,0,0" /> + <Button x:Name="Visit" Content="StevenHollidge.com" HorizontalAlignment="Center" Margin="0,25,0,0" Style="{DynamicResource SquareButtonStyle}" Width="145"/> + </StackPanel> + </Grid> +</UserControl> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf/UI/About/AboutView.xaml.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,15 @@ +using System.Windows.Controls; + +namespace MetroWpf.UI.About +{ + /// <summary> + /// Interaction logic for AboutView.xaml + /// </summary> + public partial class AboutView : UserControl + { + public AboutView() + { + InitializeComponent(); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf/UI/About/AboutViewModel.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,77 @@ +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Windows.Media.Imaging; +using GalaSoft.MvvmLight; +using MetroWpf.Framework.Interfaces; + +namespace MetroWpf.UI.About +{ + public class AboutViewModel : ViewModelBase + { + private readonly IWpfApplication wpfApplication; + + public AboutViewModel(IWpfApplication wpfApplication) + { + this.wpfApplication = wpfApplication; + } + + public string ApplicationTitle { get { return wpfApplication.ApplicationTitle; } } + + public BitmapSource ApplicationIcon { get { return wpfApplication.ApplicationIcon; } } + + public string Version + { + get + { + return Assembly.GetExecutingAssembly().GetName().Version.ToString(); + } + } + + public string Configuration + { + get + { + var attr = Assembly.GetExecutingAssembly() + .GetCustomAttributes(typeof(AssemblyConfigurationAttribute), false) + .OfType<AssemblyConfigurationAttribute>() + .FirstOrDefault() ?? new AssemblyConfigurationAttribute(""); + + return attr.Configuration; + } + } + + // let's evolve the app as a fully loaded starting point for an app + private readonly List<string> authors = new List<string> + { + "Steven Hollidge" + }; + public string Authors + { + get { return string.Join(", ", authors); } + } + + private readonly List<string> components = new List<string> + { + "MahApps.Metro", + "Markdown", + "MVVM Light" + }; + public string Components + { + get { return string.Join(", ", components); } + } + + public void Visit() + { + try + { + System.Diagnostics.Process.Start("http://stevenhollidge.com"); + } + catch // browser exceptions + { + + } + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf/UI/Exceptions/ExceptionDialog.xaml Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,89 @@ +<Window x:Class="MetroWpf.UI.Exceptions.ExceptionDialog" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" + xmlns:Behaviours="clr-namespace:MahApps.Metro.Behaviours;assembly=MahApps.Metro" + MouseLeftButtonDown="DragMoveWindow" + SnapsToDevicePixels="True" + WindowStartupLocation="CenterOwner" Width="571" Height="374" ResizeMode="NoResize"> + <i:Interaction.Behaviors> + <Behaviours:BorderlessWindowBehavior ResizeWithGrip="False" /> + </i:Interaction.Behaviors> + + <Window.Resources> + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" /> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" /> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" /> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" /> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedSingleRowTabControl.xaml" /> + <ResourceDictionary Source="pack://application:,,,/MetroWpf;component/Xaml/Styles/MetroWpf.Accents.xaml" /> + </ResourceDictionary.MergedDictionaries> + </ResourceDictionary> + </Window.Resources> + + <Window.Background> + <LinearGradientBrush MappingMode="Absolute" StartPoint="0,0" EndPoint="0,180"> + <GradientStop Color="#EEEEEE" /> + <GradientStop Color="White" Offset="1" /> + </LinearGradientBrush> + </Window.Background> + + <Grid Margin="10"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="*" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + <TextBlock + TextWrapping="Wrap" + VerticalAlignment="Top" + FontWeight="Heavy" + FontSize="30" + Text="Don't Panic." + /> + + <Button Style="{DynamicResource ChromelessButtonStyle}" Content="r" + HorizontalAlignment="Right" + VerticalAlignment="Top" + FontFamily="Marlett" + Click="TryClose"/> + + <TextBlock + Grid.Row="1" + TextWrapping="Wrap" + FontSize="12" + Text="Something has gone horribly wrong, but don't let that worry you." + /> + + <StackPanel Grid.Row="2" Margin="0,10,0,0"> + <TextBlock Text="Message" FontSize="18.667" FontWeight="Light" /> + <Border BorderThickness="1" BorderBrush="{DynamicResource GrayBrush9}" Padding="5"> + <TextBlock x:Name="messageBox" Text="Ima exception, weeee" /> + </Border> + </StackPanel> + + <Grid Grid.Row="3" Margin="0,10,0,0"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="*" /> + </Grid.RowDefinitions> + <TextBlock Text="Details" FontSize="18.667" FontWeight="Light" /> + <Border Grid.Row="1" BorderThickness="1" BorderBrush="{DynamicResource GrayBrush9}"> + <ScrollViewer VerticalScrollBarVisibility="Auto"> + <TextBlock x:Name="detailsBox" Text="Some long rambly text about the exception. Maybe a stack trace." /> + </ScrollViewer> + </Border> + </Grid> + + <StackPanel HorizontalAlignment="Right" Grid.Row="4" Height="25" Margin="10" Orientation="Horizontal"> + <Button Width="75" Click="CopyToClipboard" Content="Copy" Margin="0 0 5 0" /> + <Button Width="75" Click="TryClose" Content="Close" /> + </StackPanel> + + </Grid> +</Window>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf/UI/Exceptions/ExceptionDialog.xaml.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,93 @@ +using System; +using System.Diagnostics; +using System.Threading; +using System.Windows; +using System.Windows.Input; + +namespace MetroWpf.UI.Exceptions +{ + /// <summary> + /// Interaction logic for ExceptionDialog.xaml + /// </summary> + public partial class ExceptionDialog + { + private System.Exception exception; + private string details; + private string message; + + public ExceptionDialog() + { + InitializeComponent(); + } + + private void DragMoveWindow(object sender, MouseButtonEventArgs e) + { + if (e.RightButton != MouseButtonState.Pressed + && e.MiddleButton != MouseButtonState.Pressed) + DragMove(); + } + + public string Message + { + get { return message; } + set + { + message = value; + + messageBox.Text = value; + } + } + + public string Details + { + get { return details; } + set + { + details = value; + detailsBox.Text = value; + } + } + + public System.Exception Exception + { + get { return exception; } + set { exception = value; } + } + + private void TryClose(object sender, RoutedEventArgs e) + { + this.Close(); + } + + private void CopyToClipboard(object sender, RoutedEventArgs e) + { + SetData(DataFormats.Text, this.Details); + } + + // Implementation taken from the WinForms clipboard class. + // Seriously, the clipboard can fail, so it retries 10 times. + private void SetData(string format, object data) + { + if (!data.GetType().IsSerializable) + { + throw new NotSupportedException("An object being added to the clipboard must be serializable. Ensure that the entire object tree is serializable."); + } + + bool succeeded = false; + for (int i = 0; i < 10 && !succeeded; i++) + { + try + { + System.Windows.Clipboard.SetData(format, data); + succeeded = true; + } + catch (Exception e) + { + Trace.WriteLine(e, "ERROR"); + } + if (!succeeded) + Thread.Sleep(100); + } + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf/UI/Login/LoginView.xaml Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,132 @@ +<UserControl + x:Class="MetroWpf.UI.Login.LoginView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" + xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options" + xmlns:converters="clr-namespace:MetroWpf.Xaml.Converters;assembly=MetroWpf.Xaml" + xmlns:c="clr-namespace:MetroWpf.Xaml.Controls;assembly=MetroWpf.Xaml" + xmlns:controls="clr-namespace:Microsoft.Windows.Controls;assembly=MetroWpf.Xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + mc:Ignorable="d" + DataContext="{Binding LoginViewModel, Source={StaticResource Locator}}"> + + <Grid x:Name="VisualRoot" Height="500" Width="570"> + <Grid.InputBindings> + <KeyBinding Gesture="Enter" Command="{Binding LoginCommand}" /> + </Grid.InputBindings> + + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="10" /> + <RowDefinition Height="60" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="10" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="90" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + <Rectangle + x:Name="BrandBar" Grid.Row="1" + Fill="{DynamicResource BrandingBrush}" + HorizontalAlignment="Left" VerticalAlignment="Bottom" + Width="125" Height="6" IsHitTestVisible="False" /> + + <TextBlock Grid.Row="2" FontSize="24" FontFamily="{DynamicResource HeaderFontFamily}"><Run>WELCOME TO OUR METRO WORLD</Run></TextBlock> + + + <Grid Grid.Row="3"> + <Border Grid.RowSpan="4" + Grid.ColumnSpan="3" + BorderThickness="1" + BorderBrush="{DynamicResource PageBorderBrush}" + Background="{DynamicResource BackgroundGradient}" + Padding="3.5"> + + <Grid VerticalAlignment="Top"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*" /> + <ColumnDefinition Width="*" /> + <ColumnDefinition Width="85" /> + </Grid.ColumnDefinitions> + + <controls:WatermarkTextBox + Grid.Column="0" Grid.Row="0" + Watermark="USERNAME" + Text="{Binding UserId, Mode=TwoWay, ValidatesOnDataErrors=True}" + HorizontalAlignment="Left" VerticalAlignment="Center" + Width="220" MaxLength="50" Margin="3.5" /> + + + <PasswordBox + Grid.Column="0" Grid.Row="1" + c:PasswordBoxHelper.BoundPassword="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=Default, ValidatesOnDataErrors=True}" + HorizontalAlignment="Left" VerticalAlignment="Center" + Width="220" MaxLength="50" Margin="3.5" /> + + <Button x:Name="btnLogin" + Grid.Column="1" Grid.Row="1" + Margin="3.5" + Content="SIGN IN" + FontWeight="Bold" + FontSize="10" + HorizontalAlignment="Left" + VerticalAlignment="Center" + Command="{Binding LoginCommand}" + IsDefault="True" + Width="90"> + </Button> + + <CheckBox Grid.Column="0" Grid.Row="2" + Content="Remember my password" + Margin="3.5" VerticalAlignment="Center" + Opacity="0.6" /> + <CheckBox Grid.Column="0" Grid.Row="3" + Content="Remember me" + Margin="3.5" VerticalAlignment="Center" + Opacity="0.6" /> + <CheckBox Grid.Column="1" Grid.Row="2" + Content="Sign me in automatically" + Margin="3.5" VerticalAlignment="Center" + Opacity="0.6" /> + </Grid> + </Border> + </Grid> + + <Button Grid.Row="5" + FontWeight="Normal" FontSize="16" + Content="create new account" + HorizontalAlignment="Left" + VerticalAlignment="Bottom" + Style="{DynamicResource ChromelessButtonStyle}"> + </Button> + + <Button Grid.Row="6" + FontWeight="Normal" FontSize="16" + Content="forgot your password" + HorizontalAlignment="Left" + VerticalAlignment="Top" + Style="{DynamicResource ChromelessButtonStyle}"> + </Button> + + <Button Grid.Row="8" + Margin="3.5" + FontWeight="Bold" + Content="CANCEL" + Command="{Binding CloseCommand}" + HorizontalAlignment="Right" + VerticalAlignment="Center" + IsCancel="True" + Width="90"> + </Button> + </Grid> +</UserControl>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf/UI/Login/LoginView.xaml.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,13 @@ +namespace MetroWpf.UI.Login +{ + /// <summary> + /// Interaction logic for LoginView.xaml + /// </summary> + public partial class LoginView + { + public LoginView() + { + InitializeComponent(); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf/UI/Login/LoginViewModel.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,120 @@ +using GalaSoft.MvvmLight; +using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Messaging; +using MetroWpf.Messages; + +namespace MetroWpf.UI.Login +{ + /// <summary> + /// Login view view model class + /// </summary> + public sealed class LoginViewModel : + ViewModelBase + { + #region · Data Properties · + + /// <summary> + /// Gets or sets whether the form is busy + /// </summary> + private bool isBusy; + public bool IsBusy + { + get { return isBusy; } + set + { + if (this.isBusy != value) + { + this.isBusy = value; + RaisePropertyChanged("IsBusy"); + //relay requery? + } + } + } + + /// <summary> + /// Gets or sets the user name + /// </summary> + private string userId; + public string UserId + { + get { return this.userId; } + set + { + if (this.userId != value) + { + this.userId = value; + RaisePropertyChanged("UserId"); + LoginCommand.RaiseCanExecuteChanged(); + } + } + } + + /// <summary> + /// Gets or sets the password + /// </summary> + private string password; + public string Password + { + get { return this.password; } + set + { + if (this.password != value) + { + this.password = value; + RaisePropertyChanged("Password"); + LoginCommand.RaiseCanExecuteChanged(); + } + } + } + + #endregion + + #region · Constructors · + + /// <summary> + /// Initializes a new instance of the <see cref="LoginViewModel"/> class + /// </summary> + public LoginViewModel() + : base() + { + LoginCommand = new RelayCommand(LoginCommandExecute, CanLoginCommandExecute); + CloseCommand = new RelayCommand(CloseCommandExecute); + } + + #endregion + + #region · Command Actions · + + #region LoginCommand + + public RelayCommand LoginCommand { get; set; } + + private void LoginCommandExecute() + { + //successful login! + + Messenger.Default.Send(new UserAuthenticatedMessage() { UserId = userId }); + } + + private bool CanLoginCommandExecute() + { + if (string.IsNullOrEmpty(UserId) || + string.IsNullOrEmpty(Password)) + return false; + + return true; + } + + #endregion + + #region CloseCommand + public RelayCommand CloseCommand { get; set; } + + private void CloseCommandExecute() + { + } + #endregion + + #endregion + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf/UI/Login/UserLogin.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,47 @@ +using System.Collections.Generic; +using System.ComponentModel; +using GalaSoft.MvvmLight; + +namespace MetroWpf.UI.Login +{ + public sealed class UserLogin : + ObservableObject, + IDataErrorInfo + { + #region · Fields · + + private Dictionary<string, string> _errors + = new Dictionary<string, string>(); + + #endregion + + #region · IDataErrorInfo Members · + + public string Error + { + get { return null; } + } + + public string this[string columnName] + { + get { return null; } + } + + #endregion + + #region · Properties · + + public string UserId { get; set; } + public string Password { get; set; } + + #endregion + + #region · Constructors · + + public UserLogin() + { + } + + #endregion + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf/UI/Screen.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,14 @@ + +namespace MetroWpf.Presentation +{ + public enum Screen + { + Stocks, + FxRates, + Login, + UserProfile, + Settings, + About, + Help + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf/UI/Settings/SettingsView.xaml Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,27 @@ +<UserControl x:Class="MetroWpf.UI.Settings.SettingsView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:s="clr-namespace:MetroWpf.Styles" + xmlns:System="clr-namespace:System;assembly=mscorlib" + mc:Ignorable="d" + d:DesignHeight="50" d:DesignWidth="350" + DataContext="{Binding SettingsViewModel, Source={StaticResource Locator}}"> + <UserControl.Resources> + <ObjectDataProvider x:Key="ApplicationStyleEnum" + MethodName="GetValues" + ObjectType="{x:Type System:Enum}"> + <ObjectDataProvider.MethodParameters> + <x:Type TypeName="s:ApplicationStyle"/> + </ObjectDataProvider.MethodParameters> + </ObjectDataProvider> + </UserControl.Resources> + <Grid> + <StackPanel Orientation="Horizontal" VerticalAlignment="Top"> + <Label Width="50">Style:</Label> + <ComboBox Width="300" + ItemsSource="{Binding Source={StaticResource ApplicationStyleEnum}}" + SelectedItem="{Binding Path=SelectedApplicationStyle, Mode=TwoWay}"/> + </StackPanel> + </Grid> +</UserControl>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf/UI/Settings/SettingsView.xaml.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,15 @@ +using System.Windows.Controls; + +namespace MetroWpf.UI.Settings +{ + /// <summary> + /// Interaction logic for SettingsView.xaml + /// </summary> + public partial class SettingsView : UserControl + { + public SettingsView() + { + InitializeComponent(); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf/UI/Settings/SettingsViewModel.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,31 @@ +using GalaSoft.MvvmLight; +using GalaSoft.MvvmLight.Messaging; +using MetroWpf.Messages; +using MetroWpf.Styles; + +namespace MetroWpf.UI.Settings +{ + public class SettingsViewModel : ViewModelBase + { + ApplicationStyle _selectedApplicationStyle; + + public SettingsViewModel() + { + _selectedApplicationStyle = ApplicationStyle.BlueLight; + } + + public ApplicationStyle SelectedApplicationStyle + { + get { return _selectedApplicationStyle; } + set + { + _selectedApplicationStyle = value; + RaisePropertyChanged("SelectedApplicationStyle"); + + Messenger.Default.Send( + new ApplicationStyleChangeMessage() + { ApplicationStyle = _selectedApplicationStyle }); + } + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf/UI/Shell/ShellView.xaml Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,123 @@ +<Controls:MetroWindow x:Class="MetroWpf.UI.Shell.ShellView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" + xmlns:converters="clr-namespace:MetroWpf.Xaml.Converters;assembly=MetroWpf.Xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:presentation="clr-namespace:MetroWpf.Presentation" + xmlns:transitions="clr-namespace:MetroWpf.Xaml.Transitions;assembly=MetroWpf.Xaml" + Title="Metro WPF Demo" + Width="660" + Height="490" + DataContext="{Binding ShellViewModel, + Source={StaticResource Locator}}" + Icon="../logo.ico" + ShowIconOnTitleBar="true" + ShowTitleBar="true" + WindowState="Maximized" + mc:Ignorable="d"> + + <Window.Resources> + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" /> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" /> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" /> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedSingleRowTabControl.xaml" /> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Icons/MergedResources.xaml" /> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" /> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" /> + <ResourceDictionary Source="pack://application:,,,/MetroWpf.Xaml;component/Styles/Controls.WatermarkTextBox.xaml" /> + </ResourceDictionary.MergedDictionaries> + </ResourceDictionary> + </Window.Resources> + + <Controls:MetroContentControl> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="30" /> + <RowDefinition Height="50" /> + <RowDefinition Height="*" /> + </Grid.RowDefinitions> + + <Grid.ColumnDefinitions> + <ColumnDefinition Width="300" /> + <ColumnDefinition Width="*" /> + </Grid.ColumnDefinitions> + + <Grid.Resources> + <transitions:FadeTransition x:Key="Fade" Duration="0:0:0.5" /> + </Grid.Resources> + + <StackPanel x:Name="ApplicationMenu" + Grid.Row="1" + Grid.Column="0" + Margin="20,0,0,0" + Orientation="Horizontal" + Visibility="{Binding ShowMenuButtons, + Converter={converters:BooleanToVisibilityConverter}}"> + + <Button Width="100" + Command="{Binding Path=MenuCommand}" + CommandParameter="{x:Static presentation:Screen.Stocks}" + Content="Stocks" + FontSize="32" + Style="{DynamicResource ChromelessButtonStyle}" /> + + <Button Width="100" + Command="{Binding Path=MenuCommand}" + CommandParameter="{x:Static presentation:Screen.FxRates}" + Content="Rates" + FontSize="32" + Style="{DynamicResource ChromelessButtonStyle}" /> + </StackPanel> + + <StackPanel x:Name="TopRightOptions" + Grid.Column="2" + Margin="0,4,0,0" + HorizontalAlignment="Right" + VerticalAlignment="Top" + Orientation="Horizontal" + Visibility="{Binding ShowMenuButtons, + Converter={converters:BooleanToVisibilityConverter}}"> + <Button x:Name="UserLogOnInfo" + Margin="15,0,0,0" + Command="{Binding Path=MenuCommand}" + CommandParameter="{x:Static presentation:Screen.UserProfile}" + Content="stevenh" + FontSize="10.667" + Style="{DynamicResource ChromelessButtonStyle}" /> + <Button x:Name="ShowSettings" + Margin="15,0,0,0" + Command="{Binding Path=MenuCommand}" + CommandParameter="{x:Static presentation:Screen.Settings}" + Content="settings" + FontSize="10.667" + Style="{DynamicResource ChromelessButtonStyle}" /> + <Button x:Name="ShowAbout" + Margin="15,0,0,0" + Command="{Binding Path=MenuCommand}" + CommandParameter="{x:Static presentation:Screen.About}" + Content="about" + FontSize="10.667" + Style="{DynamicResource ChromelessButtonStyle}" /> + <Button x:Name="ShowHelp" + Margin="15,0,20,0" + Command="{Binding Path=MenuCommand}" + CommandParameter="{x:Static presentation:Screen.Help}" + Content="help" + FontSize="10.667" + Style="{DynamicResource ChromelessButtonStyle}" /> + </StackPanel> + + + <transitions:TransitionPresenter x:Name="MainContentControl" + Grid.Row="2" + Grid.ColumnSpan="2" + HorizontalAlignment="Center" + Content="{Binding DisplayScreen}" + Transition="{StaticResource Fade}" /> + </Grid> + </Controls:MetroContentControl> +</Controls:MetroWindow>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf/UI/Shell/ShellView.xaml.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,52 @@ +using GalaSoft.MvvmLight.Messaging; +using MetroWpf.Messages; +using MetroWpf.Styles; +using MahApps.Metro; +using System.Linq; + +namespace MetroWpf.UI.Shell +{ + public partial class ShellView + { + public ShellView() + { + //DataContext = new MainWindowViewModel(Dispatcher); + InitializeComponent(); + + // setup notifications + Messenger.Default.Register<ApplicationStyleChangeMessage>( + this, message => ChangeTheme(message.ApplicationStyle)); + } + + private void ChangeTheme(ApplicationStyle applicationStyle) + { + switch (applicationStyle) + { + case ApplicationStyle.BlueLight: + ThemeManager.ChangeTheme(this, ThemeManager.DefaultAccents.First(a => a.Name == "Blue"), Theme.Light); + break; + case ApplicationStyle.BlueDark: + ThemeManager.ChangeTheme(this, ThemeManager.DefaultAccents.First(a => a.Name == "Blue"), Theme.Dark); + break; + case ApplicationStyle.GreenLight: + ThemeManager.ChangeTheme(this, ThemeManager.DefaultAccents.First(a => a.Name == "Green"), Theme.Light); + break; + case ApplicationStyle.GreenDark: + ThemeManager.ChangeTheme(this, ThemeManager.DefaultAccents.First(a => a.Name == "Green"), Theme.Dark); + break; + case ApplicationStyle.RedLight: + ThemeManager.ChangeTheme(this, ThemeManager.DefaultAccents.First(a => a.Name == "Red"), Theme.Light); + break; + case ApplicationStyle.RedDark: + ThemeManager.ChangeTheme(this, ThemeManager.DefaultAccents.First(a => a.Name == "Red"), Theme.Dark); + break; + case ApplicationStyle.PurpleLight: + ThemeManager.ChangeTheme(this, ThemeManager.DefaultAccents.First(a => a.Name == "Purple"), Theme.Light); + break; + case ApplicationStyle.PurpleDark: + ThemeManager.ChangeTheme(this, ThemeManager.DefaultAccents.First(a => a.Name == "Purple"), Theme.Dark); + break; + } + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf/UI/Shell/ShellViewModel.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,106 @@ +using FxRates.UI.ViewModels; +using FxRates.UI.Views; +using GalaSoft.MvvmLight; +using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Messaging; +using MetroWpf.Messages; +using MetroWpf.Presentation; +using MetroWpf.UI.Login; +using MetroWpf.UI.Settings; +using Microsoft.Practices.ServiceLocation; +using Stocks.UI.ViewModels; +using Stocks.UI.Views; + +namespace MetroWpf.UI.Shell +{ + public class ShellViewModel : ViewModelBase + { + public RelayCommand<Screen> MenuCommand { get; set; } + + public ShellViewModel() + { + ShowMenuButtons = false; + MenuCommand = new RelayCommand<Screen>(MenuCommandExecute); + + Messenger.Default.Register<NavigationMessage>(this, NavigationMessageReceived); + Messenger.Default.Register<UserAuthenticatedMessage>(this, UserAuthenticated); + + Messenger.Default.Send(new NavigationMessage() { DisplayScreen = Screen.Login }); + } + + private void UserAuthenticated(UserAuthenticatedMessage message) + { + ShowMenuButtons = true; + Messenger.Default.Send(new NavigationMessage() { DisplayScreen = Screen.Stocks }); + } + + private object displayScreen; + public object DisplayScreen + { + get { return displayScreen; } + set + { + if (displayScreen == value) return; + displayScreen = value; + RaisePropertyChanged("DisplayScreen"); + } + } + + private bool _showMenuButtons; + public bool ShowMenuButtons + { + get { return _showMenuButtons; } + set + { + if (_showMenuButtons == value) return; + _showMenuButtons = value; + RaisePropertyChanged("ShowMenuButtons"); + } + } + + private void NavigationMessageReceived(NavigationMessage message) + { + switch (message.DisplayScreen) + { + case Screen.Login: + DisplayScreen = ServiceLocator.Current.GetInstance<LoginView>(); + break; + + case Screen.Stocks: + var stocksView = ServiceLocator.Current.GetInstance<StocksView>(); + stocksView.DataContext = ServiceLocator.Current.GetInstance<StocksViewModel>(); + DisplayScreen = stocksView; + break; + + case Screen.FxRates: + var fxRatesView = ServiceLocator.Current.GetInstance<FxRatesView>(); + fxRatesView.DataContext = ServiceLocator.Current.GetInstance<FxRatesViewModel>(); + DisplayScreen = fxRatesView; + break; + + case Screen.UserProfile: + break; + + case Screen.Settings: + DisplayScreen = ServiceLocator.Current.GetInstance<SettingsView>(); + break; + + case Screen.About: + break; + + case Screen.Help: + break; + } + + } + + private void MenuCommandExecute(Screen screen) + { + Messenger.Default.Send( + new NavigationMessage() + { + DisplayScreen = screen + }); + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf/UI/UserProfile/UserProfileView.xaml Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,11 @@ +<UserControl x:Class="MetroWpf.Presentation.UserProfile.UserProfileView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + mc:Ignorable="d" + DataContext="{Binding UserProfileViewModel, Source={StaticResource Locator}}"> + <Grid> + + </Grid> +</UserControl>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf/UI/UserProfile/UserProfileView.xaml.cs Tue Mar 20 20:18:35 2012 +0000 @@ -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 MetroWpf.Presentation.UserProfile +{ + /// <summary> + /// Interaction logic for UserProfileView.xaml + /// </summary> + public partial class UserProfileView : UserControl + { + public UserProfileView() + { + InitializeComponent(); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MetroWpf/MetroWpf/UI/UserProfile/UserProfileViewModel.cs Tue Mar 20 20:18:35 2012 +0000 @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace MetroWpf.Presentation.UserProfile +{ + public class UserProfileViewModel + { + } +}
--- a/MetroWpf/Stocks.Common/Exceptions/InvalidWebPriceData.cs Tue Mar 20 16:53:29 2012 +0000 +++ b/MetroWpf/Stocks.Common/Exceptions/InvalidWebPriceData.cs Tue Mar 20 20:18:35 2012 +0000 @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; namespace Stocks.Common.Exceptions
--- a/MetroWpf/Stocks.Common/Factory.cs Tue Mar 20 16:53:29 2012 +0000 +++ b/MetroWpf/Stocks.Common/Factory.cs Tue Mar 20 20:18:35 2012 +0000 @@ -1,5 +1,4 @@ -using NLog; -using Stocks.Common.Core; +using Stocks.Common.Core; using Stocks.Common.Models; using System; using Stocks.Common.Exceptions;
--- a/MetroWpf/Stocks.Common/Stocks.Common.csproj Tue Mar 20 16:53:29 2012 +0000 +++ b/MetroWpf/Stocks.Common/Stocks.Common.csproj Tue Mar 20 20:18:35 2012 +0000 @@ -34,16 +34,8 @@ <Reference Include="Newtonsoft.Json"> <HintPath>..\Libs\Newtonsoft.Json.4.0.8\lib\net40\Newtonsoft.Json.dll</HintPath> </Reference> - <Reference Include="NLog"> - <HintPath>..\Libs\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath> - </Reference> <Reference Include="System" /> <Reference Include="System.Core" /> - <Reference Include="System.Xml.Linq" /> - <Reference Include="System.Data.DataSetExtensions" /> - <Reference Include="Microsoft.CSharp" /> - <Reference Include="System.Data" /> - <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="ConfigurationService.cs" />
--- a/MetroWpf/Stocks.Service/Stocks.Service.csproj Tue Mar 20 16:53:29 2012 +0000 +++ b/MetroWpf/Stocks.Service/Stocks.Service.csproj Tue Mar 20 20:18:35 2012 +0000 @@ -36,11 +36,6 @@ </Reference> <Reference Include="System" /> <Reference Include="System.Core" /> - <Reference Include="System.Xml.Linq" /> - <Reference Include="System.Data.DataSetExtensions" /> - <Reference Include="Microsoft.CSharp" /> - <Reference Include="System.Data" /> - <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="AssemblyInit.cs" />