internal IMessageBoxService GetActualService() { IMessageBoxService res = MessageBoxService; if (res != null) { return(res); } ISupportServices viewModel = AssociatedObject.With(x => x as FrameworkElement). Return(x => x.DataContext, null) as ISupportServices; if (viewModel != null) { res = viewModel.ServiceContainer.GetService <IMessageBoxService>(); } if (res != null) { return(res); } #if !SILVERLIGHT res = new MessageBoxService(); #else res = new MessageBoxService(); #endif return(res); }
public ModuleMenu(string _type, object parent, string _title, Action <ModuleMenu> func = null) { Type = _type; this.parent = (ISupportServices)parent; parentVm = (MainWindowViewModel)parent; Title = _title; if (func != null) { Command = new DelegateCommand <ModuleMenu>(func); } }
void RegisterServices(IMainModule mainModule) { var mainModuleType = mainModule.GetType(); ISupportServices localServices = (ISupportServices)this; localServices.ServiceContainer.RegisterService(new Services.WaitingService()); localServices.ServiceContainer.RegisterService(new Services.ModuleActivator(mainModuleType.Assembly, mainModuleType.Namespace + ".Modules")); localServices.ServiceContainer.RegisterService(new Services.ReportActivator()); localServices.ServiceContainer.RegisterService(new Services.ModuleLocator(localServices.ServiceContainer)); localServices.ServiceContainer.RegisterService(new Services.ReportLocator(localServices.ServiceContainer)); localServices.ServiceContainer.RegisterService(new Services.TransitionService(mainModule)); localServices.ServiceContainer.RegisterService(new Services.PeekModulesHostingService(mainModule)); localServices.ServiceContainer.RegisterService(new Services.WorkspaceService(mainModule)); }
void CheckServicesImplementation(ISupportServices services) { var parent = CustomSupportServicesImplementation.Create(); ((ISupportParentViewModel)services).ParentViewModel = parent; var service1 = new Service1(); services.ServiceContainer.RegisterService(service1); var service2 = new Service2(); ((ISupportServices)parent).ServiceContainer.RegisterService(service2); Assert.Same(service1, services.GetService <IService1>()); Assert.Same(service1, services.ServiceContainer.GetService <IService1>()); Assert.Same(service2, services.GetService <IService2>()); Assert.Same(service2, services.ServiceContainer.GetService <IService2>()); }
public ModuleInfo(string _type, object parent, string _title) { Type = _type; this.parent = (ISupportServices)parent; Title = _title; }
void OnServicesClientInternalChanged(ISupportServices oldServiceClient, ISupportServices newServiceClient) { oldServiceClient.Do(x => x.ServiceContainer.UnregisterService(this)); newServiceClient.Do(x => x.ServiceContainer.RegisterService(Name, this, YieldToParent)); }