Пример #1
0
        public static void RemoveWindow(Form form)
        {
            Debug.Assert(form != null);
            if (form == null)
            {
                throw new ArgumentNullException("form");
            }

            lock (g_oSyncRoot)
            {
                for (int i = 0; i < g_vWindows.Count; ++i)
                {
                    if (g_vWindows[i].Key == form)
                    {
                        if (GlobalWindowManager.WindowRemoved != null)
                        {
                            GlobalWindowManager.WindowRemoved(null, new GwmWindowEventArgs(
                                                                  form, g_vWindows[i].Value));
                        }

                        MonoWorkarounds.Release(form);

#if DEBUG
                        DebugClose(form);
#endif

                        g_vWindows.RemoveAt(i);
                        return;
                    }
                }
            }

            Debug.Assert(false);             // Window not found
        }
Пример #2
0
        public static void RemoveWindow(Form form)
        {
            if (form == null)
            {
                Debug.Assert(false); throw new ArgumentNullException("form");
            }

            lock (g_oSyncRoot)
            {
                for (int i = 0; i < g_vWindows.Count; ++i)
                {
                    if (g_vWindows[i].Key == form)
                    {
                        if (GlobalWindowManager.WindowRemoved != null)
                        {
                            GlobalWindowManager.WindowRemoved(null, new GwmWindowEventArgs(
                                                                  form, g_vWindows[i].Value));
                        }

                        MonoWorkarounds.Release(form);

                        Debug.Assert(!(form is MainForm));                         // MainForm calls the following itself
                        CustomizeFormHandleCreated(form, false, false);

#if DEBUG
                        DebugClose(form);
#endif

                        g_vWindows.RemoveAt(i);
                        return;
                    }
                }
            }

            Debug.Assert(false);             // Window not found
        }