/// <summary> /// Ещё один конструктор /// </summary> /// <param name="myObject"></param> /// <param name="readOnly"></param> public AddForm(ICalories myObject, bool readOnly) { InitializeComponent(); _myObject = myObject; objectControl1.ReadOnly = readOnly; objectControl1.Object = myObject; _addState = false; }
public int CompareTo(ICalories food) { double timeThis = this.getCalorieAbsorptionTime(); double timeAnother = food.getCalorieAbsorptionTime(); if (timeThis == timeAnother) { return(0); } return(timeThis > timeAnother ? 1 : -1); }
/// <summary> /// Метод заполнения текст боксов значениями из _object /// </summary> /// <param name="myObject"></param> private void FillTextBoxes(ICalories myObject) { if (myObject is Press) { _discipline = MainForm.Discipline.Press; firstParameterTextBox.Text = Convert.ToString(((Press) myObject).Weight); secondParameterTextBox.Text = Convert.ToString(((Press) myObject).Times); } if (myObject is Run) { _discipline = MainForm.Discipline.Run; firstParameterTextBox.Text = Convert.ToString(((Run) myObject).Distance); secondParameterTextBox.Text = Convert.ToString(((Run) myObject).Intensivity); } if (myObject is Swim) { _discipline = MainForm.Discipline.Swim; firstParameterTextBox.Text = Convert.ToString(((Swim) myObject).Distance); secondParameterTextBox.Text = Convert.ToString(((Swim) myObject).Style); } disciplineComboBox.SelectedIndex = (int)_discipline; }