Exemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        public int GetIndexOfLastBoundaryBeforeTime(TimeSpan time)
        {
            var segs = SegmentBoundaries.ToArray();

            for (var i = segs.Length; i >= 0; i--)
            {
                if (time >= segs[i])
                {
                    return(i);
                }
            }

            return(-1);
        }
Exemplo n.º 2
0
        /// ------------------------------------------------------------------------------------
        protected override void OnBoundaryMouseDown(int mouseX, TimeSpan boundaryClicked,
                                                    int indexOutOfBoundaryClicked)
        {
            var boundaries = SegmentBoundaries.ToArray();

            var startTime = (indexOutOfBoundaryClicked == 0 ? TimeSpan.Zero :
                             boundaries.ElementAt(indexOutOfBoundaryClicked - 1));

            MyPainter.SetSelectionTimes(startTime, boundaryClicked);

            _selectionColorsToLeftOfMovingBoundary = MyPainter.GetColorsOfAreaEndingAtTime(boundaryClicked);
            System.Diagnostics.Debug.Write("OnBoundaryMouseDown: Left colors = ");
            foreach (var color in _selectionColorsToLeftOfMovingBoundary)
            {
                System.Diagnostics.Debug.Write(color + "; ");
            }
            System.Diagnostics.Debug.WriteLine("");

            if (indexOutOfBoundaryClicked >= boundaries.Length - 1)
            {
                _selectionColorsToRightOfMovingBoundary = null;
            }
            else
            {
                _selectionColorsToRightOfMovingBoundary = MyPainter.GetColorsOfAreaStartingAtTime(boundaryClicked);
                _boundaryToRightOfMovingBoundary        = SegmentBoundaries.ElementAt(indexOutOfBoundaryClicked + 1);

                System.Diagnostics.Debug.Write("OnBoundaryMouseDown: Right colors = ");
                foreach (var color in _selectionColorsToRightOfMovingBoundary)
                {
                    System.Diagnostics.Debug.Write(color + "; ");
                }
                System.Diagnostics.Debug.WriteLine("");
            }
            base.OnBoundaryMouseDown(mouseX, boundaryClicked, indexOutOfBoundaryClicked);
        }