02.05.2014 Views

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The <strong>Ocean</strong> Module<br />

IntegratePresentation, we can derive the following code snippet for the<br />

Disintegrate method.<br />

public class MyModule : IModule<br />

{<br />

...<br />

// Remove components added to the user interface. Remove services.<br />

public Disintegrate ()<br />

{<br />

// Remove the context menu.<br />

PetrelSystem.Tools.Remove(surf);<br />

}<br />

// Remove our service<br />

CoreSystem.Services.RemoveService(typeof(FooBarService));<br />

...<br />

}<br />

...<br />

Dispose<br />

Dispose comes from the IDisposable pattern and must be implemented as part of<br />

your IModule implementation. The purpose of Dispose is to free any unmanaged<br />

resources and free any licenses acquired by the module.<br />

public class MyModule : IModule<br />

{<br />

...<br />

// Dispose of license.<br />

public Dispose ()<br />

{<br />

// Free the license that is in the private variable for the class.<br />

if (license != null)<br />

{<br />

license.Dispose ();<br />

license = null;<br />

}<br />

}<br />

}<br />

3-32 <strong>Ocean</strong> Application Development Framework 2008.1<br />

<strong>Schlumberger</strong> Private

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!