Event fired when an order is closed

Discussions related to order tracking development with the ProForm module.

Moderator: Phil Barton

Post Reply
chris.brady
Posts: 105
Joined: Wed Oct 17, 2012 4:20 pm

Event fired when an order is closed

Post by chris.brady »

I want to be able to register an event handler to an event that's fired when an order is closed. I currently have a couple of other event handlers in place for when an order is saved, and when the selection changes, as shown in the following c# code:

GetService<IMonitorSelection>().SelectionChanged += new EventHandler(IM_SelectionChanged);
GetService<OrderHelper>().RegisterOrderSavedHandler(OnSaved);

I dug around the documentation, and the closest thing I can find is an event for when a window is closed, but that means it'll fire for any window, not just an order's window.

Can you help direct me to the right place?

Thanks.
John Morris
Posts: 411
Joined: Thu Sep 11, 2008 11:35 am
Location: Raleigh, NC, USA
Contact:

Re: Event fired when an order is closed

Post by John Morris »

Handling that window closed event is the proper approach in that version of the application. You can filter out the extra non-order close events like so:

Code: Select all

private void MyWindowClosedHandler(object sender, WindowClosedEventArgs e)
{
    object order = e.Frame.GetProperty("Order");
    if (order != null)
    {
        //this means we have closed an order window
    }
}
John Morris
Sr. Software Architect
SoftPro
chris.brady
Posts: 105
Joined: Wed Oct 17, 2012 4:20 pm

Re: Event fired when an order is closed

Post by chris.brady »

Excellent, that's what I was looking for. Thanks for your help, John.
chris.brady
Posts: 105
Joined: Wed Oct 17, 2012 4:20 pm

Re: Event fired when an order is closed

Post by chris.brady »

Is there a more appropriate way to monitor for a closed order event on the client in Cameron? The suggested method worked great in Boylan, but in Cameron, it appears e.Frame.GetProperty("Order") returns an order when the Documents tab is closed, so we can't determine if it's an order tab or documents tab based on this method.

If there isn't an OrderClosed event, is there a way to determine what kind of tab is being closed?
John Morris
Posts: 411
Joined: Thu Sep 11, 2008 11:35 am
Location: Raleigh, NC, USA
Contact:

Re: Event fired when an order is closed

Post by John Morris »

You could just ignore frames with a title property of "Documents".
John Morris
Sr. Software Architect
SoftPro
Post Reply