2 types derived from ThreadContext
System.Windows.Forms (2)
System\Windows\Forms\Application.ComponentThreadContext.cs (1)
18ThreadContext,
System\Windows\Forms\Application.LightThreadContext.cs (1)
13internal sealed unsafe class LightThreadContext : ThreadContext
85 references to ThreadContext
System.Windows.Forms (85)
System\Windows\Forms\Application.ComponentManager.cs (1)
243ThreadContext.FromCurrent().DisposeThreadWindows();
System\Windows\Forms\Application.ComponentThreadContext.cs (1)
15/// <see cref="ThreadContext"/> that supports <see cref="IMsoComponent"/>.
System\Windows\Forms\Application.cs (45)
82public static bool AllowQuit => ThreadContext.GetAllowQuit(); 240=> ThreadContext.FromCurrent().CustomThreadExceptionHandlerAttached; 435=> ThreadContext.FromCurrent().GetMessageLoop(); 547=> ThreadContext.FromCurrent().RegisterMessageLoop(callback); 595=> ThreadContext.FromCurrent().RegisterMessageLoop(null); 766=> ThreadContext.FromCurrent().AddMessageFilter(value); 776bool processed = ThreadContext.FromCurrent().ProcessFilters(ref msg, out bool modified); 796ThreadContext current = ThreadContext.FromCurrent(); 805ThreadContext current = ThreadContext.FromCurrent(); 821ThreadContext current = ThreadContext.FromCurrent(); 829ThreadContext current = ThreadContext.FromCurrent(); 845ThreadContext current = ThreadContext.FromCurrent(); 853ThreadContext current = ThreadContext.FromCurrent(); 868ThreadContext current = ThreadContext.FromCurrent(); 876ThreadContext current = ThreadContext.FromCurrent(); 900=> ThreadContext.FromCurrent().BeginModalMessageLoop(null); 906=> ThreadContext.FromCurrent().RunMessageLoop(msoloop.DoEvents, null); 909=> ThreadContext.FromCurrent().RunMessageLoop(msoloop.DoEventsModal, null); 950=> ThreadContext.FromCurrent().EndModalMessageLoop(null); 1038ThreadContext.ExitApplication(); 1056ThreadContext context = ThreadContext.FromCurrent(); 1076ThreadContext.FromCurrent().FormActivated(activated); 1131internal static unsafe ThreadContext GetContextForHandle<T>(T handle) where T : IHandle<HWND> 1133ThreadContext? threadContext = ThreadContext.FromId(PInvoke.GetWindowThreadProcessId(handle.Handle, null)); 1213ThreadContext threadContext = ThreadContext.FromCurrent(); 1224=> ThreadContext.FromCurrent().OleRequired(); 1230=> ThreadContext.FromCurrent().OnThreadException(t); 1238ThreadContext threadContext = GetContextForHandle(handle); 1247=> ThreadContext.FromCurrent()._idleHandler?.Invoke(Thread.CurrentThread, e); 1253=> ThreadContext.FromCurrent().RemoveMessageFilter(value); 1302=> ThreadContext.FromCurrent().RunMessageLoop(msoloop.Main, new ApplicationContext()); 1309=> ThreadContext.FromCurrent().RunMessageLoop(msoloop.Main, new ApplicationContext(mainForm)); 1316=> ThreadContext.FromCurrent().RunMessageLoop(msoloop.Main, context); 1324=> ThreadContext.FromCurrent().RunMessageLoop(msoloop.ModalForm, new ModalApplicationContext(form));
System\Windows\Forms\Application.LightThreadContext.cs (1)
11/// Lighter weight <see cref="ThreadContext"/> that doesn't support <see cref="IMsoComponent"/>.
System\Windows\Forms\Application.ModalApplicationContext.cs (4)
12private ThreadContext? _parentWindowContext; 14private delegate void ThreadWindowCallback(ThreadContext context, bool onlyWinForms); 51private void DisableThreadWindowsCallback(ThreadContext context, bool onlyWinForms) 54private void EnableThreadWindowsCallback(ThreadContext context, bool onlyWinForms)
System\Windows\Forms\Application.ParkingWindow.cs (3)
74ThreadContext? context = ThreadContext.FromId(id); 77if (context is null || !ReferenceEquals(context, ThreadContext.FromCurrent()))
System\Windows\Forms\Application.ThreadContext.cs (9)
25private static readonly Dictionary<uint, ThreadContext> s_contextHash = []; 34private static ThreadContext? t_currentThreadContext; 450ThreadContext[] contexts = new ThreadContext[s_contextHash.Values.Count]; 497internal static ThreadContext FromCurrent() => t_currentThreadContext ?? Create(); 499private static ThreadContext Create() 501ThreadContext context = LocalAppContextSwitches.EnableMsoComponentManager 511internal static ThreadContext? FromId(uint id) 513if (!s_contextHash.TryGetValue(id, out ThreadContext? context) && id == PInvokeCore.GetCurrentThreadId())
System\Windows\Forms\Application.ThreadWindows.cs (1)
62Control? activatingControl = ThreadContext.FromCurrent().ActivatingControl;
System\Windows\Forms\Control.cs (4)
913Application.ThreadContext.FromCurrent().ActivatingControl = value ? this : null; 3467Application.ThreadContext? ctx = Application.ThreadContext.FromId(threadId); 8573/// See <see cref="Application.ThreadContext.PreTranslateMessage(ref MSG)"/>.
System\Windows\Forms\Controls\ToolStrips\ToolStrip.cs (4)
1930Application.ThreadContext.FromCurrent().RemoveMessageFilter(_restoreFocusFilter); 3298Application.ThreadContext.FromCurrent().RemoveMessageFilter(RestoreFocusFilter); 3976Application.ThreadContext.FromCurrent().RemoveMessageFilter(RestoreFocusFilter); 4631Application.ThreadContext.FromCurrent().AddMessageFilter(RestoreFocusFilter);
System\Windows\Forms\Controls\ToolStrips\ToolStrip.RestoreFocusMessageFilter.cs (1)
58Application.ThreadContext.FromCurrent().RemoveMessageFilter(this);
System\Windows\Forms\Controls\ToolStrips\ToolStripComboBox.cs (2)
364Application.ThreadContext.FromCurrent().RemoveMessageFilter(ParentInternal.RestoreFocusFilter); 377Application.ThreadContext.FromCurrent().RemoveMessageFilter(ParentInternal.RestoreFocusFilter);
System\Windows\Forms\Controls\ToolStrips\ToolStripManager.ModalMenuFilter.cs (5)
146Application.ThreadContext.FromCurrent().AddMessageFilter(this); 147Application.ThreadContext.FromCurrent().TrackInput(true); 149if (!Application.ThreadContext.FromCurrent().GetMessageLoop(true)) 196Application.ThreadContext.FromCurrent().RemoveMessageFilter(this); 197Application.ThreadContext.FromCurrent().TrackInput(false);
System\Windows\Forms\Controls\ToolStrips\ToolStripManager.ModalMenuFilter.HostedWindowsFormsMessageHook.cs (1)
91if (Application.ThreadContext.FromCurrent().PreTranslateMessage(ref *msg))
System\Windows\Forms\NativeWindow.cs (2)
108Application.ThreadContext? context = Application.ThreadContext.FromId(id);
System\Windows\Forms\WindowsFormsSynchronizationContext.cs (1)
30_controlToSendTo = Application.ThreadContext.FromCurrent().MarshallingControl;