view MetroWpf/MetroWpf.Framework/WpfApplication.cs @ 16:2395908fa45b

Getting there... 1.20am at BKK airport. MainWindow and Menu now have VMs, Login form is displayed first
author stevenh7776 stevenhollidge@hotmail.com
date Wed, 14 Mar 2012 01:23:18 +0700
parents 060f02cd4591
children
line wrap: on
line source

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();
    }
  }
}