public ProjectContext(string projectSettingsPath, IContainer parentContainer) { BuildSubContainerForThisProject(projectSettingsPath, parentContainer); ProjectWindow = _scope.Resolve <Shell>(); string collectionDirectory = Path.GetDirectoryName(projectSettingsPath); //should we save a link to this in the list of collections? var collectionSettings = _scope.Resolve<CollectionSettings>(); if(collectionSettings.IsSourceCollection) { AddShortCutInComputersBloomCollections(collectionDirectory); } if(Path.GetFileNameWithoutExtension(projectSettingsPath).ToLower().Contains("web")) { BookCollection editableCollection = _scope.Resolve<BookCollection.Factory>()(collectionDirectory, BookCollection.CollectionType.TheOneEditableCollection); var sourceCollectionsList = _scope.Resolve<SourceCollectionsList>(); _bloomServer = new BloomServer(_scope.Resolve<CollectionSettings>(), editableCollection, sourceCollectionsList, _scope.Resolve<HtmlThumbNailer>()); _bloomServer.Start(); } else { if (Settings.Default.ImageHandler != "off") { _imageServer = _scope.Resolve<ImageServer>(); _imageServer.StartWithSetupIfNeeded(); } } }
/// ------------------------------------------------------------------------------------ public void Dispose() { _scope.Dispose(); _scope = null; if (_bloomServer != null) _bloomServer.Dispose(); _bloomServer = null; if (_imageServer!=null) _imageServer.Dispose(); _imageServer = null; }
public void RunTwoServer_UseDifferentPorts() { using(var x = new ImageServer(null)) { x.StartListening(); var firstUrl = ServerBase.ServerUrl; using(var y = new ImageServer(null)) { y.StartListening(); var secondUrl = ServerBase.ServerUrl; Assert.AreNotEqual(firstUrl, secondUrl); Console.WriteLine(firstUrl+", "+secondUrl); } } }