private async void ShowPopupControl(object sender, RoutedEventArgs e) { var g = PopupPresenterHost.ShowPopupControl(typeof(ListPage2)); await Task.Delay(1000); PopupPresenterHost.HidePopupControl(g); }
private async void ShowPopupControlAnimation(object sender, RoutedEventArgs e) { var g = await PopupPresenterHost.ShowPopupControlAsync(typeof(ListPage2), ShowAnimationMode : PopupControlAnimationKind.SlideUp, HideAnimationMode : PopupControlAnimationKind.SlideUp); await PopupPresenterHost.HidePopupControlAsync(g); }
private async void App_UnhandledException(object sender, UnhandledExceptionEventArgs e) { var ex = e.Exception; e.Handled = true; await PopupPresenterHost.ShowMessageBoxAsync("{ex.Message}{Environment.NewLine}{ex.StackTrace}"); //await new MessageDialog($"{ex.Message}{Environment.NewLine}{ex.StackTrace}").ShowAsync(); }
/// <summary> /// Hides the popup on tapping outside of the popup /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void LightDismissArea_Tapped(object sender, TappedRoutedEventArgs e) { var p = e.GetPosition(_popup); if (LightDismissEnabled) { if (p.Y < 0 || p.X < 0 || (!double.IsNaN(PopupWidth) && p.X > PopupWidth)) { await PopupPresenterHost.HideSlideupPopupAsync(this); } } }
private async void Page_Loaded(object sender, RoutedEventArgs e) { if (CoreApplication.Views.Count > 1) { return; } var view = CoreApplication.CreateNewView(); int id = 0; await view.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { var frame = new Frame(); frame.Navigate(typeof(MainPage)); var pph = new PopupPresenterHost(); pph.Children.Add(frame); pph.Id = Guid.NewGuid().ToString(); pph.Tag = pph.Id; Window.Current.Content = pph; var nav = SystemNavigationManager.GetForCurrentView(); nav.BackRequested += (sfb, sfe) => { if (frame.CanGoBack) { frame.GoBack(); } sfe.Handled = true; }; frame.Navigated += (sf1, sf2) => { if (frame.CanGoBack) { nav.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; } else { nav.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; } }; view.CoreWindow.KeyDown += (s1, e1) => { if (e1.VirtualKey == Windows.System.VirtualKey.Escape) { if (frame.CanGoBack) { frame.GoBack(); } } e1.Handled = true; }; Window.Current.Activate(); id = ApplicationView.GetForCurrentView().Id; }); await ApplicationViewSwitcher.TryShowAsStandaloneAsync(id); }
private async void SampleDeleteMessageBox(object sender, RoutedEventArgs e) { await PopupPresenterHost.ShowMessageBoxAsync("Are you sure you want to delete?", Title : "Delete File?", Commands : new MessageBoxCommand[] { new MessageBoxCommand("Delete", "\uE74D", async() => { await new MessageDialog("Success message.").ShowAsync(); }) { Background = new SolidColorBrush(Colors.Red), BorderBrush = new SolidColorBrush(Colors.Red), Foreground = new SolidColorBrush(Colors.White) }, new MessageBoxCommand("Cancel", "\uE10A") { Foreground = new SolidColorBrush(Colors.White) } }); }
private async void SampleCopyFileMessageBox(object sender, RoutedEventArgs e) { await PopupPresenterHost.ShowMessageBoxAsync("Another file with the same name found, How to continue?", Title : "Copy failure", Commands : new MessageBoxCommand[] { new MessageBoxCommand("Rename file", "\uE13E", async() => { await new MessageDialog("File renamed and copied.").ShowAsync(); }) { Background = new SolidColorBrush(Colors.Red), BorderBrush = new SolidColorBrush(Colors.Red), Foreground = new SolidColorBrush(Colors.White) }, new MessageBoxCommand("Replace", "\uE19C", async() => { await new MessageDialog("File replaced.").ShowAsync(); }) { Foreground = new SolidColorBrush(Colors.White) }, new MessageBoxCommand("Cancel", "\uE10A") }); }
/// <summary> /// This event will complete the manipulation of the user. This will completes hide or reverts the slidedown /// </summary> /// <param name="sender">Not important</param> /// <param name="e">Not important</param> private async void _popup_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e) { if (outofrangeslide) { return; } var Host = (FrameworkElement)this.Parent; if (e.Cumulative.Translation.Y > 50) { (HidePopupStoryboard.Children[0] as DoubleAnimation).To = Host.ActualHeight; (HidePopupStoryboard.Children[1] as DoubleAnimation).To = 0; await HidePopupStoryboard.BeginAsync(); await PopupPresenterHost.HideSlideupPopupAsync(this); } else { await ShowPopupStoryboard.BeginAsync(); } }
private async void ShowLongTextMessageBox(object sender, RoutedEventArgs e) { var msg = await FileIO.ReadTextAsync(await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///DemoContent/LoremIpsum.txt", UriKind.RelativeOrAbsolute))); await PopupPresenterHost.ShowMessageBoxAsync(msg, Title : "Lorem Ipsum"); }
private async void ShowShortTextMessageBox(object sender, RoutedEventArgs e) { await PopupPresenterHost.ShowMessageBoxAsync("This is a short message text sample.", Title : "Test Title"); }
private void ShowPopupControlCustomClose(object sender, RoutedEventArgs e) { var g = PopupPresenterHost.ShowPopupControl(typeof(ListPage2)); }
private async void ShowPopupControlAsync(object sender, RoutedEventArgs e) { var g = await PopupPresenterHost.ShowPopupControlAsync(typeof(ListPage2)); PopupPresenterHost.HidePopupControl(g); }
private async void ShowSlideupPopupHeight200Async(object sender, RoutedEventArgs e) { var g = await PopupPresenterHost.ShowSlideupPopupAsync(typeof(ListPage), 300); await new MessageDialog(g.ToString()).ShowAsync(); }
private void ShowSlideupPopupHeight200(object sender, RoutedEventArgs e) { var g = PopupPresenterHost.ShowSlideupPopup(typeof(ListPage), 300); }
private void ShowSlideupPopupNormalSize(object sender, RoutedEventArgs e) { var g = PopupPresenterHost.ShowSlideupPopup(typeof(ListPage)); }
private void Hide_Click(object sender, RoutedEventArgs e) { PopupPresenterHost.HidePopupControl(this); }