Choreoh.MainWindow.waveform_Clicked C# (CSharp) Метод

waveform_Clicked() приватный Метод

private waveform_Clicked ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Результат void
        private void waveform_Clicked(object sender, EventArgs e)
        {
            HoverButton waveButton = (HoverButton)sender;
            Point handPosition = hand.TransformToAncestor(containerCanvas).Transform(new Point(0, 0));
            Debug.WriteLine("WAVEFORM WAS CLICKED!");

            if (isSelectingStartSegment)
            {
                double handX = hand.TransformToAncestor(containerCanvas).Transform(new Point(0, 0)).X;
                handX = handX + hand.ActualWidth / 2;
                double timelineX = Canvas.GetLeft(timelineCanvas);
                double pixelsIntoWaveform = -1 * timelineX + handX;
                startSecondsIntoWaveform = (pixelsIntoWaveform - 8) / waveform.getPixelsPerSecond();
                isSelectingStartSegment = false;
                isSelectingEndSegment = true;
                makeSelectionPrompt.Visibility = Visibility.Collapsed;
                makeEndSelectionPrompt.Visibility = Visibility.Visible;
                waveform.selectStart(startSecondsIntoWaveform);
            }
            else if (isSelectingEndSegment)
            {
                double handX = hand.TransformToAncestor(containerCanvas).Transform(new Point(0, 0)).X;
                handX = handX + hand.ActualWidth / 2;
                double timelineX = Canvas.GetLeft(timelineCanvas);
                double pixelsIntoWaveform = -1 * timelineX + handX;
                endSecondsIntoWaveform = (pixelsIntoWaveform - 8) / waveform.getPixelsPerSecond();
                if (endSecondsIntoWaveform > startSecondsIntoWaveform)
                {
                    waveform.selectEnd(endSecondsIntoWaveform);
                }
                isSelectingEndSegment = false;

                if (isSelectingRecordSegment)
                {
                    Canvas.SetZIndex(timelineCanvas, oldButtonZIndex);
                    blackBack.Visibility = Visibility.Collapsed;
                    //bring up start recording dialog
                    isSelectingRecordSegment = false;
                    makeEndSelectionPrompt.Visibility = Visibility.Collapsed;
                    recordSegment();
                    cancelActionCanvas.Visibility = Visibility.Collapsed;
                }
                else if (isSelectingPlaySegment)
                {
                    Canvas.SetZIndex(timelineCanvas, oldButtonZIndex);
                    blackBack.Visibility = Visibility.Collapsed;
                    playSegment();
                    isSelectingPlaySegment = false;
                    makeEndSelectionPrompt.Visibility = Visibility.Collapsed;
                    cancelActionCanvas.Visibility = Visibility.Collapsed;
                }
                else if (isSelectingPlaySongSelection)
                {
                    Canvas.SetZIndex(timelineCanvas, oldButtonZIndex);
                    blackBack.Visibility = Visibility.Collapsed;
                    isSelectingPlaySongSelection = false;
                    makeEndSelectionPrompt.Visibility = Visibility.Collapsed;
                    cancelActionCanvas.Visibility = Visibility.Collapsed;
                    playSongSelection(startSecondsIntoWaveform, endSecondsIntoWaveform);
                }
            }
        }