예제 #1
0
        public void LoadService(RolodexService rolodexService, string regionName, object parameter)
        {
            if (string.IsNullOrEmpty(regionName))
            {
                regionName = Constants.MainRegion;
            }
            ServiceDefinition serviceDefinition = _services[rolodexService];

            if (!regionManager.ActivateViewIfExists(regionName, serviceDefinition.ViewInterfaceType))
            {
                regionManager.DeactivateViews(regionName);
                var viewModel = (IRolodexViewModel)unityContainer.Resolve(serviceDefinition.ViewModelInterfaceType, null);
                var view      = (IRolodexView)unityContainer.Resolve(serviceDefinition.ViewInterfaceType, null);
                regionManager.AddViewToRegion(regionName, view);
                view.DataContext = viewModel;
                regionManager.ActivateViewIfExists(regionName, serviceDefinition.ViewInterfaceType);
                if (parameter == null)
                {
                    viewModel.Initialize();
                }
                else
                {
                    viewModel.Initialize(parameter);
                }
            }
        }
예제 #2
0
 public void LoadService(RolodexService rolodexService, string regionName)
 {
     LoadService(rolodexService, regionName, null);
 }
예제 #3
0
 public void LoadService(RolodexService rolodexService)
 {
     LoadService(rolodexService, Constants.MainRegion, null);
 }
예제 #4
0
 public void LoadService(RolodexService rolodexService, object parameter)
 {
     LoadService(rolodexService, Constants.MainRegion, parameter);
 }
예제 #5
0
 public ServiceEventArgs(RolodexService service, object parameter)
 {
     Service   = service;
     Parameter = parameter;
 }
예제 #6
0
 public void RegisterService <TViewInterface, TView, TViewModelInterface, TViewModel>(RolodexService rolodexService)
     where TViewInterface : IRolodexView
     where TView : TViewInterface
     where TViewModelInterface : IRolodexViewModel
     where TViewModel : TViewModelInterface
 {
     _services.Add(rolodexService, new ServiceDefinition(
                       typeof(TViewInterface), typeof(TView), typeof(TViewModelInterface), typeof(TViewModel)));
     unityContainer.RegisterType(typeof(TViewInterface), typeof(TView));
     unityContainer.RegisterType(typeof(TViewModelInterface), typeof(TViewModel));
 }
예제 #7
0
 public ServiceEventArgs(RolodexService service)
 {
     Service = service;
 }
예제 #8
0
 public ServiceEventArgs(RolodexService service, string regionName, object parameter)
 {
     Service    = service;
     Parameter  = parameter;
     RegionName = regionName;
 }
예제 #9
0
 public ServiceEventArgs(RolodexService service, object parameter)
 {
     Service = service;
     Parameter = parameter;
 }
예제 #10
0
 public ServiceEventArgs(RolodexService service)
 {
     Service = service;
 }
예제 #11
0
 public ServiceEventArgs(RolodexService service, string regionName, object parameter)
 {
     Service = service;
     Parameter = parameter;
     RegionName = regionName;
 }