﻿//-----------------------------------------------------------------------
// <copyright file="DocBuilderWindow.xaml.cs" company="James McManus">
//     Copyright (c) James McManus
// </copyright>
//-----------------------------------------------------------------------
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

namespace ReadAlong.Wpf
{
	/// <summary>
	/// Interaction logic for DocBuilderWindow.xaml
	/// </summary>
	public partial class DocBuilderWindow : Window
	{
		private DocBuilderViewModel _vm;

		public DocBuilderWindow(DocBuilderViewModel vm)
		{
			InitializeComponent();

			_vm = vm;
			DataContext = vm;
		}

		private void ScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e)
		{
		}

		private void ForeignPhrasesListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
		{
			Clipboard.SetText(ForeignPhrasesListBox.SelectedItem as string);
		}

		private void EnglishPhrasesListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
		{
			Clipboard.SetText(EnglishPhrasesListBox.SelectedItem as string);
		}

		private void SaveTextButton_Click(object sender, RoutedEventArgs e)
		{
			_vm.SaveText();
		}

		private void SaveButton_Click(object sender, RoutedEventArgs e)
		{
			DialogResult = true;
		}

		private void CancelButton_Click(object sender, RoutedEventArgs e)
		{
			DialogResult = false;
		}
	}
}
