// Copyright (C) 2013 Joćo Pedro Correia - All Rights Reserved
// Code under the terms of the GPLv2 license
// URL: http://flowstudio.codeplex.com

namespace FlowStudio.ViewModel
{
    using GalaSoft.MvvmLight.Ioc;
    using GalaSoft.MvvmLight.Messaging;
    using Microsoft.Practices.ServiceLocation;

    public class ViewModelLocator
    {
        /// <summary>
        /// Initializes a new instance of the ViewModelLocator class.
        /// </summary>
        public ViewModelLocator()
        {
            ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);

            var messenger = Messenger.Default;

            SimpleIoc.Default.Register(() => { return new MainWindowViewModel(messenger); });
            SimpleIoc.Default.Register(() => { return new OptionsViewModel(messenger); });
        }

        public MainWindowViewModel MainWindowViewModel
        {
            get { return ServiceLocator.Current.GetInstance<MainWindowViewModel>(); }
        }

        public OptionsViewModel OptionsViewModel
        {
            get { return ServiceLocator.Current.GetInstance<OptionsViewModel>(); }
        }
    }
}