Page 1 of 1

Event fired when an order is closed

Posted: Tue Jul 23, 2013 9:54 am
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.

Re: Event fired when an order is closed

Posted: Wed Jul 24, 2013 2:34 pm
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
    }
}

Re: Event fired when an order is closed

Posted: Wed Jul 24, 2013 3:17 pm
by chris.brady
Excellent, that's what I was looking for. Thanks for your help, John.

Re: Event fired when an order is closed

Posted: Tue Oct 20, 2015 10:18 am
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?

Re: Event fired when an order is closed

Posted: Tue Oct 20, 2015 10:34 am
by John Morris
You could just ignore frames with a title property of "Documents".