using System.Windows.Media;

namespace DeviceScanner;

[Module(ModuleName = "Scanner", OnDemand = false)]
public class ScannerModule : IModule
{
    public ScannerModule(ICommonContainer commonContainer)
    {
        commonContainer.AddModule("Scanner");
        ImageSource source = new BitmapImage(new Uri("/DeviceScanner;component/Resources/Icon.png", UriKind.Relative));
        commonContainer.AddNavigation(new(3, "添加设备", "Scanner", true, source));
    }

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

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

    void IModule.RegisterTypes(IContainerRegistry containerRegistry)
    {
        containerRegistry.RegisterForNavigation<Scanner, ScannerViewModel>("Scanner");
        containerRegistry.RegisterDialog<CreateDevice, CreateDeviceViewModel>("CreateDevice");

    }
}
