티스토리 뷰

반응형

1. 여러 프레임웍에서 UI 스레드 동기화

 

        public static void InvokeIfRequiredAsync(SynchronizationContext context, SendOrPostCallback callback, object state)
        {
            context.Post(callback, state);
        }

 

 

        #region PropertyChanged
        public event PropertyChangedEventHandler PropertyChanged;

        public void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                StaticFunctions.InvokeIfRequiredAsync(System.Threading.SynchronizationContext.Current,
                    _ =>
                    {
                        PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
                    }, null);
            }
        }
        #endregion

반응형

'Previous Platforms > ETC' 카테고리의 다른 글

Visual Studio 2012 Debuging tip  (0) 2012.10.26
Windows 8 Store app registing  (0) 2012.10.26
Windows 8 .Net 4.5 tips  (0) 2012.09.08
Metro style app data save in app local folder - Windows 8 RP  (0) 2012.07.31
Windows 8 Metro app links  (0) 2012.06.12
댓글