Beispiel #1
0
        public LinePractice(int selectedIndex, song Song)
        {
            InitializeComponent();

            this.Song = Song;
            Thread t = new Thread(StopListenning);

            SoundCapture.SoundCaptureDevice device = null;
            SelectDeviceForm form = new SelectDeviceForm();

            device             = form.SelectedDevice;
            this.selectedIndex = selectedIndex;
            Clear();
            t.Start();
            bool finished = t.Join(TimeSpan.FromMilliseconds(300));

            if (!finished)
            {
                t.Abort();
            }

            if (device != null)
            {
                StartListenning(device);
            }
            Song.btn_LinePractice.Focus();
        }
Beispiel #2
0
        public CodePractice()
        {
            InitializeComponent();
            Thread t = new Thread(StopListenning);

            SoundCapture.SoundCaptureDevice device = null;
            SelectDeviceForm form    = new SelectDeviceForm();
            Random           ranNote = new Random();
            Image            img_C   = new Image();
            BitmapImage      bi3     = new BitmapImage();



            bi3.BeginInit();
            bi3.UriSource = new Uri("\\처음.png", UriKind.Relative);
            bi3.EndInit();
            img_C.Width   = 400;
            img_C.Height  = 350;
            img_C.Stretch = Stretch.Fill;
            img_C.Source  = bi3;
            TestStack.Children.Add(img_C);
            for (int i = 1; i < 3; i++)
            {
                img_C = new Image();
                bi3   = new BitmapImage();
                int val = ranNote.Next(0, 7);
                stackInfo[i] = val;

                bi3.BeginInit();
                bi3.UriSource = new Uri(NotePath[val], UriKind.Relative);
                bi3.EndInit();
                img_C.Width   = 400;
                img_C.Height  = 350;
                img_C.Stretch = Stretch.Fill;
                img_C.Source  = bi3;
                TestStack.Children.Add(img_C);
            }

            var expand1 = new DoubleAnimation(TestStack.ActualHeight,
                                              350, TimeSpan.FromMilliseconds(500));
            var expand2 = new DoubleAnimation(250, 250, TimeSpan.FromMilliseconds(500));

            TestStack.Children[1].BeginAnimation(StackPanel.HeightProperty, expand1);
            TestStack.Children[0].BeginAnimation(StackPanel.HeightProperty, expand2);
            TestStack.Children[2].BeginAnimation(StackPanel.HeightProperty, expand2);
            //if (form.ShowDialog() == true)
            //{
            //    device = form.SelectedDevice;
            //}
            t.Start();
            bool finished = t.Join(TimeSpan.FromMilliseconds(300));

            if (!finished)
            {
                t.Abort();
            }



            device = form.SelectedDevice;
            if (device != null)
            {
                StartListenning(device);
            }
        }