using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
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.ViewModel;
using MarkOn_Content.Interfaces;
using System.Collections.ObjectModel;
using MarkOn_Content.Models;
using Microsoft.Practices.Prism.Events;
using SimpleMefApplication.Infrastructure;
using System.Runtime.InteropServices;
namespace MarkOn_Content.ViewModels
{
	[Export(typeof(IContentViewModel))]
	[PartCreationPolicy(CreationPolicy.Shared)]
	[ComVisibleAttribute(true)]
	public class ContentViewModel : NotificationObject, IContentViewModel
	{
		private IEventAggregator _eventAggregator;

		public ContentViewModel()
		{

		}

		[ImportingConstructor]
		public ContentViewModel(IEventAggregator eventAggregator)
		{
			_eventAggregator = eventAggregator;
			_eventAggregator.GetEvent<RegionResizingEvent>().Subscribe(GetRegionPoint,ThreadOption.UIThread, true);
		}
		private void GetRegionPoint(RegionPoint rPoint)
		{
			//MessageBox.Show(rPoint.RegionX.ToString() + rPoint.RegionY.ToString());
			RegionX = Convert.ToInt32(rPoint.RegionX);
			RegionY = Convert.ToInt32(rPoint.RegionY);
		}
		public int regionX;
		public int RegionX 
		{
			get
			{
				return regionX;
			}
			set
			{
				if (value != regionX)
				{
					regionX = value;
					this.RaisePropertyChanged("RegionX");
				}
			}
		}
		public int regionY;
		public int RegionY
		{
			get
			{
				return regionY;
			}
			set
			{
				if (value != regionY)
				{
					regionY = value;
					this.RaisePropertyChanged("RegionY");
				}
			}
		}
	}
}