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.

Custom Processes<br />

Step 4 - Optionally Handle Process Activation and Deactivation<br />

If you have an interactive process, you will typically want to control what happens when<br />

the process is activated and deactivated. Common actions are to add toolbar buttons to<br />

interact with your own custom windows or to add specialized context menu items.<br />

public abstract class Process<br />

{<br />

protected virtual void OnActivateCore();<br />

protected virtual void OnDeactivateCore();<br />

...<br />

}<br />

The process is activated from the Process diagram when the end user selects it. Override<br />

OnActivateCore to specify what will happen on process activation. This example adds a<br />

new toolbar button in Petrel:<br />

using System;<br />

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

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

public class Example : Process<br />

{<br />

public ToolbarItem myButton;<br />

...<br />

protected override void OnActivateCore()<br />

{<br />

base.OnActivateCore();<br />

PetrelSystem.Tools.Add(myButton);<br />

}<br />

...<br />

<strong>Schlumberger</strong> Private<br />

Workflow 6-331

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

Saved successfully!

Ooh no, something went wrong!