Example #1
0
        public void Attach(DependencyObject associatedObject)
        {
            AssociatedObject = associatedObject;
            _throttleHelper.ThrottledEvent += ThrottleHelperOnThrottledEvent;

            // process start
            if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
            {
                Element.Visibility = Visibility.Visible;
            }
            else
            {
                // handle click
                Element.Click += new Common.WeakReferenceEx <NavButtonBehavior, object, RoutedEventArgs>(this)
                {
                    EventAction  = (i, s, e) => i.Element_Click(s, e),
                    DetachAction = (i, w) => Element.Click -= w.Handler,
                }.Handler;
                CalculateThrottled();


                // TODO: critical!
                // if (Locator.BootStrapper.Instance != null) Locator.BootStrapper.Instance.ShellBackButtonUpdated += Current_ShellBackButtonUpdated;


                _deviceUtils = DeviceUtils.Current(WindowExManager.Current());
                if (_deviceUtils != null)
                {
                    _deviceUtils.Changed += DispositionChanged;
                }
            }
        }
Example #2
0
 public void Attach(DependencyObject associatedObject)
 {
     AssociatedObject = associatedObject;
     _dispatcher      = WindowExManager.Current().Dispatcher;
     Central.Messenger.Subscribe <Messages.BackRequestedMessage>(this, e =>
     {
         Interaction.ExecuteActions(AssociatedObject, Actions, null);
     });
 }
Example #3
0
 public NavButtonBehavior()
 {
     if (!Windows.ApplicationModel.DesignMode.DesignModeEnabled)
     {
         _dispatcher     = WindowExManager.Current().Dispatcher;
         _throttleHelper = new EventThrottleHelper {
             Throttle = 1000
         };
     }
 }
 public void Attach(DependencyObject associatedObject)
 {
     AssociatedObject = associatedObject;
     _deviceUtils     = DeviceUtils.Current(WindowExManager.Current());
     if (_deviceUtils != null)
     {
         _deviceUtils.Changed += DeviceDispositionBehavior_Changed;
     }
     Update();
     _ready = true;
 }
Example #5
0
 internal NavigationService()
 {
     Window = WindowExManager.Current();
 }
        private void Update()
        {
            var w = WindowExManager.Current();
            var d = DeviceUtils.Current(w);

            switch (d.DeviceDisposition())
            {
            case DeviceUtils.DeviceDispositions.IoT: if (IoT)
                {
                    Run();
                }
                break;

            case DeviceUtils.DeviceDispositions.Xbox: if (Xbox)
                {
                    Run();
                }
                break;

            case DeviceUtils.DeviceDispositions.Team: if (Team)
                {
                    Run();
                }
                break;

            case DeviceUtils.DeviceDispositions.HoloLens: if (HoloLens)
                {
                    Run();
                }
                break;

            case DeviceUtils.DeviceDispositions.Desktop: if (Desktop)
                {
                    Run();
                }
                break;

            case DeviceUtils.DeviceDispositions.Mobile: if (Mobile)
                {
                    Run();
                }
                break;

            case DeviceUtils.DeviceDispositions.Phone: if (Phone)
                {
                    Run();
                }
                break;

            case DeviceUtils.DeviceDispositions.Continuum: if (Continuum)
                {
                    Run();
                }
                break;

            case DeviceUtils.DeviceDispositions.Virtual: if (Virtual)
                {
                    Run();
                }
                break;
            }
        }