Exemplo n.º 1
0
        private void SamplesStackPanel_Drop(object sender, DragEventArgs e)
        {
            SampleControl dropsc = e.Source as SampleControl;
            DragData      scdrag = e.Data.GetData("DragData") as DragData;
            SampleControl sc     = scdrag.sampleControl;

            if (dropsc == null)
            {
                SamplesStackPanel.Children.Add(sc);
                SoundEffect.Samples.Add(sc.Sample);
            }
        }
Exemplo n.º 2
0
        private void SamplesStackPanel_DragOver(object sender, DragEventArgs e)
        {
            SampleControl dropsc = e.Source as SampleControl;
            DragData      scdrag = e.Data.GetData("DragData") as DragData;
            SampleControl sc     = scdrag.sampleControl;

            if (dropsc != null && dropsc != sc)
            {
                Int32 dropIndex = dropIndex = SamplesStackPanel.Children.IndexOf(dropsc);

                try
                {
                    scdrag.soundEffectControl.SamplesStackPanel.Children.Remove(sc);
                    scdrag.soundEffectControl.SoundEffect.Samples.Remove(sc.Sample);
                }
                catch (Exception ex)
                {
                    LoopStatus.Text = ex.Message;
                }

                SamplesStackPanel.Children.Insert(dropIndex, sc);
                SoundEffect.Samples.Insert(dropIndex, sc.Sample);
            }
        }
        private void SamplesStackPanel_PreviewMouseMove(object sender, MouseEventArgs e)
        {
            if (e.OriginalSource != ((SampleControl)e.Source).ChannelBG_Copy)
            {
                return;
            }

            if (e.LeftButton == MouseButtonState.Pressed)
            {
                Point currentPosition = e.GetPosition(null);
                Vector dragVector = startPosition - currentPosition;

                if (Math.Abs(dragVector.Length) > 5)
                {
                    SampleControl sampleControl = e.Source as SampleControl;
                    if (sampleControl != null)
                    {
                        DragData dragData = new DragData();
                        dragData.sampleControl = sampleControl;
                        dragData.soundEffectControl = this;

                        DataObject dataObject = new DataObject("DragData", dragData);

                        try
                        {
                            DragDrop.DoDragDrop(sampleControl, dataObject, DragDropEffects.Move);
                        }
                        catch
                        {

                        }
                    }
                }
            }
        }