Demo entry 6732813

Android

   

Submitted by anonymous on Apr 15, 2018 at 15:00
Language: C#. Code size: 908 Bytes.

using GalaSoft.MvvmLight.Ioc;
using Microsoft.Practices.ServiceLocation;
namespace Catcher.MVVMDemo.Day01Core.ViewModel
{
    public class ViewModelLocator
    {
        public ViewModelLocator()
        {
            //provider
            ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
            //view model 
            SimpleIoc.Default.Register<MainViewModel>();
            SimpleIoc.Default.Register<LoginViewModel>();
        }
        public MainViewModel Main
        {
            get
            {
                return ServiceLocator.Current.GetInstance<MainViewModel>();
            }
        }
        public LoginViewModel LoginViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<LoginViewModel>();
            }
        }
        public static void Cleanup()
        {
        }
    }
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).