Khan-Sadas

  填坑,上文说的 C# Event.ClickCount 解决垃圾鼠标带来的烦恼 中及时刷新UI方法

如下:

 [SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
        public static void RefreshButtonClickProperty()
        {
            DispatcherFrame frame = new DispatcherFrame();
            Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(ExitFrames), frame);
            try { Dispatcher.PushFrame(frame); }
            catch (InvalidOperationException e)
            {
            }
        }

public static object ExitFrames(object f)
{
((DispatcherFrame)f).Continue = false;


return null;
}

 

在对控件的某些属性进行设置后可及时调用该方法进行刷新

分类:

技术点:

相关文章:

  • 2021-12-23
  • 2021-11-19
  • 2021-12-23
  • 2021-12-05
  • 2021-12-26
  • 2021-12-23
  • 2022-01-13
猜你喜欢
  • 2021-12-15
  • 2021-11-13
  • 2021-12-05
  • 2021-12-13
  • 2021-12-13
  • 2021-11-13
  • 2021-10-03
相关资源
相似解决方案