Hi we have a package that runs an app inside of softPro. We link this app with softPro by the softPro order.number. Is is possible to find the current open order(s) in softPro that a user has open when they open/actavate our package?
Let me know
Thanks
David Flood
Current Open Orders(s) from a package
Re: Current Open Orders(s) from a package
The following is a method extracted from the ZipCodePackage sample shipped with the Select SDK:
I believe it achieves what you're asking for.
Code: Select all
/// <summary>
/// If an order is open and active in Select, return it. Otherwise return null.
/// </summary>
private IOrder GetActiveOrder()
{
IWindowManager windowManager = GetService<IWindowManager>();
IWindowFrame activeDocument = windowManager.ActiveDocument;
if (activeDocument == null)
return null;
IRunningDocumentsManager runningDocumentsManager = GetService<IRunningDocumentsManager>();
IRunningDocumentInformation runningDocumentInformation = runningDocumentsManager.FindDocument(activeDocument.DocumentHandle);
if (runningDocumentInformation == null)
return null;
EditorPane p = runningDocumentInformation.Data as EditorPane;
if (p == null)
return null;
return p.GetProperty("Order") as IOrder;
}
Re: Current Open Orders(s) from a package
**Correction to my previous post:
You actually don't need to get the IRunningDocumentManager involved to get the IOrder. It can simply be achieved like this:
In fact this is the recommended way to get your active order.
You actually don't need to get the IRunningDocumentManager involved to get the IOrder. It can simply be achieved like this:
Code: Select all
/// <summary>
/// If an order is open and active in Select, return it. Otherwise return null.
/// </summary>
private IOrder GetActiveOrder()
{
IWindowManager windowManager = GetService<IWindowManager>();
IWindowFrame activeDocument = windowManager.ActiveDocument;
if (activeDocument != null)
{
object order = activeDocument.GetProperty("Order");
if (order != null)
return order as IOrder;
}
return null;
}