{"action":"created","issue":{"url":"https://api.github.com/repos/fo-dicom/fo-dicom/issues/109","labels_url":"https://api.github.com/repos/fo-dicom/fo-dicom/issues/109/labels{/name}","comments_url":"https://api.github.com/repos/fo-dicom/fo-dicom/issues/109/comments","events_url":"https://api.github.com/repos/fo-dicom/fo-dicom/issues/109/events","html_url":"https://github.com/fo-dicom/fo-dicom/pull/109","id":111415730,"number":109,"title":"Portable Core and platform-specific assemblies. Connected to #60","user":{"login":"anders9ustafsson","id":6515030,"avatar_url":"https://avatars.githubusercontent.com/u/6515030?v=3","gravatar_id":"","url":"https://api.github.com/users/anders9ustafsson","html_url":"https://github.com/anders9ustafsson","followers_url":"https://api.github.com/users/anders9ustafsson/followers","following_url":"https://api.github.com/users/anders9ustafsson/following{/other_user}","gists_url":"https://api.github.com/users/anders9ustafsson/gists{/gist_id}","starred_url":"https://api.github.com/users/anders9ustafsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anders9ustafsson/subscriptions","organizations_url":"https://api.github.com/users/anders9ustafsson/orgs","repos_url":"https://api.github.com/users/anders9ustafsson/repos","events_url":"https://api.github.com/users/anders9ustafsson/events{/privacy}","received_events_url":"https://api.github.com/users/anders9ustafsson/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/fo-dicom/fo-dicom/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/fo-dicom/fo-dicom/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"open","locked":false,"assignee":{"login":"anders9ustafsson","id":6515030,"avatar_url":"https://avatars.githubusercontent.com/u/6515030?v=3","gravatar_id":"","url":"https://api.github.com/users/anders9ustafsson","html_url":"https://github.com/anders9ustafsson","followers_url":"https://api.github.com/users/anders9ustafsson/followers","following_url":"https://api.github.com/users/anders9ustafsson/following{/other_user}","gists_url":"https://api.github.com/users/anders9ustafsson/gists{/gist_id}","starred_url":"https://api.github.com/users/anders9ustafsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anders9ustafsson/subscriptions","organizations_url":"https://api.github.com/users/anders9ustafsson/orgs","repos_url":"https://api.github.com/users/anders9ustafsson/repos","events_url":"https://api.github.com/users/anders9ustafsson/events{/privacy}","received_events_url":"https://api.github.com/users/anders9ustafsson/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/fo-dicom/fo-dicom/milestones/2","html_url":"https://github.com/fo-dicom/fo-dicom/milestones/2.0.0","labels_url":"https://api.github.com/repos/fo-dicom/fo-dicom/milestones/2/labels","id":1238037,"number":2,"title":"2.0.0","description":null,"creator":{"login":"anders9ustafsson","id":6515030,"avatar_url":"https://avatars.githubusercontent.com/u/6515030?v=3","gravatar_id":"","url":"https://api.github.com/users/anders9ustafsson","html_url":"https://github.com/anders9ustafsson","followers_url":"https://api.github.com/users/anders9ustafsson/followers","following_url":"https://api.github.com/users/anders9ustafsson/following{/other_user}","gists_url":"https://api.github.com/users/anders9ustafsson/gists{/gist_id}","starred_url":"https://api.github.com/users/anders9ustafsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anders9ustafsson/subscriptions","organizations_url":"https://api.github.com/users/anders9ustafsson/orgs","repos_url":"https://api.github.com/users/anders9ustafsson/repos","events_url":"https://api.github.com/users/anders9ustafsson/events{/privacy}","received_events_url":"https://api.github.com/users/anders9ustafsson/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":42,"state":"open","created_at":"2015-08-03T11:01:10Z","updated_at":"2015-10-14T15:45:55Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-10-14T14:52:36Z","updated_at":"2015-10-15T19:27:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/fo-dicom/fo-dicom/pulls/109","html_url":"https://github.com/fo-dicom/fo-dicom/pull/109","diff_url":"https://github.com/fo-dicom/fo-dicom/pull/109.diff","patch_url":"https://github.com/fo-dicom/fo-dicom/pull/109.patch"},"body":"FINALLY!\r\n\r\n... some might say :-)\r\n\r\nI have now split the *Dicom* assembly into two *portable* (PCL) and one .NET assembly,\r\n\r\n* *Dicom.Core*, portable assembly containing practically *all* DICOM related functionality that was previously included in the *DICOM* assembly,\r\n* *Dicom.Legacy*, portable assembly containing the implementation of the legacy *Asynchronous Programming Model* (APM) methods, i.e. those methods from the public API with prefixes `Begin` and `End`.\r\n* *Dicom.Desktop*, .NET 4.5 assembly containing the .NET specific I/O, network, transcoder and image manager implementations that are required for running *fo-dicom* in a .NET application. The *Dicom.Desktop* assembly also contains a few other classes and methods for ADO.NET support, generating overlay data from `Bitmap`s and `System.Drawing` dependent DICOM Print methods.\r\n\r\nTo use *fo-dicom* in a .NET application from now on, it will be necessary to reference the *Dicom.Core* and the *Dicom.Desktop*  assemblies. For applications relying on the legacy APM model for background operations, *Dicom.Legacy* also has to be referenced. (Of course, the whole point of placing these legacy methods in a separate assembly is to facilitate their complete removal in a subsequent release.)\r\n\r\nThe *fo-dicom* NuGet package has already been prepared to include all three assemblies when installing *fo-dicom* via NuGet, so the NuGet user experience is not affected by the split into multiple assemblies.\r\n\r\n**_BREAKING CHANGE!_**     \r\nSince I/O, network, etc. managers have been split into an interface part residing in *Dicom.Core*, and implementations residing in the platform specific assemblies (e.g. *Dicom.Desktop*), it has now become necessary to explicitly instruct *Dicom.Core* abstract managers which manager implementations to use. For convenience, there is a common setup class for this, `Managers`. To further facilitate setup, `Managers` contains several overloads of the `Setup` method, so that you only need to select manager implementation where multiple options exist.\r\n\r\nThe `Managers.Setup` method should be called **before** the first use of any functionality in the *Dicom.Core*  assembly! In a .NET application, you may use any one of the following calls, which by default set the I/O, network and transcoder managers to the only existing .NET implementation:\r\n\r\n    Managers.Setup();   // No image or log manager set\r\n    Managers.Setup(LogManager logImpl);   // Log manager set, no image manager\r\n    Managers.Setup(ImageManager imageImpl);   /Image manager set, no log manager\r\n    Managers.Setup(LogManager logImpl, ImageManager imageImpl);   // Log and image managers set\r\n\r\nThere is also a full-control method available:\r\n\r\n    Managers.Setup(LogManager, IOManager, NetworkManager, TranscoderManager, ImageManager);\r\n\r\nThe portable assemblies *Dicom.Core* and *Dicom.Legacy* target PCL profile 111, which translates to the following platforms:\r\n\r\n* .NET 4.5 and higher\r\n* Windows 8 and 8.1\r\n* Windows Phone 8.1 (non-Silverlight)\r\n* Universal Windows Platform (Windows 10)\r\n* .NET Core 5 (ASP.NET 5)\r\n* Xamarin iOS Unified and Classic APIs\r\n* Xamarin Android\r\n* Mono\r\n\r\nAs a first proof-of concept, I have also prepared a separate *Dicom.Mono* solution, which uses the *Dicom.Core* PCL assembly together with a Mono specific *Dicom.Mono* assembly. The *Dicom.Mono* assembly resembles the *Dicom.Desktop* assembly very much, except that the `WpfImageManager` and `WpfImage` classes are excluded, and the assembly contains its own transcoder manager implementation, `MonoTranscoderManager`. This implementation is currently only a stub, codecs on the *Mono* platform are not yet implemented.\r\n\r\nApart from the missing codecs, *fo-dicom* is now fully functional on *Mono*, including `System.Drawing.Bitmap` images! I have included two example applications cloned from the primary solution, *DICOM Dump.Mono* and *Store SCP.Mono*, to illustrate the applicability. Please behold these screen dumps from *DICOM Dump* running on *Mac OS X Il Capitan*:\r\n\r\n![screen shot 2015-10-13 at 13 55 59](https://cloud.githubusercontent.com/assets/6515030/10486735/9b4608d6-7290-11e5-92af-d661db05df67.png)\r\n\r\n![screen shot 2015-10-14 at 14 45 48](https://cloud.githubusercontent.com/assets/6515030/10486740/a46efd78-7290-11e5-9165-3c9664bc6334.png)\r\n\r\nOn *Mono*, the `WinFormsImageManager` implementation is also pre-selected, so it only makes sense to use any one of the following overloads when initializing *fo-dicom* on *Mono*:\r\n\r\n    Managers.Setup();   // No log manager selected\r\n    Managers.Setup(LogManager logImpl);    // Specific log manager selected\r\n\r\nAlong with these main changes, I have also:\r\n\r\n* Made some final refactorings of the code in the *Dicom.Core* assembly to ensure that all functionality could be included in the desired PCL profile. In particular, this concerned the use of `ThreadPool` and `Timer`, which to a large extent has been replaced with `Task` based constructs. Furthermore, use of `Begin`/`End`, `Read`/`Write` on streams in `DicomService` has been replaced with corresponding `Read/Write``Async` calls.\r\n* Corrected some hitherto unnoticed bugs, particularly in `DicomService` and `DicomServer`.\r\n* Added `NetworkManager.MachineName` and `IOManager.BaseEncoding` properties to enable platform specific access to these features.\r\n* Moved about files and renamed a few projects so that project and folder names do *not* contain spaces or square brackets. (*Examples* and *Tools* applications have not been moved or renamed, though.) This is to facilitate development on platforms where folder and project names are more restricted.\r\n\r\nWith this split, it has now become realistically possible to also extend *fo-dicom* implementation to the *Universal Windows Platform*, including Windows 10 and Windows Phone 10 apps. Or for that matter, *iOS* and *Android*! Apart from codec functionality, the only missing piece on the *Xamarin*  platforms are image (manager) implementations, for e.g. `CGImage` and `Android.Graphics.Bitmap`, respectively. Where do we go first? Which is the lowest hanging fruit? :-)\r\n\r\nPlease review and comment!"},"comment":{"url":"https://api.github.com/repos/fo-dicom/fo-dicom/issues/comments/148497167","html_url":"https://github.com/fo-dicom/fo-dicom/pull/109#issuecomment-148497167","issue_url":"https://api.github.com/repos/fo-dicom/fo-dicom/issues/109","id":148497167,"user":{"login":"anders9ustafsson","id":6515030,"avatar_url":"https://avatars.githubusercontent.com/u/6515030?v=3","gravatar_id":"","url":"https://api.github.com/users/anders9ustafsson","html_url":"https://github.com/anders9ustafsson","followers_url":"https://api.github.com/users/anders9ustafsson/followers","following_url":"https://api.github.com/users/anders9ustafsson/following{/other_user}","gists_url":"https://api.github.com/users/anders9ustafsson/gists{/gist_id}","starred_url":"https://api.github.com/users/anders9ustafsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anders9ustafsson/subscriptions","organizations_url":"https://api.github.com/users/anders9ustafsson/orgs","repos_url":"https://api.github.com/users/anders9ustafsson/repos","events_url":"https://api.github.com/users/anders9ustafsson/events{/privacy}","received_events_url":"https://api.github.com/users/anders9ustafsson/received_events","type":"User","site_admin":false},"created_at":"2015-10-15T19:27:30Z","updated_at":"2015-10-15T19:27:30Z","body":"I guess the PR is a bit overwhelming... No point in holding back though, let's merge! :-)"}}