Show a specific process dialog in petrel? - dialog

I want to show a specified dialog under simulation category like "Developement Strategy" and do something after its "OK" click. Is there a way to show a native petrel process window?
I can see some class and interfaces in "Slb.Ocean.Petrel.UI" like DialogBuilder , DialogPage, IDialogPageFactory, IDialogPage...but I can't use them, even I don't know if they supply my required objects.

I think you want to create a Workstep (Slb.Ocean.Petrel.Workflow). The Ocean wizard lets offers a quick start. It creates optionally a process wrapper for you, which is the item showing up in the process tree.
Once you got familiar with the concepts, you can evolve the simplistic initial implementation by using the WorkflowEditorUIFactory. Check the namespace documentation in the Ocean documentation for more details.
IProcessDiagram offers different Add methods for your custom Process to enable custom positioning in the tree node sequence.

You can programmatically show a particular process dialog using DialogBuilder.ShowSettings(object) and passing the Process instance. This is typically used by a plug-in to launch its own process dialog, but it's possible to obtain a reference to the instance of a native Process by name using FindProcess(string). This is, of course, a very fragile approach:
Process p = PetrelSystem.ProcessDiagram.FindProcess("Development strategy");
PetrelSystem.DialogBuilder.ShowSettings(p);
It would need a lot of error handling, not just to guard against changes to the process name, but also to handle the case where an exclusive process dialog is already open.
However, this will still only launch the dialog. There is no way to know if/when the user clicks the OK button. Petrel processes are typically stand-alone pieces of functionality, and any kind of chaining is generally supported by creating workflows.

Related

Is levels are there in Coded UI Testing?

I am fresher to Coded UI Test Automation. I want to provide a support for 3rd party controls so i need to know about CUIT, if any levels available in CUIT please explain!!! Thanks.
First for your own controls you'll want to look at how to Overriding Control.ControlAccessibleObject on your custom controls by implementing a ControlAccessibleObject. Any and all properties you want to support you'll have to expose. This will explain in better detail of the specific details.
As for actual Coded UI, For Desktop controls, WPF or WinForms, you probably want to keep your Test UI's extra simplified Window with just your custom control so its easy to spawn.
From here, depending upon the control, you'll want to implement a matching CodedUI object. To do this, you must inherit from UITestControl, you should inherit from the appropriate family tree like HtmlControl, WinControl, or WpfControl. Also you will have to override the match PropertyNames inner class with any extra properties you are exposing in the ControlAccessibleObject
If you are doing Html Development I'd highly recommend using the Page Object Pattern to help give statefull changes of a webpage be more apparent based upon the return type of method calls using method chaining.
BEWARE if your choose to use a UIMap (from the builder) your Custom Coded UI controls will not be used in generation, most likely they'll be HtmlCustom, WinCustom, WpfCustom, which have very limited support. Usually I only use a UIMap to quickly define Search criteria for controls.
To note Coded UI uses hierarchy to help it locate the controls. So when looking for your control you should define relevant Hierarchy elements, which have a very high level of success when you define ID's for your controls
YourHtmlControl->HtmlDiv->HtmlDocument->BrowserWindow

Combine some CScrollView into one

I have some files and i use OpenDocumentFile() to open and get pFirtView of each file.
Now i have CView/CScrollView(s) for the files.
I need combine all CView/CScrollView(s) to only one CScrollView. Any suggestion? Thanks
The framework doesn't support this. You can probably hack around it by providing some sort of aggregate CView that can host multiple windows and does the layouting, but for your mental health, I suggest avoiding Doc/View for any scenario that is not exactly the way it is intended to be used, and do your window creation/drawing.
Remove the CDocTemplate based creation part in the App class, create a CWnd-derived class to host other windows and set m_pMainWnd to that window. That gets you there 90% of the way (well apart from the actual drawing in the child windows, of course...)

How to add Nagios custom states

I am Using Nagios XI. Currently My Nagios showing three states of alerts: CRITICAL, WARNING and OK.
I want to add another custom hard state FATAL for some extreme issues like server or any of my component(Java jar component) is down. Currently we are getting the DOWN message when the Host is Down. If the component is down I am getting "URL Status is CRITICAL" But I want "URL Status is FATAL". Is that possible to add a custom State in Nagios? How can I do that?
You can't. The states are built in (along with a fouth state, UNKNOWN, which is generally used if the plugin fails for reasons that probably belong to the plugin itself, not the object being monitored).
The states are intended to mean "requires action immediately (CRITICAL)" and "will probably require action soon (WARNING)". There's nothing left which would make your FATAL state different from CRITICAL, so i suggest you use that.
If you want to pass additional information to operators, you can always do that in the text the plugin provides.
(As Nagios is open source, you could probably modify the source code to allow another state. But this would be a huge task to implement properly, make your installation incompatible with the rest of the world, no plugins except yours would support it, and you'd have to re-apply and rewrite your patches with every new version of Nagios, so i'd strongly recommend against it).
You can't add states. But if you only want to make your alerts stand out more clearly, you can modify the nagios-Stylesheets in /etc/nagios3/stylesheets/ or add custom javascript in /usr/share/nagios3/htdocs/ssi/<nagiospage>-header.ssi and highlight the respective messages from there.

MFC ID_ vs IDM_ prefixes and their range

I have been working on cleaning an old project's resource.h.
In the project I am working on, I have some IDs which are in the form:
IDM_XXXX 32771
but are referred in code in ON_COMMAND and ON_UPDATE_COMMAND_UI statements.
So am I right in thinking that they are following the command architecture and ideally should be named as ID_XXX instead of IDM_XXXX?
I have read through TN022: Standard Commands Implementation and see that Microsoft says:
We recommend you use the standard "IDM_" prefix for menu items which
do not follow the command architecture and need menu-specific code to
enable and disable them.
I am not sure what is meant by menu-specific code here.
How are IDM_XXXX resources normally handled? Also what is the valid range range for IDM_XXXX? I have gone through TN020: ID Naming and Numbering Conventions but am confused.
ID_ and IDM_ are interchangeable because commands are accessible via command bars, menus or maybe ribbons. I never use IDM_, I only use ID_
Reserved by the MFC is 0xE000->0xEFFF and 0x7000->0x7FFF.
TN020 says that menu/command IDs must be in the range of 0x8000 and greater, but I found no reason why to do this. In the tooltip handling and command routing of the dialogs of the 16bit MFC version and AFAIK an old MFC4.x version, there was a specific code that looks for commands being greater than 0x8000.
By accident I had cases were an ID <0x8000 was created, but it worked.
I would resist not following the recommendations in the technical note. Microsoft does have undocumented messages that may interfere with your code if you violate their recommendations. And, debugging such an issue would be difficult. Additionally, following the recommendation allows you the extra benefit of...
following the MFC command architecture not only makes command handlers
more powerful (since they will work with toolbars) but makes the
command handler code reusable
This means MFC will use the same code to handle any menu and toolbar interactions that are linked together.

Is there something I can use to neatly visualise JavaScript objects in Chrome?

I am a seasoned C# coder, but quite the JavaScript novice, and I am now trying to get a pure JavaScript component, the very competent Kendo UI DataSource, to talk nicely to my C# MVC3/4 controllers.* I would like to be able to examine certain JavaScript objects so I can fine tune my client side model mapping code, but the view of objects in the Chrome debugging console is a little cluttered and low level.
Is there a Chrome add-in I can use for visualising JavaScript objects while debugging script, and failing that, a nice object visualizer that I can use to output object visualizations as HTML. I can then toggle whether this is active, built a visual object graph for a debugging session, then switch the visualiser off again for normal operations in my client scripts.
** This question is a much broader and differently targetted one that shares only the same goal of my other question, How can I accept JSON requests from a Kendo UI data source in my MVC4 application? However, that question is more technology specific and covers the whole client-server roundtrip, where this one is specific to only visualising JavaScript objects on the client.
EDIT:
Based on suggestions below, console.log does provide adequate output for runtime inspection, but often the console is a busy place, and I would prefer to output a persistent visualization elsewhere, with all properties in the object expanded, but without the 'internals' e.g. __id and __proto, as seen in the image. I would just like to see models as an array of two objects, each with only Id and Name properties.
I find it more useful to send the object to the console than inspect it inside the debugger. It's less cluttered and you don't have to go searching through your code for a breakpoint. If you just do a console.log(object), then hit F12 and select the Console, your object will be sitting there ready to be inspected.
Edit
If you do a console.log on the models property, it will come out like this:
Or, if you prefer, you could use something like this to spit out the information without you having to click any arrows:
function logModels(models) {
for (o in models) for (p in models[o])
console.log(p +'\t' + models[o][p]);
}
Which looks like this:
You can also filter the console to only display Logs by clicking the appropriate button at the bottom of the bar.

Resources