private void AddButtonClick(object sender, EventArgs e)
 {
     var form = new DurationForm(24 * 60 - GetTotalDuration());
     if (form.ShowDialog(this) == DialogResult.Cancel)
         return;
     durationsListBox.Items.Add(String.Format("{0}:{1:D2}", form.Duaration / 60, form.Duaration % 60));
     UpdateDurations();
 }
        private void AddButtonClick(object sender, EventArgs e)
        {
            var form = new DurationForm(24 * 60 - GetTotalDuration());

            if (form.ShowDialog(this) == DialogResult.Cancel)
            {
                return;
            }
            durationsListBox.Items.Add(String.Format("{0}:{1:D2}", form.Duaration / 60, form.Duaration % 60));
            UpdateDurations();
        }
        private void ChangeButtonClick(object sender, EventArgs e)
        {
            var index = durationsListBox.SelectedIndex;

            if (index < 0)
            {
                return;
            }
            var duration = GetDuration(index);
            var form     = new DurationForm(24 * 60 - GetTotalDuration() + duration, duration);

            if (form.ShowDialog(this) == DialogResult.Cancel)
            {
                return;
            }
            durationsListBox.Items[index] = String.Format("{0}:{1:D2}", form.Duaration / 60, form.Duaration % 60);
            UpdateDurations();
        }
 private void ChangeButtonClick(object sender, EventArgs e)
 {
     var index = durationsListBox.SelectedIndex;
     if (index < 0)
         return;
     var duration = GetDuration(index);
     var form = new DurationForm(24 * 60 - GetTotalDuration() + duration, duration);
     if (form.ShowDialog(this) == DialogResult.Cancel)
         return;
     durationsListBox.Items[index] = String.Format("{0}:{1:D2}", form.Duaration / 60, form.Duaration % 60);
     UpdateDurations();
 }