Exemple #1
0
 static void AsyncLocalSetCurrentUICulture(AsyncLocalValueChangedArgs<CultureInfo> args)
 {
     s_currentThreadUICulture = args.CurrentValue;
 }
Exemple #2
0
 static void AsyncLocalSetCurrentUICulture(AsyncLocalValueChangedArgs <CultureInfo> args)
 {
     s_currentThreadUICulture = args.CurrentValue;
 }
Exemple #3
0
        // This callback is used to initialize the m_current AsyncLocal Variable.   
        // Its job is to keep the ETW Activity ID (part of thread local storage) in sync
        // with m_current.ActivityID
        void ActivityChanging(AsyncLocalValueChangedArgs<ActivityInfo> args)
        {
            if (args.PreviousValue == args.CurrentValue)
                return;

            if (args.CurrentValue != null)
            {
                // Allow subsequent activities inside this thread to automatically get the current activity ID.
                EventSource.SetCurrentThreadActivityId(args.CurrentValue.ActivityId);
            }
            else
                EventSource.SetCurrentThreadActivityId(Guid.Empty);
        }
Exemple #4
0
 static void DisplayNewLanguageTag(AsyncLocalValueChangedArgs <string> handle)
 {
     Console.WriteLine($"before: {handle.PreviousValue}"); //zh-CN
     Console.WriteLine($"after: {handle.CurrentValue}");   //zh-TW
 }