comparison 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
comparison
equal deleted inserted replaced
14:741981715d94 15:060f02cd4591
1 using System;
2 using System.Threading.Tasks;
3 using System.Windows;
4 using System.Windows.Input;
5 using System.Windows.Threading;
6 using MetroWpf.Framework.Interfaces;
7 using System.Windows.Media.Imaging;
8
9 namespace MetroWpf.Framework
10 {
11 public class WpfApplication : IWpfApplication
12 {
13 private Dispatcher _dispatcher;
14 public TaskScheduler UiTaskScheduler { get; private set; }
15
16 public BitmapSource ApplicationIcon { get; private set; }
17 public string ApplicationTitle { get { return "Metro WPF"; } }
18
19 public void Initialize()
20 {
21 _dispatcher = Application.Current.Dispatcher;
22 UiTaskScheduler = TaskScheduler.FromCurrentSynchronizationContext();
23
24 ApplicationIcon = new BitmapImage(
25 new Uri("../Presentation/logo.ico", UriKind.Relative));
26 }
27
28 public void Invoke(Action action)
29 {
30 _dispatcher.Invoke(action);
31 }
32
33 public void RefreshCommands()
34 {
35 CommandManager.InvalidateRequerySuggested();
36 }
37 }
38 }