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; }
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); }