/// <summary> /// Dispatch an URL to given frame. /// Caller can register himself for following result events for dispatched /// URL too. Notifications are guaranteed (instead of dispatch()) /// Returning of the dispatch object isn't necessary. /// Nobody must hold it alive longer the dispatch needs. /// </summary> /// <param name="xFrame">frame wich should be the target of this dispatch</param> /// <param name="aUrl">full parsed and converted office URL for dispatch</param> /// <param name="lProperties">optional arguments for dispatch</param> /// <param name="xListener"> /// optional listener which is registered automatically for status events /// (Note: Deregistration is not supported. Dispatcher does it automatically.) /// </param> public static void ExecuteWithNotification(XFrame xFrame, URL aUrl, PropertyValue[] lProperties, XDispatchResultListener xListener) { try { // Query the frame for right interface which provides access to all available dispatch objects. XDispatchProvider xProvider = (XDispatchProvider)xFrame; // Ask him for right dispatch object for given URL. // Force THIS frame as target for following dispatch. // Attention: The interface XNotifyingDispatch is an optional one! XDispatch xDispatcher = xProvider.queryDispatch(aUrl, "", 0); XNotifyingDispatch xNotifyingDispatcher = (XNotifyingDispatch)xDispatcher; // Dispatch the URL. if (xNotifyingDispatcher != null) { xNotifyingDispatcher.dispatchWithNotification(aUrl, lProperties, xListener); } } catch (RuntimeException exUno) { // Any UNO method of this scope can throw this exception. // But there is nothing we can do then. System.Diagnostics.Debug.WriteLine(exUno); } }
/// <summary> /// Dispatch an URL to given frame. /// Caller can register himself for following result events for dispatched /// URL too. Notifications are guaranteed (instead of dispatch()) /// Returning of the dispatch object isn't necessary. /// Nobody must hold it alive longer the dispatch needs. /// </summary> /// <param name="xFrame">frame wich should be the target of this dispatch</param> /// <param name="aUrl">full parsed and converted office URL for dispatch</param> /// <param name="lProperties">optional arguments for dispatch</param> /// <param name="xListener"> /// optional listener which is registered automatically for status events /// (Note: Deregistration is not supported. Dispatcher does it automatically.) /// </param> public static void ExecuteWithNotification(XFrame xFrame, URL aUrl, PropertyValue[] lProperties, XDispatchResultListener xListener) { try { // Query the frame for right interface which provides access to all available dispatch objects. XDispatchProvider xProvider = (XDispatchProvider)xFrame; // Ask him for right dispatch object for given URL. // Force THIS frame as target for following dispatch. // Attention: The interface XNotifyingDispatch is an optional one! XDispatch xDispatcher = xProvider.queryDispatch(aUrl, "", 0); XNotifyingDispatch xNotifyingDispatcher = (XNotifyingDispatch)xDispatcher; // Dispatch the URL. if (xNotifyingDispatcher != null) xNotifyingDispatcher.dispatchWithNotification(aUrl, lProperties, xListener); } catch (RuntimeException exUno) { // Any UNO method of this scope can throw this exception. // But there is nothing we can do then. System.Diagnostics.Debug.WriteLine(exUno); } }