diff MetroWpf/MetroWpf.Framework/WpfApplication.cs @ 15:060f02cd4591

Initial commit, pre airport work
author stevenh7776 stevenhollidge@hotmail.com
date Mon, 12 Mar 2012 23:05:21 +0800
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MetroWpf/MetroWpf.Framework/WpfApplication.cs	Mon Mar 12 23:05:21 2012 +0800
@@ -0,0 +1,38 @@
+using System;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Input;
+using System.Windows.Threading;
+using MetroWpf.Framework.Interfaces;
+using System.Windows.Media.Imaging;
+
+namespace MetroWpf.Framework
+{
+  public class WpfApplication : IWpfApplication
+  {
+    private Dispatcher _dispatcher;
+    public TaskScheduler UiTaskScheduler { get; private set; }
+
+    public BitmapSource ApplicationIcon { get; private set; }
+    public string ApplicationTitle { get { return "Metro WPF"; } }
+
+    public void Initialize()
+    {
+      _dispatcher = Application.Current.Dispatcher;
+      UiTaskScheduler = TaskScheduler.FromCurrentSynchronizationContext();
+
+      ApplicationIcon = new BitmapImage(
+       new Uri("../Presentation/logo.ico", UriKind.Relative));
+    }
+
+    public void Invoke(Action action)
+    {
+      _dispatcher.Invoke(action);
+    }
+
+    public void RefreshCommands()
+    {
+      CommandManager.InvalidateRequerySuggested();
+    }
+  }
+}