static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var service = new AppServiceBuilder()
                          .Register <MainView>()
                          .AsSingleton()
                          .Service;

            Application.Run(service.Resolve <MainView>());
        }
示例#2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var service = new AppServiceBuilder()
                          .Register <MainView>()
                          .AsSingleton()
                          .Register <Dictionary <string, Type> >()
                          .Returns(s => new Dictionary <string, Type>
            {
                ["Star"]        = typeof(StarDrawable),
                ["Hexagon"]     = typeof(HexagonDrawable),
                ["Twenty Star"] = typeof(TwentyStarDrawable),
                ["Greek Cross"] = typeof(GreekCrossDrawable)
            })
                          .As <IReadOnlyDictionary <string, Type> >()
                          .AsSingleton()
                          .Register <IStateProcessingStrategy <Matrix3x3, int>[]>()
                          .Returns(s => new IStateProcessingStrategy <Matrix3x3, int>[]
            {
                new RotationProcessingStrategy(),
                new ScaleProcessingStrategy(),
                new XShiftProcessingStrategy(),
                new YShiftProcessingStrategy()
            })
                          .AsSingleton()
                          .Register <LoopProcessingStrategy>()
                          .As <IStateValueProcessingStrategy <Bitmap, DrawableBase, (int, int)> >()
                          .AsSingleton()
                          .Register <Bitmap>()
                          .Returns(s => new Bitmap(1080, 617))
                          .AsSingleton()
                          .Service;

            Application.Run(service.Resolve <MainView>());
        }