using DashBoard.View.Dialog;
using DashBoard.ViewModel.Dialog;
using System.Net.Http.Headers;

namespace DashBoard;

[Module(ModuleName = "DashBoard", OnDemand = false)]
public class DashBoardModule : IModule
{
    public DashBoardModule(ICommonContainer commonContainer)
    {
        commonContainer.AddModule("DashBoard");
        ImageSource source = new BitmapImage(new Uri("/DashBoard;component/dashboard.png", UriKind.Relative));
        commonContainer.AddNavigation(new(4, "实时监控", "DashBoard", false, source));
    }

    void IModule.OnInitialized(IContainerProvider containerProvider)
    {
        IRegionManager regionManager = containerProvider.Resolve<IRegionManager>();

        ICommonContainer commonContainer = containerProvider.Resolve<ICommonContainer>();
        regionManager.RegisterViewWithRegion(commonContainer.MainReginName, typeof(DashBoardMain));
    }

    void IModule.RegisterTypes(IContainerRegistry containerRegistry)
    {
        containerRegistry.RegisterForNavigation<DashBoardMain, DashBoardMainViewModel>("DashBoard");
        containerRegistry.RegisterDialog<WarningList, WarningListViewModel>("WarningList");
    }
}
