/// <summary> /// Initializes a new instance of the <see cref="ServiceViewModel"/> /// class. /// </summary> /// <param name="service">The <see cref="IDIPS"/> service /// instance to provide presentation logic for.</param> /// <exception cref="ArgumentNullException">service is /// null.</exception> public ServiceViewModel(IDIPS service) { if (service == null) { throw new ArgumentNullException("service"); } _service = service; }
/// <summary> /// Registers the provided service to the DIPS port. /// </summary> /// <param name="service">The <see cref="IDIPS"/> to register /// to a particular port.</param> public static void Register(IDIPS service) { TcpChannel channel = new TcpChannel(Port); channel.StartListening(null); ChannelServices.RegisterChannel(channel, true); WellKnownServiceTypeEntry obj = new WellKnownServiceTypeEntry( typeof(IDIPS), "DIPS/Service", WellKnownObjectMode.Singleton); RemotingConfiguration.RegisterWellKnownServiceType(obj); }
/// <summary> /// Occurs when the application has started. /// </summary> /// <param name="e">Event information.</param> protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); ValidateConnection.validateConnection(); // Create the window and provide it with the presentation layer. IDIPS service = ServiceHelper.CreateLocalService(); IProcessingService s = service.Processor; IUnityContainer c = GlobalContainer.Instance.Container; c.RegisterInstance <IDIPS>(service); c.RegisterInstance <IProcessingService>(s); c.RegisterInstance <IPipelineManager>(s.PipelineManager); FilterTreeView ftv = new FilterTreeView(); QueueDialog qd = new QueueDialog(); UIContext context = new UIContext(); HandlerFactory f = new HandlerFactory(); f.Load(Assembly.GetAssembly(typeof(HandlerFactory))); c.RegisterInstance <IHandlerFactory>(f); c.RegisterInstance <IUIContext>(context); c.RegisterInstance <IFilterTreeView>(ftv); c.RegisterInstance <IQueueDialog>(qd); MainNavi navWindow = new MainNavi(); try { navWindow.ShowDialog(); } catch (Exception) { throw; } }