02.05.2014 Views

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

PetrelLogger Class<br />

The error, warning, and information messages each have one method with two overloaded<br />

definitions. In each case a popup dialog appears and a tone is sounded indicating the<br />

severity of the message. Let us consider a simple divide by zero to illustrate the results.<br />

using Slb.<strong>Ocean</strong>.Petrel;<br />

int v1 = 100;<br />

int v2 = 0;<br />

try<br />

{<br />

int val = v1 / v2;<br />

}<br />

catch (DivideByZeroException e)<br />

{<br />

// Display only the message<br />

PetrelLogger.ErrorBox("Error trying to divide value.");<br />

// Display message and exception<br />

PetrelLogger.ErrorBox("Error trying to divide value.", e);<br />

}<br />

The above code would result in the following two error message boxes being displayed<br />

along with an audio tone indicating a severe error. The information in the popup dialogs<br />

would also be written to the log file for the Petrel application.<br />

Fig. 5-3 Error Message Popup Dialog Example Results<br />

5-242 <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!