Exemple #1
0
 public Work()
 {
     this.DefaultStyleKey = typeof(Work);
     _actions             = new ConcurrentQueue <Action>();
     _onCloseMask         = new EventProtector();
     InitTip();
 }
Exemple #2
0
        /// <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(); });
        }
Exemple #3
0
 public override void OnApplyTemplate()
 {
     base.OnApplyTemplate();
     this.MouseUp += OnMouseUp;
     _protector    = new EventProtector <object>(_OnClick);
 }
Exemple #4
0
 public override void OnApplyTemplate()
 {
     base.OnApplyTemplate();
     this.items.ItemsSource = new ObservableCollection <NavigationItem>();
     _protector             = new EventProtector <object>();
 }