当前位置: 首页>>代码示例>>C#>>正文


C# IShape.ForEach方法代码示例

本文整理汇总了C#中IShape.ForEach方法的典型用法代码示例。如果您正苦于以下问题:C# IShape.ForEach方法的具体用法?C# IShape.ForEach怎么用?C# IShape.ForEach使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IShape的用法示例。


在下文中一共展示了IShape.ForEach方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        /// <summary>
        /// Application main method.
        /// </summary>
        /// <param name="args">Command line arguments</param>
        static void Main(string[] args)
        {
            CommandLineArguments cArgs = new CommandLineArguments(args);

            Configuration config = new Configuration();

            var something = new Driven.Metrics.DrivenMetrics.Factory().Create(
                 cArgs.Assemblies.ToArray(),
                 config.Container.ResolveAll<IMetricCalculator>() ,
                     "TestReport",
                 config.Container.Resolve<IReport>());

            something.RunAllMetricsAndGenerateReport();

            CodeStadt.Core.DrivenMetrics.Reporting.ResultOutput results = something.Report.As<Core.DrivenMetrics.Reporting.ResultOutput>();

            if (results != null)
            {
                results.Results.ForEach(x =>
                {
                    Console.WriteLine("Metric: {0}".Formatted(x.Name));
                    Console.WriteLine("");

                    x.ClassResults.ForEach(y =>
                    {
                        Console.WriteLine("  Class: {0}".Formatted(y.Name));
                        Console.WriteLine("");
                        y.MethodResults.ForEach(z =>
                        {
                            Console.WriteLine("    Method: {0} \n\r    Result: {1}".Formatted(z.Name, z.Result));
                            Console.WriteLine("");

                        });
                    });
                });
            }

              // Console.ReadLine();

            Console.WriteLine("Going to try and draw an image :-)");

            int screenZ = 49;

            string simpleFileName = "simple.jpg";
            if (File.Exists(simpleFileName)) File.Delete(simpleFileName);

            Bitmap simpleMap = new Bitmap(1000, 1000);

            Graphics simpleImage = Graphics.FromImage(simpleMap);

            //front square
            Coordinate3D coord1 = new Coordinate3D(430, 430, 1);
            Coordinate3D coord2 = new Coordinate3D(480, 430, 1);
            Coordinate3D coord3 = new Coordinate3D(480, 480, 1);
            Coordinate3D coord4 = new Coordinate3D(430, 480, 1);

            //rear square
            Coordinate3D coord11 = new Coordinate3D(450, 450, 2);
            Coordinate3D coord21 = new Coordinate3D(520, 450, 2);
            Coordinate3D coord31 = new Coordinate3D(520, 520, 2);
            Coordinate3D coord41 = new Coordinate3D(450, 520, 2);

            //draw front square
            SimpleDrawer.DrawLine(simpleImage, coord1, coord2, screenZ);
            SimpleDrawer.DrawLine(simpleImage, coord2, coord3, screenZ);
            SimpleDrawer.DrawLine(simpleImage, coord3, coord4, screenZ);
            SimpleDrawer.DrawLine(simpleImage, coord4, coord1, screenZ);

            //draw rear square

            SimpleDrawer.DrawLine(simpleImage, coord11, coord21, screenZ);
            SimpleDrawer.DrawLine(simpleImage, coord21, coord31, screenZ);
            SimpleDrawer.DrawLine(simpleImage, coord31, coord41, screenZ);
            SimpleDrawer.DrawLine(simpleImage, coord41, coord11, screenZ);

            //link front to rear

            SimpleDrawer.DrawLine(simpleImage, coord1, coord11, screenZ);
            SimpleDrawer.DrawLine(simpleImage, coord2, coord21, screenZ);
            SimpleDrawer.DrawLine(simpleImage, coord3, coord31, screenZ);
            SimpleDrawer.DrawLine(simpleImage, coord4, coord41, screenZ);

            simpleMap.Save(simpleFileName, ImageFormat.Jpeg);

            //view point stuff
            //note that the blue square is the back face of the cube

            //some change

            string advancedFileName = "advanced.jpg";
            if (File.Exists(advancedFileName)) File.Delete(advancedFileName);

            Bitmap advancedMap = new Bitmap(1000, 1000);

            Graphics advancedImage = Graphics.FromImage(advancedMap);

//.........这里部分代码省略.........
开发者ID:mikeedwards83,项目名称:CodeStadt,代码行数:101,代码来源:Program.cs


注:本文中的IShape.ForEach方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。