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(WindowEx.Current()); if (_deviceUtils != null) { _deviceUtils.Changed += DispositionChanged; } } }
public void Attach(DependencyObject associatedObject) { AssociatedObject = associatedObject; _dispatcher = WindowEx.Current().Dispatcher; Central.Messenger.Subscribe <Messages.BackRequestedMessage>(this, e => { Interaction.ExecuteActions(AssociatedObject, Actions, null); }); }
public NavButtonBehavior() { if (!Windows.ApplicationModel.DesignMode.DesignModeEnabled) { _dispatcher = WindowEx.Current().Dispatcher; _throttleHelper = new EventThrottleHelper { Throttle = 1000 }; } }
public void Attach(DependencyObject associatedObject) { AssociatedObject = associatedObject; _deviceUtils = DeviceUtils.Current(WindowEx.Current()); if (_deviceUtils != null) { _deviceUtils.Changed += DeviceDispositionBehavior_Changed; } Update(); _ready = true; }
public static void HideBusy() { WindowEx.Current().Dispatcher.Dispatch(() => { var modal = Window.Current.Content as ModalDialog; var view = modal.ModalContent as Busy; if (view != null) { modal.IsModal = view.IsBusy = false; } }); }
private static async Task <T> ShowAsync <T>(Func <Task <T> > show, IDispatcherEx dispatcher) { await _showAsyncSemaphoreSlim.WaitAsync(); try { dispatcher = dispatcher ?? WindowEx.Current().Dispatcher ?? throw new ArgumentNullException(nameof(dispatcher)); return(await dispatcher.DispatchAsync(async() => await show())); } finally { _showAsyncSemaphoreSlim.Release(); } }
// hide and show busy dialog public static void ShowBusyFor(string text = null, int milliseconds = int.MaxValue) { WindowEx.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 = true; view.BusyText = text; }); WindowEx.Current().Dispatcher.Dispatch(() => { HideBusy(); }, milliseconds); }
internal NavigationService() { Window = WindowEx.Current(); }
public void Attach(DependencyObject associatedObject) { AssociatedObject = associatedObject; _dispatcher = WindowEx.Current().Dispatcher; _BackButtonService.BackRequested += BackButtonService_NavigateBack; }
private void Update() { var w = WindowEx.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; } }