コード例 #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.WeakReference <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(WindowWrapperManager.Current());
                if (_deviceUtils != null)
                {
                    _deviceUtils.Changed += DispositionChanged;
                }
            }
        }
コード例 #2
0
        private static async Task <T> ShowAsync <T>(Func <Task <T> > show, IDispatcherWrapper dispatcher)
        {
            lock (DialogState)
            {
                while (DialogState.Showing)
                {
                    Monitor.Wait(DialogState);
                }
                DialogState.Showing = true;
            }

            // this next line creates a dependecy on the WindowService
            dispatcher = dispatcher ?? WindowWrapperManager.Current().Dispatcher;

            dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));

            var result = await dispatcher.DispatchAsync(async() => await show());

            lock (DialogState)
            {
                DialogState.Showing = false;
                Monitor.PulseAll(DialogState);
            }
            return(result);
        }
コード例 #3
0
 // hide and show busy dialog
 public static void SetBusy(bool busy, string text = null)
 {
     WindowWrapperManager.Current().Dispatcher.Dispatch(() =>
     {
         var modal = Window.Current.Content as ModalDialog;
         var view  = modal.ModalContent as Busy;
         if (view == null)
         {
             modal.ModalContent = view = new Busy();
         }
         modal.IsModal = view.IsBusy = busy;
         view.BusyText = text;
     });
 }
コード例 #4
0
 internal NavigationService()
 {
     Window = WindowWrapperManager.Current();
 }
コード例 #5
0
 public static IDispatcherWrapper Current() => WindowWrapperManager.Current().Dispatcher;