1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using System.Windows;
- using InABox.Core;
- using InABox.Wpf;
- namespace PRSDesktop
- {
- /// <summary>
- /// Interaction logic for RecordSelectionDialog.xaml
- /// </summary>
- public partial class RecordSelectionDialog : ThemableWindow
- {
- public RecordSelectionDialog()
- {
- Selection = Selection.None;
- InitializeComponent();
- CenterWindowOnScreen();
- }
- public Selection Selection { get; set; }
- private void CenterWindowOnScreen()
- {
- var screenleft = Application.Current.MainWindow.Left;
- var screentop = Application.Current.MainWindow.Top;
- var screenWidth = Application.Current.MainWindow.Width;
- var screenHeight = Application.Current.MainWindow.Height;
- var windowWidth = Width;
- var windowHeight = Height;
- Left = screenleft + screenWidth / 2 - windowWidth / 2;
- Top = screentop + screenHeight / 2 - windowHeight / 2;
- }
- public static Selection Execute()
- {
- var form = new RecordSelectionDialog();
- if (form.ShowDialog() == true)
- return form.Selection;
- return Selection.None;
- }
- private void All_Click(object sender, RoutedEventArgs e)
- {
- Selection = Selection.All;
- DialogResult = true;
- Close();
- }
- private void Sel_Click(object sender, RoutedEventArgs e)
- {
- Selection = Selection.Selected;
- DialogResult = true;
- Close();
- }
- }
- }
|