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 />

Now we need to rewrite our Apply button callback to check for the environment in which<br />

we are running and handle the process environment. Use the context class type to<br />

determine if you are a workstep wrapped in a process or not.<br />

private void btnApply_Click(object sender, EventArgs e)<br />

{<br />

// update arg values from UI<br />

this.args.Well = ...;<br />

}<br />

if (context is WorkstepProcessWrapper.Context)<br />

{<br />

workstep.InvokeSimple(args);<br />

this.UpdateUI();<br />

}<br />

// notify the workflow that we have updated the arg package<br />

context.OnArgumentPackageChanged(this, new<br />

WorkflowContext.ArgumentPackageChangedEventArgs());<br />

Since we are updating the UI ourselves after invoking the workstep, we need to add a<br />

check to the argument package event handler.<br />

void argPkgChanged(object s,<br />

WorkflowContext.ArgumentPackageChangedEventArgs e)<br />

{<br />

// do nothing if sent myself; already handled update<br />

if (sender == this)<br />

return;<br />

UpdateUI();<br />

}<br />

Step 3 - Implement Persistence<br />

If you did not implement persistence on your workstep argument package, your process<br />

arguments will not be saved. Each time the end user starts your process, the UI will have<br />

the default values.<br />

Not retaining the UI entries that the end user previously entered is contrary to the Petrel<br />

conventions. You should implement persistence on your workstep argument package if<br />

you have not already, using one of these two methods:<br />

• Serialization<br />

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

Workflow 6-343

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

Saved successfully!

Ooh no, something went wrong!