Ejemplo n.º 1
0
        private bool OwnApplicationActive()
        {
            // This checks whether any form from another assembly but in the same application is active. We grab the forms here...
            Assembly      _currentAssembly          = Assembly.GetExecutingAssembly();
            List <string> _formsFromOtherAssemblies = new List <string>();

            foreach (Form form in Application.OpenForms)
            {
                if (form.GetType().Assembly != _currentAssembly)
                {
                    _formsFromOtherAssemblies.Add(form.GetType().Name);
                }
            }

            // And here's our check!
            return(ActiveForm != null && _formsFromOtherAssemblies.Contains(ActiveForm.GetType().Name));
        }