public void TestInitialize() { _db = new TrackerDataContext(Settings.Default.MainConnectionString); _composition = new CompositionHelper(Settings.Default.MainConnectionString, Settings.Default.FilesConnectionString); _controller = _composition.Kernel.Get <AirWaybillController>(); }
/// <summary> /// Gets the object. /// </summary> /// <returns>IDomainObject.</returns> private IDomainObject GetObject() { CompositionHelper.ComposeParts(this, GetObjectFactoryType()); return(ObjectFactory == null ? null : ObjectFactory.GetById(ObjectId)); }
public void TestInitialize() { _context = new CompositionHelper(Settings.Default.MainConnectionString, Settings.Default.FilesConnectionString, RoleType.Forwarder); _context.Kernel.Bind <ApplicationListPresenter>().ToSelf(); _presenter = _context.Kernel.Get <ApplicationListPresenter>(); }
public void TestInitialize() { _fixture = new Fixture(); _composition = new CompositionHelper(Settings.Default.MainConnectionString, Settings.Default.FilesConnectionString); _manager = _composition.Kernel.Get <BillManager>(); _billRepository = _composition.Kernel.Get <IBillRepository>(); }
public void TestInitialize() { _db = new AlicargoDataContext(Settings.Default.MainConnectionString); _fixture = new Fixture(); _composition = new CompositionHelper(Settings.Default.MainConnectionString, Settings.Default.FilesConnectionString); _controller = _composition.Kernel.Get <AdminAwbController>(); }
public void TestInitialize() { var compositionHelper = new CompositionHelper( Settings.Default.MainConnectionString, Settings.Default.FilesConnectionString); _presenter = compositionHelper.Kernel.Get <AwbPresenter>(); }
public void TestInitialize() { _fixture = new Fixture(); _context = new CompositionHelper(Settings.Default.MainConnectionString, Settings.Default.FilesConnectionString, RoleType.Sender); _controller = _context.Kernel.Get <SenderApplicationController>(); }
private void InitializeCompositionModules() { var compositionInfo = CompositionHelper.GetCompositionInfo( PlatformProvider.Current.GetAbsolutePath(CompositionOptions.RelativePath), _discoveryAspect, _reuseCompositionInformation); Modules = compositionInfo.Modules; Errors = compositionInfo.Errors; }
public void TestInitialize() { _fixture = new Fixture(); _composition = new CompositionHelper(Settings.Default.MainConnectionString, Settings.Default.FilesConnectionString); _settings = _composition.Kernel.Get <ISettingRepository>(); _serializer = _composition.Kernel.Get <ISerializer>(); _controller = _composition.Kernel.Get <BillSettingsController>(); }
private void AddButtonClick(object sender, RoutedEventArgs e) { var helper = new CompositionHelper(); helper.Compose(); int i = int.Parse(TxtNumber1.Text); int i1 = int.Parse(TxtNumber2.Text); int number = helper.CalcPlugin.GetNumber(i,i1); TxtResult.Text = number.ToString(CultureInfo.InvariantCulture); }
public void Initialize() { Container = CompositionHelper.GetContainer(); CompositionHelper.ComposeContainerWithDefaults(Container); CompositionHelper.ComposeMessageServiceImplementation(Container, NSubstitute.Substitute.For <IMessageService>()); CompositionHelper.ComposeFileEnumeratorImplementation(Container, NSubstitute.Substitute.For <IFileEnumerator>()); CompositionHelper.ComposeImportImagesViewImplementation(Container, NSubstitute.Substitute.For <IImportImagesView>()); ApplicationController = Container.GetExportedValue <IApplicationController>(); }
public void TestInitialize() { _context = new CompositionHelper(Settings.Default.MainConnectionString, Settings.Default.FilesConnectionString); _fixture = new Fixture(); _manager = _context.Kernel.Get <IClientManager>(); _userRepository = _context.Kernel.Get <IUserRepository>(); _clientRepository = _context.Kernel.Get <IClientRepository>(); _transitRepository = _context.Kernel.Get <ITransitRepository>(); }
public void TestInitialize() { _fixture = new Fixture(); _context = new CompositionHelper(Settings.Default.MainConnectionString, Settings.Default.FilesConnectionString); _context.Kernel.Bind <ApplicationController>().ToSelf(); _controller = _context.Kernel.Get <ApplicationController>(); _clientRepository = _context.Kernel.Get <IClientRepository>(); _applicationRepository = _context.Kernel.Get <IApplicationRepository>(); }
private IXProcAddInSite _site; // connection to the host /// <summary> /// Initializes a new instance of the <see cref="AddInBase" /> class. /// </summary> /// <param name="site">The site.</param> protected AddInBase() { /* Create a window to host the add-in content. The OS allows a window from one process to be parented by a window from another. Essentially, native windows let us stitch UI between the two processes. (A WPF element tree is contained within an AppDomain and runs all on a single thread.) We have to run a message loop around this window and help with key forwarding and tabbing into&out. Keyboard input handling generally works better if MSGs straight off the Win32 message loop are "preprocessed", before passing them to DefWinowProc(). This helps with correct handling of various accelerators, in particular with some ActiveX controls (like the one WebBrowser wraps), and avoids occasional IME translation mishaps. WPF directly exposes its message loop via the ComponentDispatcher.ThreadPreprocessMessage event. When HwndSource owns a top-level window, it subscribes itself to ThreadPreprocessMessage and does all the correct routing internally (largely via its IKeyboardInputSink implementation). But we need a child window for the add-in. The trick is to first initialize the HwndSource as a top-level window, while keeping the window invisible, and then immediately convert it to a child one. Fortunately, the native window manager supports this well. */ string addinName = AppletName.Replace(".", ""); Logger.Info("Adding addin {0}", addinName); var hwsp = new HwndSourceParameters(addinName) {WindowStyle = 0}; HwndSource hwndSource = _hwndSource = new HwndSource(hwsp); Win32.ConvertToChildWindow(hwndSource.Handle); if (hwndSource.CompositionTarget != null) { hwndSource.CompositionTarget.BackgroundColor = Colors.Transparent; } hwndSource.SizeToContent = SizeToContent.Manual; // The host will do the sizing, via its HwndHost. CompositionHelper.ComposeParts(this, GetType()); if (AddinControl == null) { Logger.Error("No AddIn control could be found in the package"); } else { var control = AddinControl as Control; if (control != null) { Logger.Info("Adding control [{0}]", control.GetType().Name); hwndSource.RootVisual = control; // Enable tabbing out of the add-in. (It is possible to keep Tab cycle within but let only Ctrl+Tab // move the focus out.) KeyboardNavigation.SetTabNavigation(control, KeyboardNavigationMode.Continue); KeyboardNavigation.SetControlTabNavigation(control, KeyboardNavigationMode.Continue); } ((IKeyboardInputSink) hwndSource).KeyboardInputSite = this; // This message loop hook facilitates "bubbling" unhandled keys to the host. We critically rely // on HwndSource having already registered its hook so that this one is invoked last. ComponentDispatcher.ThreadPreprocessMessage += ThreadPreprocessMessage; } }
/// <summary> /// Gets the hook asynchronous. /// </summary> public void GetHookAsync() { if (TaxoFactory == null) { CompositionHelper.ComposeParts(this, GetTaxoFactoryType()); } if (TaxoFactory != null) { TaxoFactory .TaxoProxy .GetHookAsync(this, (h) => { Hook = h; }); } }
public void Initialize(IntPtr hwnd, Size size, int directCompositionVariant = -1) { if (this.IsInitialized) { this.Destroy(); } this.Hwnd = hwnd; this.Size = size; this.m_compVariant = directCompositionVariant != -1 ? directCompositionVariant : CompositionHelper.GetVariantForPlatform(); this.Create(); this.InitializeInternal(); }
public void Initialize() { Container = CompositionHelper.GetContainer(); CompositionHelper.ComposeContainerWithDefaults(Container); CompositionHelper.ComposeMessageServiceImplementation(Container, GetMessageService()); CompositionHelper.ComposeFileEnumeratorImplementation(Container, new FileEnumeratorHasMoreThanMaxNumberOfFiles()); CompositionHelper.ComposeImportImagesViewImplementation(Container, NSubstitute.Substitute.For <IImportImagesView>()); ApplicationController = Container.GetExportedValue <IApplicationController>(); ApplicationController.Initialize(); ApplicationController.Run(); TestDataHelper.MakeDriveValid(ApplicationController.CurrentSelectDriveViewModel.Model); TestNavigationHelper.NavigateFromSelectDriveToSelectPatient(ApplicationController); }
public void Test_List_ByForwarder() { using (var context = new CompositionHelper( Settings.Default.MainConnectionString, Settings.Default.FilesConnectionString, RoleType.Forwarder)) { var controller = context.Kernel.Get <ApplicationListController>(); var result = controller.List(5, 0, null); var data = (ApplicationListCollection)result.Data; data.Total.ShouldBeEquivalentTo(6); data.Data.Should().HaveCount(5); } }
public static Menu.Core.Menu CreateMenu(IEnumerable <IMenuCommand> coreCommands, IEnumerable <Lazy <IModuleContract> > modules) { var menuCompositionHelper = new CompositionHelper <IModuleCommand, IMenuGroupItemAttribute>(); menuCompositionHelper.AssembleModuleComponents(modules); var menu = new Menu.Core.Menu(); foreach (var coreCommand in coreCommands) { menu.Parse(coreCommand.GetType().GetAttributeValue((MenuGroupItemAttribute attribute) => attribute.Items), coreCommand); } foreach (var moduleCommand in menuCompositionHelper.Modules) { menu.Parse(moduleCommand.Metadata.Items, moduleCommand.Value); } menu.AddSeparators(); menu.ActivateParents(); return(menu); }
public MainWindowViewModel() { // create logger _logger = new Logger.Logger(); // load modules _logger.Info(this, "Load modules"); _compositionHelper = new CompositionHelper <IModuleContract>(); _compositionHelper.AssembleModuleComponents(); // core menu var coreMenu = new List <IMenuCommand> { new File(), new Help() }; // generate full menu (core + modules) MainMenuViewModel = new MainMenuViewModel(coreMenu, Modules); // generate a renderer RendererViewModel = new RendererViewModel(); }
public void TestInitialize() { _composition = new CompositionHelper(Settings.Default.MainConnectionString, Settings.Default.FilesConnectionString); _mock = new MockContainer(); _controller = _composition.Kernel.Get <ClientController>(); }
/// <summary> /// Composites to source 2. /// </summary> /// <param name="compositeOperation"></param> public void CompositeToSource2(IBinaryOperation compositeOperation, BlendState blendOverwrite, Vector2f minCoord, Vector2f maxCoord) { // 1) We first prepare the providers. List <IOperation> relavantOperations = CompositionHelper.RelavantOperations(compositeOperation); // 2) We extract processors. List <ICompositeInterface> processors = new List <ICompositeInterface>(relavantOperations.Count + 1); for (int i = 0; i < relavantOperations.Count; i++) { processors.Add(relavantOperations[i].PixelProcessor); } processors.Add(compositeOperation.PixelProcessor); // 3) We prepare the shader. ShaderCode pshader = PixelShader; ShaderCode vshader = VertexShader; States.BlendState bstate = blendOverwrite != null ? blendOverwrite : DefaultBlendState; States.DepthStencilState dstate = DefaultDepthStencilState; States.RasterizationState rstate = DefaultRasterizationState; FixedShaderParameters pparams = pshader.FixedParameters; FixedShaderParameters vparams = vshader.FixedParameters; ConstantBufferLayoutBuilder builder = new ConstantBufferLayoutBuilder(); List <TextureView> textures = new List <TextureView>(); List <States.SamplerState> samplers = new List <States.SamplerState>(); // We set interface array. pparams.SetInterfaceArray("Composite", processors); // 4) We fill parameters and builder. for (int i = 0; i < processors.Count; i++) { string name = string.Format("Composite[{0}]", i); InterfaceHelper.ApplyInterfaceConstants(name, processors[i], builder, pparams, textures, samplers, processors[i].ParameterValues); } // 5) We obtain layout big enough. ConstantBufferLayout layout = builder.CreateLayout(); pparams.AddLayout(0, layout); ConstantBufferView constantBuffer = ResourceProvider.Provide(layout.MinimumBufferSizeInBytes).CreateConstantBuffer(layout); // 6) We fill buffer. constantBuffer.Map(MapOptions.Write); try { for (int i = 0; i < processors.Count; i++) { InterfaceHelper.FillInterfaceConstants(string.Format("Composite[{i}]", i), processors[i], constantBuffer, processors[i].ParameterValues); } } finally { constantBuffer.UnMap(); } // 7) We prepare geometry. // We create quad geometry Geometry geometry = CreateQuadGeometry(minCoord, maxCoord); // ) We render the composition. GraphicsDevice device = Device; using (DeviceLock l = device.Lock()) { // We set our state objects. device.SetBlendState(bstate, Colour.White, 0xFFFFFFFF); device.SetDepthStencilState(dstate, 0); device.SetRasterizationState(rstate); // We prepare to render. device.SetVertexShader(vshader.Compile(device, vparams) as VShader, geometry, null, null, null); device.SetGeometryShader(null, null, null, null, null); device.SetPixelShader(pshader.Compile(device, pparams) as PShader, samplers.ToArray(), textures.ToArray(), new ConstantBufferView[] { constantBuffer }, new RenderTargetView[] { compositeOperation.Source2.DestinationView }, null); // We render it. if (geometry.IndexBuffer != null) { device.DrawIndexed(0, 6, 0); } else { device.Draw(0, 6); } } // We do not use constant buffer anymore. ResourceProvider.Unused(constantBuffer.TypelessResource as TypelessBuffer); }
protected virtual void LoadDynamicExecutors ( string dynamicLoadExecutorsPathsJsonFile = "dynamicLoadExecutorsPaths.json" ) { var executingDirectory = Path .GetDirectoryName ( Assembly .GetExecutingAssembly() .Location ); var executors = GetDynamicLoadExecutorsPathsProcess ( //dynamicLoadExecutorsPathsJsonFile ) .Select ( (x) => { var path = x; if (!path.IsNullOrEmptyOrWhiteSpace()) { if ( x.StartsWith(".") ) { path = path.TrimStart('.', '\\', '/'); } path = Path.Combine ( executingDirectory , path ); } return(path); } ) .Where ( (x) => { return ( !x .IsNullOrEmptyOrWhiteSpace() && Directory .Exists(x) ); } ) .SelectMany ( (x) => { var r = CompositionHelper .ImportManyExportsComposeParts <IStoreProcedureExecutable> (x); return(r); } ); var indexedExecutors = executors .Distinct ( new StoreProcedureComparer() ) .ToDictionary ( (x) => { return (x.DataBaseType); } , (x) => { IParametersDefinitionCacheAutoRefreshable rr = x as IParametersDefinitionCacheAutoRefreshable; if (rr != null) { rr .CachedParametersDefinitionExpiredInSeconds = CachedParametersDefinitionExpiredInSeconds; rr .NeedAutoRefreshExecutedTimeForSlideExpire = NeedAutoRefreshExecutedTimeForSlideExpire; } return(x); } , StringComparer .OrdinalIgnoreCase ); _locker .LockIf ( () => { var r = (_indexedExecutors == null); return(r); } , () => { _indexedExecutors = indexedExecutors; } ); }
private void StartServer() { const string LOG_TAG_PREFIX = "ApplicationServer::StartServer::"; AggregateException ex = null; this.ReinitTrustedCompositionCatalog(); // assemblies with services { var serviceDir = new DirectoryInfo(Path.Combine(this.WorkingDirectory, "services")).CreateDirectoryDeep(); this.LoadAndAddTrustedAssemblies(serviceDir.GetFiles("*.dll"), LOG_TAG_PREFIX); } // assemblies with functions { var funcDir = new DirectoryInfo(Path.Combine(this.WorkingDirectory, "funcs")).CreateDirectoryDeep(); this.LoadAndAddTrustedAssemblies(funcDir.GetFiles("*.dll"), LOG_TAG_PREFIX); } // web interface { IList <Assembly> webInterfaceAssemblies = new SynchronizedCollection <Assembly>(); var webDir = new DirectoryInfo(Path.Combine(this.WorkingDirectory, "web")).CreateDirectoryDeep(); this.LoadAndAddTrustedAssemblies(webDir.GetFiles("*.dll"), LOG_TAG_PREFIX); try { this.DisposeOldWebInterfaceServer(); //TODO read from configuration var newWebInterfaceServer = ServiceLocator.Current.GetInstance <IHttpServer>(); { // HTTPs ? { bool?useHttps; this.StartupConfig .TryGetValue <bool?>(category: CONFIG_CATEGORY_WEBINTERFACE, name: CONFIG_VALUE_USE_HTTPS, value: out useHttps, defaultVal: DEFAULT_CONFIG_VALUE_USE_HTTPS); newWebInterfaceServer.UseSecureHttp = useHttps ?? DEFAULT_CONFIG_VALUE_USE_HTTPS; } // TCP port { int?port; this.StartupConfig .TryGetValue <int?>(category: CONFIG_CATEGORY_WEBINTERFACE, name: CONFIG_VALUE_PORT, value: out port, defaultVal: DEFAULT_CONFIG_VALUE_WEBINTERFACE_PORT); newWebInterfaceServer.Port = port ?? DEFAULT_CONFIG_VALUE_WEBINTERFACE_PORT; } if (newWebInterfaceServer.UseSecureHttp) { // SSL thumbprint { newWebInterfaceServer.SetSslCertificateByThumbprint(this.StartupConfig .GetValue <IEnumerable <char> >(category: CONFIG_CATEGORY_WEBINTERFACE, name: CONFIG_VALUE_SSL_THUMBPRINT)); } } } var newHandler = new WebInterfaceHandler(this, newWebInterfaceServer); this._webHandler = newHandler; newHandler.Start(); } catch (Exception e) { this.Logger .Log(msg: e.GetBaseException() ?? e, tag: LOG_TAG_PREFIX + "WebInterface", categories: LoggerFacadeCategories.Errors); this.DisposeOldWebInterfaceServer(); } } var moduleList = this.Modules; if (moduleList != null) { ex = moduleList.OfType <global::System.IDisposable>() .ForAllAsync(ctx => { var m = ctx.Item; var doDispose = true; var dispObj = m as ITMDisposable; if (dispObj != null) { doDispose = !dispObj.IsDisposed; } if (doDispose) { m.Dispose(); } }, throwExceptions: false); } if (ex != null) { this.Logger .Log(msg: ex, tag: LOG_TAG_PREFIX + "UnloadOldModules", categories: LoggerFacadeCategories.Errors); } IList <IAppServerModule> newModules = new SynchronizedCollection <IAppServerModule>(); var modDir = new DirectoryInfo(Path.Combine(this.WorkingDirectory, "modules")).CreateDirectoryDeep(); { ex = modDir.GetFiles("*.dll") .ForAllAsync(ctx => { var f = ctx.Item; var trustedCatalog = ctx.State.CompositionCatalog.Clone(cloneCatalogData: true); var asmName = AssemblyName.GetAssemblyName(f.FullName); if (!trustedCatalog.IsTrustedAssembly(asmName)) { #if DEBUG var s = string.Format("INSERT INTO [Security].[TrustedAssemblies] (TrustedAssemblyKey, Name) VALUES (0x{0}, N'{1}');", asmName.GetPublicKey().AsHexString(), asmName.FullName); #endif ctx.State .Logger .Log(categories: LoggerFacadeCategories.Warnings, msg: string.Format("'{0}' is no trusted module!", f.FullName)); return; } var asmBlob = File.ReadAllBytes(f.FullName); var asm = Assembly.Load(asmBlob); trustedCatalog.AddAssembly(asm); CompositionContainer container; DelegateServiceLocator serviceLocator; { var catalog = new AggregateCatalog(); catalog.Catalogs.Add(trustedCatalog); container = new CompositionContainer(catalog, isThreadSafe: true); serviceLocator = new DelegateServiceLocator(new ExportProviderServiceLocator(container)); } var modules = serviceLocator.GetAllInstances <IAppServerModule>().AsArray(); if (modules.Length == 1) { CompositionHelper.ComposeExportedValueEx(container, modules[0]); } else { foreach (var m in modules) { CompositionHelper.ComposeExportedValue(container, m, m.GetType()); } } modules.ForAll(ctx2 => { var m = ctx2.Item; if (m.IsInitialized) { // no need to initialize return; } //TODO: add implementation(s) var logger = new AggregateLogger(); var moduleRootDir = new DirectoryInfo(Path.Combine(ctx2.State.ModuleDirectory, m.Name)).CreateDirectoryDeep(); var moduleCtx = new SimpleAppServerModuleContext(m); moduleCtx.Config = new IniFileConfigRepository(Path.Combine(moduleRootDir.FullName, "config.ini")); moduleCtx.InnerServiceLocator = ctx2.State.ServiceLocator; moduleCtx.Logger = logger; moduleCtx.OtherModules = ctx2.State.AllModules .Where(CreateWherePredicateForExtractingOtherModules(m)); moduleCtx.SetAssemblyFile(ctx2.State.AssemblyFile.FullName); var moduleInitCtx = new SimpleAppServerModuleInitContext(); moduleInitCtx.ModuleContext = moduleCtx; moduleInitCtx.RootDirectory = moduleRootDir.FullName; m.Initialize(moduleInitCtx); ctx2.State .NewModules .Add(m); }, actionState: new { AllModules = modules, AssemblyFile = f, ModuleDirectory = ctx.State.ModuleDirectory, NewModules = ctx.State.NewModules, ServiceLocator = serviceLocator, }, throwExceptions: true); }, actionState: new { CompositionCatalog = this.TrustedCompositionCatalog .Clone(cloneCatalogData: false), Logger = this.Logger, ModuleDirectory = modDir.FullName, NewModules = newModules, }, throwExceptions: false); if (ex != null) { this.Logger .Log(msg: ex, tag: LOG_TAG_PREFIX + "LoadModules", categories: LoggerFacadeCategories.Errors); } } this.Modules = newModules.Where(m => m.IsInitialized) .ToArray(); if (this.Modules.Length > 0) { this.Logger .Log(msg: string.Format("{0} modules were loaded.", this.Modules.Length), tag: LOG_TAG_PREFIX + "LoadModules", categories: LoggerFacadeCategories.Information); } else { this.Logger .Log(msg: "No module was loaded.", tag: LOG_TAG_PREFIX + "LoadModules", categories: LoggerFacadeCategories.Warnings); } this.RefreshEntityAssemblyList(); ex = newModules.Where(m => m.CanStart && m.IsInitialized) .ForAllAsync(ctx => { var m = ctx.Item; m.Start(); }, throwExceptions: false); if (ex != null) { this.Logger .Log(msg: ex, tag: LOG_TAG_PREFIX + "StartModules", categories: LoggerFacadeCategories.Errors); } }
protected virtual void LoadDynamicExecutors ( string dynamicLoadExecutorsPathsJsonFile = "dynamicLoadExecutorsPaths.json" ) { var processors = GetDynamicExecutorsPathsProcess ( dynamicLoadExecutorsPathsJsonFile ) .Where ( (x) => { return ( !x .IsNullOrEmptyOrWhiteSpace() && Directory .Exists(x) ); } ) .SelectMany ( (x) => { var r = CompositionHelper .ImportManyExportsComposeParts <IActionProcessable> (x); return(r); } ) .ToDictionary ( (x) => { return (x.Key); } , (x) => { return(x); } , StringComparer .OrdinalIgnoreCase ); _locker .LockIf ( () => { var r = (_processors == null); return(r); } , () => { _processors = processors; } ); }
public MainPage() { this.InitializeComponent(); CompositionHelper.Initialize(this, HostBackDropGrid); }
protected virtual void LoadDynamicValidators ( //string dynamicValidatorsPathsJsonFile = "dynamicValidatorsPaths.json" ) { var executingDirectory = Path .GetDirectoryName ( Assembly .GetExecutingAssembly() .Location ); var validators = GetDynamicValidatorsPathsProcess ( //dynamicValidatorsPathsJsonFile ) .Select ( (x) => { var path = x; if (!path.IsNullOrEmptyOrWhiteSpace()) { if ( x.StartsWith(".") ) { path = path.TrimStart('.', '\\', '/'); } path = Path.Combine ( executingDirectory , path ); } return(path); } ) .Where ( (x) => { return ( !x .IsNullOrEmptyOrWhiteSpace() && Directory .Exists(x) ); } ) .SelectMany ( (x) => { return (CompositionHelper .ImportManyExportsComposeParts <IHttpRequestValidateable <JToken> > ( x , "*Validator*Plugin*.dll" )); } ); _indexedValidators = validators .Distinct ( new FullTypeNameEqualityComparer <IHttpRequestValidateable <JToken> > () ) .ToDictionary ( (x) => { return (x.Name); } , StringComparer .OrdinalIgnoreCase ); }
public void TestInitialize() { _composition = new CompositionHelper(Settings.Default.MainConnectionString, Settings.Default.FilesConnectionString); _controller = _composition.Kernel.Get <SenderController>(); _fixture = new Fixture(); }
/// <summary> /// Raises the <see cref="E:System.Windows.Application.Startup" /> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs" /> that contains the event data.</param> protected override void OnStartup(StartupEventArgs e) { Arguments = GetArguments(); ShutdownMode = ShutdownMode.OnMainWindowClose; Logger.Info("**********\n\n\nLauncher [{0}] is starting applet [{1}]", Launcher, AppletName); ApplicationHelper.EnableExceptionHandling(); // RegisterCloudApplet(); ComSink.Instance.StartAppletDeamon(AppletName, ID); ComSink.Instance.RegisterApplet(Launcher, AppletName, ID); if (Current.StartupUri != null) { return; } ShutdownMode = ShutdownMode.OnExplicitShutdown; var site = (IXProcAddInSite)Activator.GetObject(typeof(IXProcAddInSite), Ipc); // Register a server channel so that the host can make calls to IXProcAddIn. // (Client channels are generally registere automatically.) Logger.Info("\tRegistering Channel to [{0}]'", Ipc); string procName = Process.GetCurrentProcess().ProcessName; Logger.Info("Registering Applet Process Server Channel '{0}'", procName); IpcUtils.RegisterServerChannel(procName); //IpcUtils.RegisterServerChannel(QueryString); // Set up a watchdog thread to catch abnormal quitting of the host process. // For normal exist, IXProcAddIn.ShutDown() is expected to be called. bool normalExit = false; new Thread(new ThreadStart(delegate { Thread.CurrentThread.IsBackground = true; Process.GetProcessById(site.HostProcessId).WaitForExit(); if (normalExit) { return; } Logger.Warn("Host process quit unexpectedly."); Environment.Exit(2); })).Start(); CompositionHelper.ComposeParts(this, SourceType); if (Addin != null) { Logger.Info("Created Addin [{0}] for site {1}", Addin.GetType().Name, site.HostProcessId); Addin.Site = site; Dispatcher.Run(); normalExit = true; } else { Logger.Info("No Addin found in package, shutting down."); if (Current.ShutdownMode == ShutdownMode.OnMainWindowClose) { if (Current.MainWindow == null) { Current.MainWindow.Close(); } Current.Shutdown(); } else { Current.Shutdown(); } } }
public void TestInitialize() { _context = new CompositionHelper(Settings.Default.MainConnectionString, Settings.Default.FilesConnectionString); _sender = _context.Kernel.Get <MailSender>(); }
private void InitializeCompositionModules() { Modules = CompositionHelper.GetCompositionModules(PlatformProvider.Current.GetAbsolutePath(ModulesPath), Prefixes, _reuseCompositionInformation); }