public override void Close() { Area.WindowSizeChanged -= Area_WindowSizeChanged; Task.Factory.StartNew(() => { try { if (presentation != null) { presentation.end(); } if (component != null) { component.dispose(); } if (desktop != null && desktop.getCurrentComponent() == null) // no component is running anymore { desktop.terminate(); } } catch (DisposedException) { // ignore } }).ContinueWith((t) => { controller = null; base.Close(); }); }
public void terminate() { XModifiable xMod = (XModifiable)mxDocument; if (xMod != null) { xMod.setModified(false); } XDesktop aDesktop = (XDesktop) mxMSFactory.createInstance("com.sun.star.frame.Desktop"); if (aDesktop != null) { try { aDesktop.terminate(); } catch (DisposedException d) { //This exception may be thrown because shutting down OOo using //XDesktop terminate does not really work. In the case of the //Exception OOo will still terminate. } } }
public static void CloseDesktop(XDesktop XDesktop) { if (!XDesktop.getComponents().createEnumeration().hasMoreElements()) XDesktop.terminate(); }