using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

using agree;
using agree.Wpf.Util;

namespace agree.Wpf
{
	public partial class uc_tfs : UserControl
	{
		public static readonly DependencyProperty TfsControlProperty;

		static uc_tfs()
		{
			{
				FrameworkPropertyMetadata metadata = new FrameworkPropertyMetadata(
					null,
					FrameworkPropertyMetadataOptions.None,
					(dobj, e) =>
					{
						((TfsControl)e.NewValue).Margin = new Thickness(10);
					});

				TfsControlProperty = DependencyProperty.Register("TfsControl", typeof(TfsControl), typeof(uc_tfs), metadata);
			}
		}

		public uc_tfs()
		{
			InitializeComponent();

			TfsControl tc = (TfsControl)this.FindName("tfsc");
			if (tc != null)
				TfsControl = tc;
		}

		public uc_tfs(Tfs te, Tfs highlight)
		{
			InitializeComponent();

			TfsControl tc = (TfsControl)this.FindName("tfsc");
			if (tc != null)
			{
				tc._TfsEdgeHighlight = highlight;
				tc._TfsEdge = te;
				TfsControl = tc;
			}
		}


		public TfsControl TfsControl
		{
			get { return (TfsControl)GetValue(TfsControlProperty); }
			set { SetValue(TfsControlProperty, value); }
		}

		public void Print(PrintDialog pd)
		{
			TfsControl.Print(pd);
		}

		protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
		{
			TfsControl.host.UpdateLayout();
			Debug.WriteLine("TfsScrollControl.omlbd {0} {1} {2}", e.Source, e.OriginalSource, e.GetPosition(this));
			//base.OnMouseLeftButtonDown(e);
		}
#if false
		protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters)
		{
			Debug.WriteLine("TfsScrollControl.htc {0}", hitTestParameters.HitPoint);
			return base.HitTestCore(hitTestParameters);
		}
#endif

	};

}