using System;
using System.IO;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Diagnostics;
using System.Globalization;
using System.Windows.Controls;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

using System.Printing;

using agree;

namespace WpfClient
{
	public partial class MainWindow
	{
		private void PrintCommand(object target, ExecutedRoutedEventArgs args)
		{
			AgreeGrammarDocument td = MyDockSite.g_docksite.LastActiveDocument as AgreeGrammarDocument;
			if (td != null)
			{
				PrintDialog pd = new PrintDialog();
				if (pd.ShowDialog() == true)
				{
					td.Print(pd);
				}
			}
		}

		private void OpenFileCommand(object target, ExecutedRoutedEventArgs args)
		{
			Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
			dlg.FileName = "thai.gee";
			dlg.DefaultExt = ".gee";
			dlg.Filter = "Grammar Engineering Script|*.gee|Type Definition Language|*.tdl|All Files|*.*";
			dlg.DereferenceLinks = true;

			Nullable<bool> result = dlg.ShowDialog();

			if (result == true)
			{
				//ExecuteCommand<LoadGrammar>(dlg.FileName);
				new SysCommands.CmdTokLoadGrammar(w.so, dlg.FileName);
			}
		}

		private void SaveCommand(object target, ExecutedRoutedEventArgs args)
		{
		//	Grammar g;// = target as Grammar;

			//g = w.grammars.FirstOrDefault();

		//	if (g != null)
			{
				//ExecuteCommand<SaveGrammarBinary>(g);
				//w.so.Commands.SaveGrammar
			}
		//	else
			{
				//...
			}
		}


	}

}