public MainWindow() { var kernel = KernelConstructor.GetKernel(); _main = kernel.Get <Main.Main>(); _main.Output += Main_Output; _main.ExposureTimeCalculated += _main_ExposureTimeCalculated; Arguments = new ApplicationArguments { MeasurementsNrOfRows = 7, MeasurementsNrOfColumns = 12, High = byte.MaxValue, Low = 175, LcdWidth = 2560, LcdHeight = 1440, DesiredResistance = 8820, FileType = ImageFileType.Png.ToString(), OriginalExposureTime = 8000 }; InitializeComponent(); var releaseManager = kernel.Get <IReleaseManager>(); CheckForUpdateComponent = new CheckForUpdate(releaseManager, this); CheckForUpdateComponent.PropertyChanged += CheckForUpdateComponent_PropertyChanged; Loaded += (sender, args) => CheckForUpdateComponent.Check(); }
private static Main GetMain(IErrorReportCreator errorReportCreator = null) { var kernel = KernelConstructor.GetKernel(); if (errorReportCreator != null) { kernel.Unbind <IErrorReportCreator>(); kernel.Bind <IErrorReportCreator>().ToConstant(errorReportCreator); } return(kernel.Get <Main>()); }
public void KernelHasAllRequiredBindingsThatCanBeResolved() { //Given var expectedResolvableTypes = new List <Type> { typeof(ErrorReportConfiguration), typeof(GitHubRepoInfo), typeof(IArgumentsParser), typeof(IBitmapProcessor), typeof(IDateTimeWorker), typeof(ICloner), typeof(IErrorReportCreator), typeof(IErrorReportReporter), typeof(IExposureTimeCalculator), typeof(IFileSystemWatcher), typeof(IGenericGridLoader <int>), typeof(IGenericLoader <Measurement>), typeof(IGitHubIssueCreator), typeof(IIssuesClient), typeof(IMaskIntensityResistanceInterpolatorFactory), typeof(IMeasurementGridProcessor), typeof(IOutputWriter), typeof(IReleaseManager), typeof(IReleasesClient) }; //When var kernel = KernelConstructor.GetKernel(); //Then var error = false; foreach (var type in expectedResolvableTypes) { try { kernel.Get(type); } catch (ActivationException ex) { error = true; Console.WriteLine($"Could not resolve an instance for type '{type.FullName}' due to an exception:\r\n" + $"{ex.Message}"); } } error.Should().BeFalse(); }
static void Main(string[] args) { HandleException(() => { System.Console.WriteLine("CreateMask - https://github.com/Devoney/CreateMask"); System.Console.WriteLine("Contact developer: [email protected]"); System.Console.WriteLine("April 2018"); System.Console.WriteLine(""); var kernel = KernelConstructor.GetKernel(); var main = kernel.Get <Main.Main>(); var argumentsParser = kernel.Get <IArgumentsParser>(); argumentsParser.Output += Main_Output; var arguments = argumentsParser.Parse(args, main.SupportedFileTypes); if (arguments != null) { main.Output += Main_Output; main.CreateMask(arguments); } }); System.Console.WriteLine("Press any key to exit."); System.Console.ReadKey(); }