コード例 #1
0
        private void ConditionControlDeleted(object sender, EventArgs e)
        {
            FlightCrewRecordControl control = (FlightCrewRecordControl)sender;
            FlightCrewRecord        cond    = control.FlightCrewRecord;

            if (cond.ItemId > 0 && MessageBox.Show("Do you really want to delete flight crew record?", "Deleting confirmation", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                //если информация о состоянии сохранена в БД
                //и получен положительный ответ на ее удаление
                try
                {
                    GlobalObjects.NewKeeper.Delete(cond);
                }
                catch (Exception ex)
                {
                    Program.Provider.Logger.Log("Error while removing data", ex);
                }

                flowLayoutPanelMain.Controls.Remove(control);
                control.Deleted           -= ConditionControlDeleted;
                control.CrewMemberChanged -= CrewMemberChanged;
                control.Dispose();
                InvokeCrewChanged();
            }
            else if (cond.ItemId <= 0)
            {
                flowLayoutPanelMain.Controls.Remove(control);
                control.Deleted           -= ConditionControlDeleted;
                control.CrewMemberChanged -= CrewMemberChanged;
                control.Dispose();
                InvokeCrewChanged();
            }
        }
コード例 #2
0
ファイル: FlightCrewRecordControl.cs プロジェクト: jecus/Cas
 /// <summary>
 /// Контрол редактирует данные о залитом масле для одного агрегата
 /// </summary>
 public FlightCrewRecordControl(FlightCrewRecord runup)
     : this()
 {
     AttachedObject = runup;
 }