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 MarkOn_Favorite.Interfaces;
using System.ComponentModel.Composition;
using System.Runtime.InteropServices;
using Microsoft.Practices.Prism.ViewModel;
using Microsoft.Practices.Prism.Events;
using SimpleMefApplication.Infrastructure;

namespace MarkOn_Favorite.ViewModels
{
	[Export(typeof(IFavoriteViewModel))]
	[PartCreationPolicy(CreationPolicy.Shared)]
	[ComVisibleAttribute(true)]
	public class FavoriteViewModel : NotificationObject, IFavoriteViewModel
	{
		private IEventAggregator _eventAggregator;

		public FavoriteViewModel()
		{

		}

		[ImportingConstructor]
		public FavoriteViewModel(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());
			RegionY = Convert.ToInt32(rPoint.RegionY);
		}

		public int regionY;
		public int RegionY
		{
			get
			{
				return regionY;
			}
			set
			{
				if (value != regionY)
				{
					regionY = value-50;
					this.RaisePropertyChanged("RegionY");
				}
			}
		}
	}
}