Esempio n. 1
0
        public override void FinishedLaunching(NSObject notification)
        {
            var module = new Module(this);
            var kernel = new StandardKernel(module);
            var container = kernel.Get<IContainer>();

            mainWindowController = new MainWindowController();
            mainWindowController.Window.MakeKeyAndOrderFront(this);

            var vertical_box = new VerticalBox();
            var horizontal_box = new HorizontalBox();

            NSButton button;

            button = CreateButton("Model: Utc | View: Digital", delegate
            {
                var view = container.
                    GetView<DigitalDateTimeView>().
                    WithModel<IDateTimeModel>().
                    WithPresenter<IDateTimeView, DateTimePresenter>().
                    ToView();

                vertical_box.AddSubview(view, 100);
                vertical_box.Update();
            });
            horizontal_box.AddSubview(button);

            button = CreateButton("Model: Utc | View: Analog", delegate
            {
                var view = container.
                    GetView<AnalogDateTimeView>().
                    WithModel<IDateTimeModel>().
                    WithPresenter<IDateTimeView, DateTimePresenter>().
                    ToView();

                vertical_box.AddSubview(view, 100);
                vertical_box.Update();
            });
            horizontal_box.AddSubview(button);

            button = CreateButton("Model: Local | View: Digital", (sender, e) =>
            {
                var model = new LocalDateTimeModel();
                var view = container.
                    GetView<DigitalDateTimeView>().
                    WithModel<IDateTimeModel>(model).
                    WithPresenter<IDateTimeView, DateTimePresenter>().
                    ToView();

                vertical_box.AddSubview(view, 100);
                vertical_box.Update();
            });
            horizontal_box.AddSubview(button);

            button = CreateButton("Model: Local | View: Analog", delegate
            {
                var model = new LocalDateTimeModel();
                var view = container.
                    GetView<AnalogDateTimeView>().
                    WithModel<IDateTimeModel>(model).
                    WithPresenter<IDateTimeView, DateTimePresenter>().
                    ToView();

                vertical_box.AddSubview(view, 100);
                vertical_box.Update();
            });
            horizontal_box.AddSubview(button);

            vertical_box.AddSubview(horizontal_box, button.Frame.Height);
            mainWindowController.Window.ContentView = vertical_box;
        }
Esempio n. 2
0
        public override void FinishedLaunching(NSObject notification)
        {
            var module    = new Module(this);
            var kernel    = new StandardKernel(module);
            var container = kernel.Get <IContainer>();

            mainWindowController = new MainWindowController();
            mainWindowController.Window.MakeKeyAndOrderFront(this);

            var vertical_box   = new VerticalBox();
            var horizontal_box = new HorizontalBox();

            NSButton button;

            button = CreateButton("Model: Utc | View: Digital", delegate
            {
                var view = container.
                           GetView <DigitalDateTimeView>().
                           WithModel <IDateTimeModel>().
                           WithPresenter <IDateTimeView, DateTimePresenter>().
                           ToView();

                vertical_box.AddSubview(view, 100);
                vertical_box.Update();
            });
            horizontal_box.AddSubview(button);

            button = CreateButton("Model: Utc | View: Analog", delegate
            {
                var view = container.
                           GetView <AnalogDateTimeView>().
                           WithModel <IDateTimeModel>().
                           WithPresenter <IDateTimeView, DateTimePresenter>().
                           ToView();

                vertical_box.AddSubview(view, 100);
                vertical_box.Update();
            });
            horizontal_box.AddSubview(button);

            button = CreateButton("Model: Local | View: Digital", (sender, e) =>
            {
                var model = new LocalDateTimeModel();
                var view  = container.
                            GetView <DigitalDateTimeView>().
                            WithModel <IDateTimeModel>(model).
                            WithPresenter <IDateTimeView, DateTimePresenter>().
                            ToView();

                vertical_box.AddSubview(view, 100);
                vertical_box.Update();
            });
            horizontal_box.AddSubview(button);

            button = CreateButton("Model: Local | View: Analog", delegate
            {
                var model = new LocalDateTimeModel();
                var view  = container.
                            GetView <AnalogDateTimeView>().
                            WithModel <IDateTimeModel>(model).
                            WithPresenter <IDateTimeView, DateTimePresenter>().
                            ToView();

                vertical_box.AddSubview(view, 100);
                vertical_box.Update();
            });
            horizontal_box.AddSubview(button);

            vertical_box.AddSubview(horizontal_box, button.Frame.Height);
            mainWindowController.Window.ContentView = vertical_box;
        }