# HG changeset patch
# User stevenh7776 stevenhollidge@hotmail.com
# Date 1331663037 -25200
# Node ID 7721a12703638e729c84fb525e31d700d550be98
# Parent 2395908fa45be0f34b78393d4b0c294e6314f02a
New files added during dev
diff -r 2395908fa45b -r 7721a1270363 MetroWpf/Libs/System.Windows.Interactivity/System.Windows.Interactivity.dll
Binary file MetroWpf/Libs/System.Windows.Interactivity/System.Windows.Interactivity.dll has changed
diff -r 2395908fa45b -r 7721a1270363 MetroWpf/MetroWpf.Xaml/Converters/EnumToIntConverter.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MetroWpf/MetroWpf.Xaml/Converters/EnumToIntConverter.cs Wed Mar 14 01:23:57 2012 +0700
@@ -0,0 +1,34 @@
+using System;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace MetroWpf.Xaml.Converters
+{
+ public class EnumToIntConverter : MarkupExtension, IValueConverter
+ {
+ private static EnumToIntConverter _enumToIntConverter = null;
+
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ if (null == _enumToIntConverter)
+ _enumToIntConverter = new EnumToIntConverter();
+
+ return _enumToIntConverter;
+ }
+
+ #region IValueConverter Members
+
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ return (int) value;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+
+ #endregion
+ }
+}
diff -r 2395908fa45b -r 7721a1270363 MetroWpf/MetroWpf.Xaml/Events/WeakPropertyChangeNotifier.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MetroWpf/MetroWpf.Xaml/Events/WeakPropertyChangeNotifier.cs Wed Mar 14 01:23:57 2012 +0700
@@ -0,0 +1,111 @@
+using System;
+using System.ComponentModel;
+using System.Windows;
+using System.Windows.Data;
+
+namespace MetroWpf.Xaml.Events
+{
+ ///
+ /// http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/
+ ///
+ public sealed class WeakPropertyChangeNotifier
+ : DependencyObject, IDisposable
+ {
+ #region Member Variables
+ private readonly WeakReference _propertySource;
+ #endregion // Member Variables
+
+ #region Constructor
+ public WeakPropertyChangeNotifier(DependencyObject propertySource, string path)
+ : this(propertySource, new PropertyPath(path))
+ {
+ }
+ public WeakPropertyChangeNotifier(DependencyObject propertySource, DependencyProperty property)
+ : this(propertySource, new PropertyPath(property))
+ {
+ }
+ public WeakPropertyChangeNotifier(DependencyObject propertySource, PropertyPath property)
+ {
+ if (null == propertySource)
+ throw new ArgumentNullException("propertySource");
+ if (null == property)
+ throw new ArgumentNullException("property");
+
+ this._propertySource = new WeakReference(propertySource);
+
+ var binding = new System.Windows.Data.Binding();
+ binding.Path = property;
+ binding.Mode = BindingMode.OneWay;
+ binding.Source = propertySource;
+ BindingOperations.SetBinding(this, ValueProperty, binding);
+ }
+ #endregion // Constructor
+
+ #region PropertySource
+ public DependencyObject PropertySource
+ {
+ get
+ {
+ try
+ {
+ // note, it is possible that accessing the target property
+ // will result in an exception so i’ve wrapped this check
+ // in a try catch
+ return this._propertySource.IsAlive
+ ? this._propertySource.Target as DependencyObject
+ : null;
+ }
+ catch
+ {
+ return null;
+ }
+ }
+ }
+ #endregion // PropertySource
+
+ #region Value
+ ///
+ /// Identifies the dependency property
+ ///
+ public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value",
+ typeof(object), typeof(WeakPropertyChangeNotifier), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(OnPropertyChanged)));
+
+ private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ WeakPropertyChangeNotifier notifier = (WeakPropertyChangeNotifier)d;
+ if (null != notifier.ValueChanged)
+ notifier.ValueChanged(notifier, EventArgs.Empty);
+ }
+
+ ///
+ /// Returns/sets the value of the property
+ ///
+ ///
+ [Description("Returns/sets the value of the property")]
+ [Category("Behavior")]
+ [Bindable(true)]
+ public object Value
+ {
+ get
+ {
+ return (object)this.GetValue(ValueProperty);
+ }
+ set
+ {
+ this.SetValue(ValueProperty, value);
+ }
+ }
+ #endregion //Value
+
+ #region Events
+ public event EventHandler ValueChanged;
+ #endregion // Events
+
+ #region IDisposable Members
+ public void Dispose()
+ {
+ BindingOperations.ClearBinding(this, ValueProperty);
+ }
+ #endregion
+ }
+}
diff -r 2395908fa45b -r 7721a1270363 MetroWpf/MetroWpf/Messages/NavigationMessage.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MetroWpf/MetroWpf/Messages/NavigationMessage.cs Wed Mar 14 01:23:57 2012 +0700
@@ -0,0 +1,10 @@
+using GalaSoft.MvvmLight.Messaging;
+using MetroWpf.Presentation;
+
+namespace MetroWpf.Messages
+{
+ public class NavigationMessage : MessageBase
+ {
+ public Screen DisplayScreen { get; set; }
+ }
+}
\ No newline at end of file
diff -r 2395908fa45b -r 7721a1270363 MetroWpf/MetroWpf/Presentation/Login/LoginView.xaml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MetroWpf/MetroWpf/Presentation/Login/LoginView.xaml Wed Mar 14 01:23:57 2012 +0700
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r 2395908fa45b -r 7721a1270363 MetroWpf/MetroWpf/Presentation/Login/LoginView.xaml.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MetroWpf/MetroWpf/Presentation/Login/LoginView.xaml.cs Wed Mar 14 01:23:57 2012 +0700
@@ -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.Login
+{
+ ///
+ /// Interaction logic for LoginView.xaml
+ ///
+ public partial class LoginView : UserControl
+ {
+ public LoginView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff -r 2395908fa45b -r 7721a1270363 MetroWpf/MetroWpf/Presentation/Menu/MenuView.xaml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MetroWpf/MetroWpf/Presentation/Menu/MenuView.xaml Wed Mar 14 01:23:57 2012 +0700
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff -r 2395908fa45b -r 7721a1270363 MetroWpf/MetroWpf/Presentation/Menu/MenuView.xaml.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MetroWpf/MetroWpf/Presentation/Menu/MenuView.xaml.cs Wed Mar 14 01:23:57 2012 +0700
@@ -0,0 +1,17 @@
+using System.Windows.Controls;
+using GalaSoft.MvvmLight.Messaging;
+using MetroWpf.Messages;
+
+namespace MetroWpf.Presentation.Menu
+{
+ ///
+ /// Interaction logic for TabMenu.xaml
+ ///
+ public partial class MenuView : UserControl
+ {
+ public MenuView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff -r 2395908fa45b -r 7721a1270363 MetroWpf/MetroWpf/Presentation/Menu/MenuViewModel.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MetroWpf/MetroWpf/Presentation/Menu/MenuViewModel.cs Wed Mar 14 01:23:57 2012 +0700
@@ -0,0 +1,185 @@
+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(
+ this,
+ message => ChangeDisplayScreen(message.DisplayScreen));
+
+ ChangeDisplayScreen(Screen.Login);
+ }
+
+ private void ChangeDisplayScreen(Screen screen)
+ {
+ switch (screen)
+ {
+ case Screen.Login:
+ ShowStocks = false;
+ ShowFxRates = false;
+ ShowLogin = true;
+ ShowUserProfile = false;
+ ShowSettings = false;
+ ShowAbout = false;
+ ShowHelp = false;
+ break;
+ case Screen.UserProfile:
+ ShowLogin = false;
+ ShowUserProfile = true;
+ ShowSettings = false;
+ ShowAbout = false;
+ ShowHelp = false;
+ break;
+ case Screen.Settings:
+ ShowLogin = false;
+ ShowUserProfile = false;
+ ShowSettings = true;
+ ShowAbout = false;
+ ShowHelp = false;
+ break;
+ case Screen.About:
+ ShowLogin = false;
+ ShowUserProfile = false;
+ ShowSettings = false;
+ ShowAbout = true;
+ ShowHelp = false;
+ break;
+ case Screen.Help:
+ ShowLogin = false;
+ ShowUserProfile = false;
+ ShowSettings = false;
+ ShowAbout = false;
+ ShowHelp = true;
+ break;
+ }
+
+ SelectedTabIndex = screen;
+ }
+ }
+}
diff -r 2395908fa45b -r 7721a1270363 MetroWpf/MetroWpf/Presentation/Screen.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MetroWpf/MetroWpf/Presentation/Screen.cs Wed Mar 14 01:23:57 2012 +0700
@@ -0,0 +1,14 @@
+
+namespace MetroWpf.Presentation
+{
+ public enum Screen
+ {
+ Stocks,
+ FxRates,
+ Login,
+ UserProfile,
+ Settings,
+ About,
+ Help
+ }
+}
diff -r 2395908fa45b -r 7721a1270363 MetroWpf/MetroWpf/Presentation/Settings/SettingsView.xaml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MetroWpf/MetroWpf/Presentation/Settings/SettingsView.xaml Wed Mar 14 01:23:57 2012 +0700
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r 2395908fa45b -r 7721a1270363 MetroWpf/MetroWpf/Presentation/Settings/SettingsView.xaml.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MetroWpf/MetroWpf/Presentation/Settings/SettingsView.xaml.cs Wed Mar 14 01:23:57 2012 +0700
@@ -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.Settings
+{
+ ///
+ /// Interaction logic for SettingsView.xaml
+ ///
+ public partial class SettingsView : UserControl
+ {
+ public SettingsView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff -r 2395908fa45b -r 7721a1270363 MetroWpf/MetroWpf/Presentation/Settings/SettingsViewModel.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MetroWpf/MetroWpf/Presentation/Settings/SettingsViewModel.cs Wed Mar 14 01:23:57 2012 +0700
@@ -0,0 +1,31 @@
+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 });
+ }
+ }
+ }
+}
diff -r 2395908fa45b -r 7721a1270363 MetroWpf/MetroWpf/Presentation/UserProfile/UserProfileView.xaml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MetroWpf/MetroWpf/Presentation/UserProfile/UserProfileView.xaml Wed Mar 14 01:23:57 2012 +0700
@@ -0,0 +1,11 @@
+
+
+
+
+
diff -r 2395908fa45b -r 7721a1270363 MetroWpf/MetroWpf/Presentation/UserProfile/UserProfileView.xaml.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MetroWpf/MetroWpf/Presentation/UserProfile/UserProfileView.xaml.cs Wed Mar 14 01:23:57 2012 +0700
@@ -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
+{
+ ///
+ /// Interaction logic for UserProfileView.xaml
+ ///
+ public partial class UserProfileView : UserControl
+ {
+ public UserProfileView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff -r 2395908fa45b -r 7721a1270363 MetroWpf/MetroWpf/Presentation/UserProfile/UserProfileViewModel.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MetroWpf/MetroWpf/Presentation/UserProfile/UserProfileViewModel.cs Wed Mar 14 01:23:57 2012 +0700
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace MetroWpf.Presentation.UserProfile
+{
+ public class UserProfileViewModel
+ {
+ }
+}
diff -r 2395908fa45b -r 7721a1270363 MetroWpf/MetroWpf/Services/Interfaces/INavigationService.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MetroWpf/MetroWpf/Services/Interfaces/INavigationService.cs Wed Mar 14 01:23:57 2012 +0700
@@ -0,0 +1,9 @@
+using MetroWpf.Presentation;
+
+namespace MetroWpf.Services.Interfaces
+{
+ public interface INavigationService
+ {
+ void NavigateTo(Screen displayScreen);
+ }
+}
diff -r 2395908fa45b -r 7721a1270363 MetroWpf/MetroWpf/Services/NavigationService.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MetroWpf/MetroWpf/Services/NavigationService.cs Wed Mar 14 01:23:57 2012 +0700
@@ -0,0 +1,21 @@
+using System;
+using System.Windows.Controls;
+using MetroWpf.Services.Interfaces;
+using MetroWpf.Presentation;
+using GalaSoft.MvvmLight.Messaging;
+using MetroWpf.Messages;
+
+namespace MetroWpf.Services
+{
+ public class NavigationService : INavigationService
+ {
+ public void NavigateTo(Screen displayScreen)
+ {
+ Messenger.Default.Send(
+ new NavigationMessage()
+ {
+ DisplayScreen = displayScreen
+ });
+ }
+ }
+}
\ No newline at end of file