public IAsyncOperation <ContentDialogResult> ShowAsync(GalleryViewModelBase parameter, Func <FrameworkElement> closing = null) { return(AsyncInfo.Run(async token => { _closing = closing; ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("FullScreenPicture", _closing()); if (_compactLifetime != null) { var compact = _compactLifetime; await compact.Dispatcher.DispatchAsync(() => { compact.Window.Close(); }); _compactLifetime = null; } parameter.Delegate = this; parameter.Items.CollectionChanged -= OnCollectionChanged; parameter.Items.CollectionChanged += OnCollectionChanged; Load(parameter); PrepareNext(0, true); RoutedEventHandler handler = null; handler = new RoutedEventHandler(async(s, args) => { if (_unloaded) { return; } _wasFullScreen = ApplicationView.GetForCurrentView().IsFullScreenMode; Transport.Focus(FocusState.Programmatic); Loaded -= handler; var viewModel = ViewModel; if (viewModel != null) { await viewModel.OnNavigatedToAsync(parameter, NavigationMode.New, null); } }); Loaded += handler; return await ShowAsync(); })); }
public IAsyncOperation <ContentDialogResult> ShowAsync(GalleryViewModelBase parameter, Func <FrameworkElement> closing = null) { return(AsyncInfo.Run(async(token) => { _closing = closing; if (SettingsService.Current.AreAnimationsEnabled) { ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("FullScreenPicture", _closing()); } if (_compactLifetime != null) { var compact = _compactLifetime; await compact.CoreDispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { compact.StopViewInUse(); compact.WindowWrapper.Close(); }); _compactLifetime = null; Dispose(); } parameter.Delegate = this; parameter.Items.CollectionChanged -= OnCollectionChanged; parameter.Items.CollectionChanged += OnCollectionChanged; Load(parameter); PrepareNext(0, true); RoutedEventHandler handler = null; handler = new RoutedEventHandler(async(s, args) => { _wasFullScreen = ApplicationView.GetForCurrentView().IsFullScreenMode; Transport.Focus(FocusState.Programmatic); Loaded -= handler; await ViewModel?.OnNavigatedToAsync(parameter, NavigationMode.New, null); }); Loaded += handler; return await ShowAsync(); })); }
public IAsyncOperation <ContentDialogBaseResult> ShowAsync(GalleryViewModelBase parameter, Func <FrameworkElement> closing) { _closing = closing; //EventHandler handler = null; //handler = new EventHandler((s, args) => //{ // DataContext = null; // Bindings.StopTracking(); // Closing -= handler; // closing?.Invoke(this, args); //}); //Closing += handler; return(ShowAsync(parameter)); }
public IAsyncOperation <ContentDialogBaseResult> ShowAsync(GalleryViewModelBase parameter) { ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("FullScreenPicture", _closing()); DataContext = parameter; Bindings.Update(); RoutedEventHandler handler = null; handler = new RoutedEventHandler(async(s, args) => { Loaded -= handler; await ViewModel.OnNavigatedToAsync(parameter, NavigationMode.New, null); }); Loaded += handler; return(ShowAsync()); }
public IAsyncOperation <ContentDialogBaseResult> ShowAsync(GalleryViewModelBase parameter) { ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("FullScreenPicture", _closing()); parameter.Delegate = this; parameter.Items.CollectionChanged -= OnCollectionChanged; parameter.Items.CollectionChanged += OnCollectionChanged; Load(parameter); PrepareNext(0); RoutedEventHandler handler = null; handler = new RoutedEventHandler(async(s, args) => { Loaded -= handler; await ViewModel?.OnNavigatedToAsync(parameter, NavigationMode.New, null); }); Loaded += handler; return(ShowAsync()); }