public Work() { this.DefaultStyleKey = typeof(Work); _actions = new ConcurrentQueue <Action>(); _onCloseMask = new EventProtector(); InitTip(); }
/// <summary> /// 不会重复的行为,短时间内双击等操作都不会重复触发行为 /// </summary> /// <param name="obj"></param> /// <param name="action"></param> public static void NotRepeatedAction(this DispatcherObject obj, Guid actionId, Action <Action> action) { EventProtector <Action> protector = null; if (!_protectors.TryGetValue(actionId, out protector)) { lock (_protectors) { if (!_protectors.TryGetValue(actionId, out protector)) { protector = new EventProtector <Action>(); _protectors.Add(actionId, protector); } } } protector.Start(action, () => { protector.End(); }); }
public override void OnApplyTemplate() { base.OnApplyTemplate(); this.MouseUp += OnMouseUp; _protector = new EventProtector <object>(_OnClick); }
public override void OnApplyTemplate() { base.OnApplyTemplate(); this.items.ItemsSource = new ObservableCollection <NavigationItem>(); _protector = new EventProtector <object>(); }