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


C# ActorSystem.Dispose方法代码示例

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


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

示例1: Main

        static void Main(string[] args)
        {
            ResizerActors = ActorSystem.Create("ResizerActors");
            var commanderActor = ResizerActors.ActorOf(Props.Create(() => new CommanderActor()));

               var imagePath = args[0];

            var profileDictionary = new Dictionary<string, int>
            {
                { "Icon-40.png", 40 },
                { "Icon-40-2x.png", 80 },
                { "Icon-60.png", 60 },
                { "Icon-60-2x.png", 60 },
                {"Icon-72.png",72},
                {"Icon-72-2x.png",144},
                {"Icon-76.png",76},
                {"Icon-76-2x.png", 152},
                {"Icon-Small-50.png", 50},
                { "Icon-Small-50-2x.png", 100},
                { "Icon-Small.png", 29},
                { "Icon-Small-2x.png", 58},
                { "Icon.png", 57},
                { "Icon-2x.png", 114},
                { "iTunesArtwork.png", 512},
                { "iTunesArtwork-2x.png", 1024},
                { "Icon-16.png", 16},
                { "Icon-24.png", 24},
                { "Icon-32.png", 32},
                { "Icon-64.png", 64},
                { "Icon-120.png", 120},
                { "Icon-152.png", 152},
                { "Icon-Small-40.png", 40},
                { "Icon-Small-40-2x.png", 80},
                { "Icon-60-3x.png", 180},
                { "Icon-Small-3x.png", 87},
                { "Icon-Small-40-3x.png", 120}
            };
            //var allTasks = profileDictionary.Keys.Select(key =>
            //{
            //    return Task<Tuple<string, Stream>>.Factory.StartNew(() => Save(new Bitmap(imagePath), profileDictionary[key], profileDictionary[key], 1, key));
            //});

            //Task.WaitAll(allTasks.ToArray());

            //var results = allTasks.Select(x => x.Result).ToArray();

            //CreateToMemoryStream(results, "test.zip");

            byte[] originalImage;
            using (var fs = File.OpenRead(imagePath))
            {
                originalImage = new byte[fs.Length];
                fs.Read(originalImage, 0, (int)fs.Length);
            }

            //coordinatorActor.Tell(new CoordinatorActor.ResizeImage(originalImage, profileDictionary, "test.zip"));
            var command = Console.ReadLine();
            while(command == "")
            {
                //Task.Run(() => {
                //    Parallel.For(0, 10, index => {
                //        //var coordinatorActor = ResizerActors.ActorOf(Props.Create(() => new CoordinatorActor()));
                //        commanderActor.Tell(new CoordinatorActor.ResizeImage(originalImage, profileDictionary, string.Format("{0}.zip", Guid.NewGuid())));
                //    });
                //});
                commanderActor.Tell(new CoordinatorActor.ResizeImage(originalImage, profileDictionary, string.Format("{0}.zip", Guid.NewGuid())));

                command = Console.ReadLine();
            }

            ResizerActors.Shutdown();
            ResizerActors.Dispose();
        }
开发者ID:BredStik,项目名称:ImageResizer,代码行数:73,代码来源:Program.cs


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