Files
BeWoPlaner/BeWo/OpenOrSaveDialog.xaml.cs

46 lines
1.4 KiB
C#
Raw Permalink Normal View History

2016-06-27 01:45:38 +02:00
using System;
using System.Windows;
using System.Windows.Input;
namespace BeWo
{
/// <summary>
/// Interaktionslogik für OpenOrSaveDialog.xaml
/// </summary>
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){}
}
}
}