Esempio n. 1
0
        public void Attach(DependencyObject associatedObject)
        {
            AssociatedObject = associatedObject;

            // process start
            if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
            {
                element.Visibility = Visibility.Visible;
            }
            else
            {
                _dispatcher = Common.DispatcherWrapper.Current();

                // throttled calculate event
                _throttleHelper = new EventThrottleHelper();
                _throttleHelper.ThrottledEvent += delegate { Calculate(); };
                _throttleHelper.Throttle        = 1000;

                // handle click
                element.Click += new Common.WeakReference <NavButtonBehavior, object, RoutedEventArgs>(this)
                {
                    EventAction  = (i, s, e) => Element_Click(s, e),
                    DetachAction = (i, w) => element.Click -= w.Handler,
                }.Handler;
                CalculateThrottled();
                BootStrapper.Current.ShellBackButtonUpdated += Current_ShellBackButtonUpdated;
            }
        }
Esempio n. 2
0
 public NavButtonBehavior()
 {
     _dispatcher     = Common.DispatcherWrapper.Current();
     _throttleHelper = new EventThrottleHelper {
         Throttle = 1000
     };
 }
 public NavButtonBehavior()
 {
     if (!Windows.ApplicationModel.DesignMode.DesignModeEnabled)
     {
         _dispatcher     = Common.DispatcherWrapper.Current();
         _throttleHelper = new EventThrottleHelper {
             Throttle = 1000
         };
     }
 }
Esempio n. 4
0
 public void Detach()
 {
     _throttleHelper = null;
     if (Frame != null)
     {
         Frame.SizeChanged   -= SizeChanged;
         Frame.LayoutUpdated -= LayoutUpdated;
     }
     UnregisterPropertyChangedCallback(Frame.CanGoBackProperty, _goBackReg);
     UnregisterPropertyChangedCallback(Frame.CanGoForwardProperty, _goForwardReg);
 }
Esempio n. 5
0
 public void Detach()
 {
     _throttleHelper = null;
     if (Frame != null)
     {
         Frame.SizeChanged   -= SizeChanged;
         Frame.LayoutUpdated -= LayoutUpdated;
     }
     UnregisterPropertyChangedCallback(Frame.CanGoBackProperty, _goBackReg);
     UnregisterPropertyChangedCallback(Frame.CanGoForwardProperty, _goForwardReg);
     BootStrapper.Current.ShellBackButtonUpdated += Current_ShellBackButtonUpdated;
 }
 public ThrottledEventTriggerBehavior()
 {
     throttleHelper = new EventThrottleHelper();
     throttleHelper.ThrottledEvent += ThrottleHelperOnThrottledEvent;
 }