using ConfigOperator;

namespace HistoryUI;

/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : PrismApplication
{
    protected override Window CreateShell()
    {
        return Container.Resolve<MainWindow>();
    }

    protected override void OnStartup(StartupEventArgs e)
    {
        var args = e.Args;
        if (args.Length >= 4)
        {
            StartSetting.StartPixVertical = int.Parse(args[0]);
            StartSetting.StartPixHorizontal = int.Parse(args[1]);
            StartSetting.ResolutionVertical = int.Parse(args[2]);
            StartSetting.ResolutionHorizontal = int.Parse(args[3]);
        }

        if (args.Length >= 5)
        {
            StartSetting.Content = args[4];

        }

        if (args.Length >= 7)
        {
            StartSetting.Mini8Index = byte.Parse(args[5]);
            StartSetting.ChannelIndex = byte.Parse(args[6]);
        }

        base.OnStartup(e);
    }

    protected override void RegisterTypes(IContainerRegistry containerRegistry)
    {
        containerRegistry.RegisterDialogWindow<Window1>();
        containerRegistry.RegisterSingleton<Hardwares>();
        containerRegistry.RegisterSingleton<HardwareFileLoader>();
        containerRegistry.RegisterSingleton<BasicInfo>();
        containerRegistry.RegisterSingleton<IORM, SqlSugarCustom>();
    }
}

public static class StartSetting
{
    public static int StartPixVertical { get; set; }
    public static int StartPixHorizontal { get; set; }

    public static int ResolutionVertical { get; set; }
    public static int ResolutionHorizontal { get; set; }

    public static byte Mini8Index { get; set; }
    public static byte ChannelIndex { get; set; }

    public static string? Content { get; set; }
}