Esempio n. 1
0
        /// <summary>
        /// Safely disposes of several objects.
        /// </summary>
        public void Cleanup()
        {
            completionForm.FocusOutEvent    -= OnLeaveCompletion;
            completionView.ButtonPressEvent -= OnButtonPress;
            completionView.KeyPressEvent    -= OnContextListKeyDown;
            completionView.KeyReleaseEvent  -= OnKeyRelease;

            if (completionForm.IsRealized)
            {
                completionForm.Destroy();
            }
            completionView.Dispose();
            completionForm.Destroy();
            completionForm = null;
        }
Esempio n. 2
0
        /// <summary>
        /// Safely disposes of several objects.
        /// </summary>
        public void Cleanup()
        {
            completionForm.FocusOutEvent    -= OnLeaveCompletion;
            completionView.ButtonPressEvent -= OnButtonPress;
            completionView.KeyPressEvent    -= OnContextListKeyDown;
            completionView.KeyReleaseEvent  -= OnKeyRelease;

            if (completionForm.IsRealized)
            {
                completionForm.Destroy();
            }
            completionView.Dispose();
            completionForm.Destroy();
            completionForm = null;

            // Detach event handlers so that this object may be safely garbage collected.
            foreach (EventHandler <IntellisenseItemSelectedArgs> handler in onItemSelected?.GetInvocationList())
            {
                onItemSelected -= handler;
            }
        }