예제 #1
0
        public override void FillControls()
        {
            BeginUpdate();

            // Освобождаем старые контролы
            foreach (Control control in flowLayoutPanel.Controls)
            {
                if (control is AircraftApprovalControl)
                {
                    var c = (AircraftApprovalControl)control;
                    c.Deleted -= Control_Deleted;
                }
            }
            flowLayoutPanel.Controls.Clear();
            flowLayoutPanel.Controls.Add(panel1);

            foreach (var aircraftEquipmet in _aircraft.AircraftEquipments.Where(a => a.AircraftEquipmetType == _aircraftEquipmetType))
            {
                var control = new AircraftApprovalControl();
                control.UpdateControl(_aircraft, aircraftEquipmet);
                control.Deleted += Control_Deleted;

                flowLayoutPanel.Controls.Add(control);
            }

            flowLayoutPanel.Controls.Add(panelAdd);

            EndUpdate();
        }
예제 #2
0
        private void linkLabelAddNew_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            var control      = new AircraftApprovalControl();
            var newEquipment = new AircraftEquipments
            {
                AircraftId             = _aircraft.ItemId,
                AircraftEquipmetType   = _aircraftEquipmetType,
                AircraftOtherParameter = AircraftOtherParameters.Unknown
            };

            control.UpdateControl(_aircraft, newEquipment);
            control.Deleted += Control_Deleted;

            flowLayoutPanel.Controls.Remove(panelAdd);
            flowLayoutPanel.Controls.Add(control);
            flowLayoutPanel.Controls.Add(panelAdd);
        }