private void searchForDocs()
        {
            while (serach)
            {
                try
                {
                    if (XDesktop != null)
                    {
                        XEnumerationAccess xEnumerationAccess = XDesktop.getComponents();
                        XEnumeration       enummeraration     = xEnumerationAccess.createEnumeration();

                        var _uids = DesktopDocumentComponents.Keys;

                        while (enummeraration.hasMoreElements())
                        {
                            Any        anyelemet = enummeraration.nextElement();
                            XComponent element   = anyelemet.Value as XComponent;
                            if (element != null)
                            {
                                //FIXME: for debugging
                                //System.Diagnostics.Debug.WriteLine("Window from Desktop found _________________");
                                //Debug.GetAllInterfacesOfObject(element);
                                //System.Diagnostics.Debug.WriteLine("\tProperties _________________");
                                //Debug.GetAllProperties(element);
                                XPropertySet ps = element as XPropertySet;
                                if (ps != null)
                                {
                                    var uid = OoUtils.GetStringProperty(ps, "RuntimeUID");
                                    if (uid != null && !uid.Equals(""))
                                    {
                                        if (!DesktopDocumentComponents.ContainsKey(uid))
                                        {
                                            //FIXME: for fixing
                                            Console.WriteLine("Found new Desktop child with uid:" + uid);
                                            DesktopDocumentComponents.Add(uid, element);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                catch (DisposedException dex) {
                    this.Dispose();
                    throw dex;
                }
                catch (System.Exception) { }


                //Console.WriteLine("\t\tSearch for Docs");
                Thread.Sleep(WAIT_TIME);
            }
        }
예제 #2
0
        /// <summary>
        /// Try to get the window handle of the window peer for WIN_32 Systems.
        /// </summary>
        /// <param name="windowPeer">The window peer.</param>
        /// <returns>the window handle or IntPtr.Zero</returns>
        public static IntPtr GetWindowHandle(XSystemDependentWindowPeer windowPeer)
        {
            IntPtr wHnd = IntPtr.Zero;

            if (windowPeer != null)
            {
                int pId = OoUtils.GetOoProcessID();
                if (pId > 0)
                {
                    var whnd = windowPeer.getWindowHandle(BitConverter.GetBytes(pId), (short)1);
                    if (whnd.hasValue())
                    {
                        try
                        {
                            int val = (int)whnd.Value;
                            wHnd = new IntPtr(val);
                        }
                        catch { }
                    }
                }
            }
            return(wHnd);
        }