Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. public static class Popper
  2. {
  3. public async static Task Pop (string message, AbsoluteLayout attachLayout, int showforMilliseconds = 1500)
  4. {
  5. var container = new StackLayout
  6. {
  7. HorizontalOptions = LayoutOptions.Center,
  8. VerticalOptions = LayoutOptions.Center,
  9. BackgroundColor = Color.FromHex ("#DDEFEFEF"),
  10. Padding = 10
  11.  
  12. };
  13.  
  14. var label = new Label
  15. {
  16. Text = message,
  17. FontAttributes = FontAttributes.Bold,
  18. Style = (Style)Application.Current.Resources["PopupText"]
  19. };
  20.  
  21. container.Children.Add (label);
  22.  
  23. container.Scale = 0;
  24. container.Opacity = 0;
  25.  
  26. attachLayout.Children.Add (container, attachLayout.Bounds, AbsoluteLayoutFlags.PositionProportional);
  27. container.ScaleTo (1.0f, 100);
  28. container.FadeTo (1.0f, 100);
  29.  
  30. await Task.Delay (showforMilliseconds);
  31.  
  32. container.ScaleTo (0.0f, 250);
  33. await container.FadeTo (0.0f, 250);
  34.  
  35. attachLayout.Children.Remove (container);
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement