private static Bitmap Visualize(CloudOptions cloudOptions) { var width = cloudOptions.Width == 0 ? Screen.PrimaryScreen.Bounds.Width : cloudOptions.Width; var height = cloudOptions.Height == 0 ? Screen.PrimaryScreen.Bounds.Height : cloudOptions.Height; var cloudDesign = new SimpleCloudDesign( Color.FromName(cloudOptions.BackgroundColor), cloudOptions.Font, new SolidBrush(Color.FromName(cloudOptions.FontColor)), new Rectangle(0, 0, width, height)); var builder = new ContainerBuilder(); builder.Register(c => cloudDesign).As <ICloudDesign>(); var shape = new SpiralCloudShape(cloudDesign, cloudOptions.Spreading); builder.Register(s => shape).As <ICloudShape>(); builder.RegisterType <CircularCloudLayouter>().As <IRectangleLayouter>(); builder.RegisterType <TxtTagReader>().As <ITagsReader>(); builder.RegisterType <TagsUnifier>().As <ITagsHandler>(); if (cloudOptions.ForbiddenWords != null) { var filter = new WordsFilter(ReadStringsFromTxt(cloudOptions.ForbiddenWords)); builder.Register(f => filter).As <ITagsHandler>(); } builder.RegisterType <TagsCloudVisualizator>(); var container = builder.Build(); var vizualizator = container.Resolve <TagsCloudVisualizator>(); return(vizualizator.Visualize(cloudOptions.TagsFile)); }
public void SetUp() { var cloudDesign = new SimpleCloudDesign(Color.FromName("White"), "", new SolidBrush(Color.FromName("Black")), screenBounds); layouter = new CircularCloudLayouter(new SpiralCloudShape(cloudDesign)); }