using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel.Composition;
using Microsoft.Practices.Prism.Events;
using SimpleMefApplication.Infrastructure;
namespace MarkOn
{
	[Export]
	public partial class Shell : UserControl
	{
		[Import]  
		public IEventAggregator EventAggregator { get; set; }
		public Shell()
		{
			InitializeComponent();
			this.EventAggregator = new EventAggregator();
			Application.Current.Host.Content.Resized += new EventHandler(Content_Resized);
		}

		void Content_Resized(object sender, EventArgs e)
		{
			//MessageBox.Show(String.Format("x: {0} , y : {1}", ContentW.ActualWidth.ToString(), ContentH.ActualHeight.ToString()));
			RegionPoint contentRegion = new RegionPoint { RegionX = Convert.ToInt32(ContentW.ActualWidth), RegionY = Convert.ToInt32(ContentH.ActualHeight) };
			EventAggregator.GetEvent<RegionResizingEvent>().Publish(contentRegion);
		}
	}
}
