using System; using System.Windows; using System.Windows.Input; namespace BeWo { /// /// Interaktionslogik für OpenOrSaveDialog.xaml /// public partial class OpenOrSaveDialog : Window { public bool? Selection; private string _Question; public string Question { get { return _Question; } set { _Question = string.Format("Möchten Sie die Datei \"{0}\" öffnen oder speichern?", value); } } public OpenOrSaveDialog(string fileName) { InitializeComponent(); InitCommandBindings(); Owner = GetWindow(BeWoApp.MainControl.ActiveView); Question = fileName; DataContext = this; } private void InitCommandBindings() { CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (s, e) => { Selection = null; Close(); })); CommandBindings.Add(new CommandBinding(ApplicationCommands.Open, (s, e) => { Selection = false; Close(); })); CommandBindings.Add(new CommandBinding(ApplicationCommands.Save, (s, e) => { Selection = true; Close(); })); } private void UIElement_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { try { DragMove(); } catch (Exception){} } } }