void window_FormClosing(object sender, FormClosingEventArgs e) { LimitWindow window = (LimitWindow)sender; if (window.IsValid) { btnSend.Enabled = true; minTempLimit = window.GetTemp(LimitWindow.TempType.MIN); maxTempLimit = window.GetTemp(LimitWindow.TempType.MAX); } }
private void btnLimits_Click(object sender, EventArgs e) { List <string> names = DeviceManager.GetNames(); List <LimitTempModel> models = (views == null) ? LimitTempModel.Create(names) : LimitTempModel.Create(names, views.ConvertAll(view => view.Model)); views = LimitTempView.Create(models); LimitWindow window = new LimitWindow(views, minTempLimit, maxTempLimit); window.FormClosing += window_FormClosing; window.ShowDialog(); }