private void RootForm_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (MinimizeBox) { return; } e.Cancel = true; var layer = ActiveView.GetModel() as iLayer; if (layer == null) { return; } var panel = ActiveView as IListView; if (panel != null) { panel.Submit(layer.ActionButtons.FirstOrDefault(b => b.Action == Button.ActionType.Submit)); return; } var grid = ActiveView as IGridView; if (grid != null) { grid.Submit(layer.ActionButtons.FirstOrDefault(b => b.Action == Button.ActionType.Submit)); } }