using Microsoft.Practices.Composite.Regions;
using Microsoft.Practices.ServiceLocation;
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 Telerik.Windows.Controls;

namespace ModuleB
{
	public partial class Pane4 
	{
		public Pane4()
		{
			InitializeComponent();
		}

        private void Activate(object sender, RoutedEventArgs e)
        {
            var regionManager = ServiceLocator.Current.GetInstance<IRegionManager>();
            foreach(var view in regionManager.Regions["MainRegion"].Views)
            {
                if (view.GetType().Name.Contains("Panel3Vm"))
                {
                    regionManager.Regions["MainRegion"].Activate(view);
                    
                    return;
                }
            }
            regionManager.RegisterViewWithRegion("MainRegion", typeof(Panel3Vm));
        }
    }
}
