Esempio n. 1
0
        public void EnableTopMost(bool bEnable)
        {
            if (this.InvokeRequired)
            {
                while (!this.IsHandleCreated)
                {
                    if (this == null || this.IsDisposed)
                    {
                        return;
                    }
                }
                EnableTopMostDel cs = new EnableTopMostDel(EnableTopMost);
                this.Invoke(cs, new object[] { bEnable });
                return;
            }

            if (_instance != null && !_instance.IsDisposed)
            {
                _instance.TopMost = bEnable;
                if (bEnable)
                {
                    _topmostTimer.Change(300, 20000);
                }
                else
                {
                    _topmostTimer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
                }
            }
        }
        public void EnableTopMost(bool bEnable)
        {
            if (this.InvokeRequired)
            {
                while (!this.IsHandleCreated)
                {
                    if (this == null || this.IsDisposed)
                    {
                        return;
                    }
                }
                EnableTopMostDel cs = new EnableTopMostDel(EnableTopMost);
                this.Invoke(cs, new object[] { bEnable });
                return;
            }

            if (_instance != null && !_instance.IsDisposed)
            {
                _instance.TopMost = bEnable;
                if (bEnable)
                {
                    _topmostTimer.Change(300, 20000);
                }
                else
                {
                    _topmostTimer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
                }
            }
        }