Ejemplo n.º 1
0
        public TopController(TopModel model)
        {
            this.model = model;

            this.form = new TopView();
            this.form.Visible = false;
            this.form.HandleDestroyed += delegate(Object sender, EventArgs e) {
                this.FormDestroyed(sender, e);
            };
            this.form.exitButton.Click += delegate(Object sender, EventArgs e) {
                this.form.Close();
            };

            this.form.pinCheckBox.CheckState =
                this.model.Pinned ? CheckState.Checked : CheckState.Unchecked;
            this.form.pinCheckBox.CheckedChanged += delegate(Object sender, EventArgs e) {
                this.model.Pinned = this.form.pinCheckBox.Checked;
            };

            this.form.timeLabel.Text = this.model.Time;

            this.appBar = new AppBar(this.form, !this.model.Pinned);
            this.model.PinnedChange += OnModelPinnedChange;
            this.model.ClockTick += OnClockTick;
            this.model.ScheduleChange += OnScheduleChange;
        }
Ejemplo n.º 2
0
        public void execute()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ApplicationContext appCtx = new ApplicationContext();

            TopModel model = new TopModel();
            TopController topController = new TopController(model);
            topController.FormDestroyed += delegate(Object sender, EventArgs args) {
                appCtx.ExitThread();
            };
            model.InitTimer();

            topController.Show();
            Application.Run(appCtx);
        }