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.

CoreSystem Class<br />

discussed in the section “ServiceLocator Class” on page 3-71. However, two of the<br />

overloads in CoreSystem are .NET generic convenience wrappers that are not available<br />

on the ServiceLocator class and therefore are covered here. These versions are<br />

defined as:<br />

public static T GetService() where T : class;<br />

and<br />

public static T GetService(object source) where T : class;<br />

They are .NET generic convenience wrappers for the GetService(Type) and<br />

GetService(object, Type) methods respectively and can be used in place of:<br />

MyObject mo = CoreSystem.GetService(typeof(MyObject)) as MyObject;<br />

Use of the .NET generic convenience wrapper gives:<br />

MyObject mo = CoreSystem.GetService();<br />

The method taking the source object would look like:<br />

object source = ...;<br />

MyObject mos = CoreSystem.GetService(source);<br />

State Property<br />

The CoreSystem.State property returns the current state of the system. You may use<br />

it to determine if the system is initializing, integrating, running, etc.<br />

...<br />

// See if all initialization is complete.<br />

// If we’re running then do something.<br />

if (CoreSystem.State == SystemState.Running)<br />

{<br />

...<br />

}<br />

The <strong>Ocean</strong> Core SystemState enumeration defines the possible system states which<br />

are:<br />

• None – The system is in an unknown state.<br />

3-48 <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!