Ocean for Petrel Plugin Creation - Ocean - Schlumberger
Ocean for Petrel Plugin Creation - Ocean - Schlumberger
Ocean for Petrel Plugin Creation - Ocean - Schlumberger
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
2.2.7.2. Process Code Changes<br />
The Process code that is constructed by the <strong>Ocean</strong> Module Wizard has a<br />
Workstep class that implements IPresentation and IDescriptionSource. It also<br />
contains an Arguments class, subclass of the Slb.<strong>Ocean</strong>.<strong>Petrel</strong>.Workflow class<br />
DescribedArgumentsByReflection. That specialized Workstep class is named<br />
HelloWorldProcess, after our process name, and it overrides the method<br />
InvokeSimpleCore, which is the entry point <strong>for</strong> process execution. Open the file<br />
HelloWorldProcess.cs. To execute your custom code, you will have to add it to<br />
the body of the InvokeSimpleCore method.<br />
The code <strong>for</strong> the InvokeSimpleCore method that is created by the wizard is<br />
shown in Figure 2-15. You can see that the arguments defined <strong>for</strong> the wizard are<br />
passed to the method. The structure is defined in the specialized class<br />
HelloWorldProcess.Arguments.<br />
protected override void InvokeSimpleCore<br />
(HelloWorldProcess.Arguments argumentPackage)<br />
{<br />
// TODO: finish the Invoke method implementation<br />
}<br />
return;<br />
Figure 2-15 Invoke method original code.<br />
2.2.7.3. Display “Hello World” in Status Bar<br />
The status bar is located at the bottom of the <strong>Petrel</strong> window. It is accessed by<br />
calling the static methods of the <strong>Petrel</strong>Logger convenience class. <strong>Petrel</strong>Logger<br />
is a layer on top of CoreLogger and is defined in the Slb.<strong>Ocean</strong>.<strong>Petrel</strong><br />
namespace. In the example the “SuccessStatus” method will be used to display<br />
the message and set the icon to the right of the status bar to indicate that the<br />
message posted marks a successful operation. Other methods (Error, Warning,<br />
Status) can also be used depending on the message target (log file, log window,<br />
modal dialog or status bar) and the type of in<strong>for</strong>mation that needs to be<br />
displayed. The message presentation will be consistent with the way the Product<br />
Family (<strong>Petrel</strong>) displays its messages.<br />
To place a message in the status bar, add the <strong>Petrel</strong>Logger call to the body of<br />
the InvokeSimpleCore method, as shown in Figure 2-16.<br />
protected override void InvokeSimpleCore<br />
(HelloWorldProcess.Arguments argumentPackage)<br />
{<br />
<strong>Petrel</strong>Logger.SuccessStatus(“Hello World Process started.”);<br />
}<br />
return;<br />
Figure 2-16 InvokeSimpleCore with status bar message.<br />
22