using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Dragablz;
using PDF_Office.Views;
using Prism.Ioc;
using Prism.Regions;

namespace PDF_Office.CustomControl.SystemControl
{
    public class InterTabClient : IInterTabClient
    {
        private IContainerProvider containerProvider;

        public InterTabClient(IContainerProvider container)
        {
            containerProvider = container;
        }

        public INewTabHost<Window> GetNewHost(IInterTabClient interTabClient, object partition, TabablzControl source)
        {
            var view = containerProvider.Resolve<MainWindow>();
            var regionManager = containerProvider.Resolve<IRegionManager>();
            RegionManager.SetRegionManager(view, regionManager);
            RegionManager.UpdateRegions();

            return new NewTabHost<Window>(view, view.TabablzControl);
        }

        public TabEmptiedResponse TabEmptiedHandler(TabablzControl tabControl, Window window)
        {
            return TabEmptiedResponse.CloseWindowOrLayoutBranch;
        }
    }
}
