DialogBox.xaml.cs (2414B)
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Net; 5 using System.Windows; 6 using System.ComponentModel; 7 using Windows.UI.Xaml.Controls; 8 using Windows.UI.Xaml; 9 using File360; 10 using Windows.UI.Xaml.Controls.Primitives; 11 12 namespace File360 13 { 14 public sealed partial class DialogBox : UserControl 15 { 16 public DialogBox() 17 { 18 InitializeComponent(); 19 Loaded += DialogBox_Loaded; 20 heading.FontSize = Window.Current.Bounds.Width / 20; 21 dialogDetails.FontSize = Window.Current.Bounds.Width / 30; 22 leftButton.FontSize = Window.Current.Bounds.Width / 35; 23 rightButton.FontSize = Window.Current.Bounds.Width / 35; 24 } 25 26 void DialogBox_Loaded(object sender, RoutedEventArgs e) 27 { 28 29 } 30 public string HeadingText 31 { 32 get { return heading.Text; } 33 set { heading.Text = value; } 34 } 35 public string ContentText 36 { 37 get { return dialogDetails.Text; } 38 set { dialogDetails.Text = value; } 39 } 40 public string LeftButtonContent 41 { 42 get { return leftButton.Content.ToString(); } 43 set { leftButton.Content = value; } 44 } 45 public string RightButtonContent 46 { 47 get { return rightButton.Content.ToString(); } 48 set { rightButton.Content = value; } 49 } 50 public RoutedEventHandler LeftButtonHandler 51 { 52 get { return leftButton_Click; } 53 set { leftButton.Click += value; } 54 } 55 56 private void rightButton_Click(object sender, RoutedEventArgs e) 57 { 58 IsOpen = false; 59 } 60 61 private void leftButton_Click(object sender, RoutedEventArgs e) 62 { 63 IsOpen = false; 64 } 65 public bool IsOpen 66 { 67 get 68 { 69 if (Height == 0) 70 { 71 return false; 72 } 73 else 74 { 75 return true; 76 } 77 } 78 set 79 { 80 if (value == true) 81 { 82 Height = Window.Current.Bounds.Height; 83 } 84 if (value == false) 85 { 86 Height = 0; 87 } 88 } 89 } 90 } 91 }