Beispiel #1
0
 private bool IsTimePointTimeInUsing(List <TimePoint> timePoints, TimePoint currentTimePoint)
 {
     foreach (var time in timePoints)
     {
         if (time.Time == currentTimePoint.Time)
         {
             return(false);
         }
     }
     return(true);
 }
Beispiel #2
0
 private void moveUpButton_Click(object sender, EventArgs e)
 {
     if (listBox.SelectedIndex > 0)
     {
         TimePoint timePoint = _timePoints[listBox.SelectedIndex];
         _timePoints[listBox.SelectedIndex]     = _timePoints[listBox.SelectedIndex - 1];
         _timePoints[listBox.SelectedIndex - 1] = timePoint;
         UpdateListbox();
         listBox.SelectedIndex--;
     }
 }
Beispiel #3
0
 private void moveDownButton_Click(object sender, EventArgs e)
 {
     if (listBox.SelectedIndex < _timePoints.Count - 1)
     {
         TimePoint timePoint = _timePoints[listBox.SelectedIndex];
         _timePoints[listBox.SelectedIndex]     = _timePoints[listBox.SelectedIndex + 1];
         _timePoints[listBox.SelectedIndex + 1] = timePoint;
         UpdateListbox();
         listBox.SelectedIndex++;
     }
 }
Beispiel #4
0
        public int CompareTo(object obj)
        {
            TimePoint point = (TimePoint)obj;

            if (this.Time > point.Time)
            {
                return(1);
            }
            if (this.Time < point.Time)
            {
                return(-1);
            }
            return(0);
        }
Beispiel #5
0
        private void addButton_Click(object sender, EventArgs e)
        {
            string description = descriptionTextBox.Text.Trim();

            if (description == "")
            {
                description = "Without Description";
            }

            long  timeToSeconds = TimeToSeconds((int)hrsNumeric.Value, (int)minNumeric.Value, (int)secNumeric.Value);
            Point point         = new Point((int)xNumeric.Value, (int)yNumeric.Value);

            TimePoint timePoint = new TimePoint(new DateTime().AddSeconds(timeToSeconds), point, description);

            if (IsTimePointTimeInUsing(_timePoints, timePoint))
            {
                _timePoints.Add(timePoint);
                UpdateListbox();
            }
        }