Code Sample

在Windows8 Winrt中 高性能处理多个条件语句 用于实现自定义手势

在Winrt中 高性能处理多个条件语句

    在winrt中 多点触控 控件的应用越来越多,例如 各种手势与 控件之间的互动,如常规的:放大缩小,滑动,旋转,轻扫等。。

但是如果我们需要自定义一些手势,那么需要大量的条件语句判断,严重的影响了性能,往往这些判断在ui 中计算,当触控点过多时会引起系统内响应过慢。


当然 常规的解决办法是将这些条件判断放置在多线程中处理。但是该方式治标不治本,条件过多时,代码会显得非常混乱 难以维护。。




通过Predict定义多个条件,通过Action或者Func 来实现判断之后的效果。

Dictionary<Predicate<int>, Action> testDict = new Dictionary<Predicate<int>, Action>();

New Contributed Code for Cilk™ Plus: DotMix, a Deterministic Parallel Random-Number Generator

DotMix is a new user-contributed code that provides programmers with a repeatable but efficient way to deterministically generate pseudorandom numbers in parallel in Intel® Cilk™ Plus. In this post, I explain what "contributed code" is, where it comes from, and give a brief preview of DotMix.

关于 android 中 edittext 特殊字符过滤和字符长度限制的最优方法






mEditText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(MAX_TEXT_INPUT_LENGTH)});


2, 同样是使用setFilters方法,动态改变限制的字符长度:

int mMaxLenth = 20;//mMaxLenth可以动态改变

Low Power Audio Playback - Windows* Store app


One of the use cases for tablets with Intel® Atom™ processors and Microsoft Windows 8* is low-power audio playback. This capability allows users to continue listening to music after the device enters a low-power state commonly referred to as Connected Standby. Connected Standby is an Always On Always Connected scenario implemented in Microsoft Windows and manifest through the new Intel Atom S0ix low-power states.

  • Microsoft Windows* 8.x
  • HTML5
  • Windows*
  • HTML5
  • JavaScript*
  • WindowsCodeSample
  • ultrabook
  • Connected Standby
  • low-power audio
  • application
  • Intel® Atom™ Processor
  • Microsoft Windows* 8 Style UI
  • An Introduction to Cilk™ Plus Reducers

    If you are new to Cilk™ Plus, you have probably been impressed by how easy it is to turn a serial program into a parallel program. You’ve also realized, though, that adding cilk_sync or cilk_for to a program doesn’t automatically solve the harder parts of parallel programming: dealing with data races, and coordinating work that is done in parallel.

    Subscribe to Code Sample