Пример #1
0
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            // create the IO object that we represent
            tempestSoundIO = new TDNWin32TempestSoundIO();

            // create our tempest, connected to the IO object
            tempest = new Tempest(tempestSoundIO);

            // see if we're in Demo mode
            if (Environment.CommandLine.ToLower().IndexOf(" demo ") >= 0)
            {
                tempest.SetDemoMode();
            }

            // set it to running
            startTime = DateTime.Now;
            tempest.Start();

            timer           = new DispatcherTimer();
            timer.Interval  = TimeSpan.FromMilliseconds(200);
            timer.IsEnabled = true;
            timer.Tick     += timer_Tick;

            vectorTimer           = new DispatcherTimer();
            vectorTimer.Interval  = TimeSpan.FromMilliseconds(50);
            vectorTimer.IsEnabled = true;
            vectorTimer.Tick     += vectorTimer_Tick;

            spinnerTimer           = new DispatcherTimer();
            spinnerTimer.Interval  = TimeSpan.FromMilliseconds(10);
            spinnerTimer.IsEnabled = true;
            spinnerTimer.Tick     += spinnerTimer_Tick;
        }
Пример #2
0
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                // create the stream object that's going to be in the middle of everything
                tempestMemoryStream = new TDNMemoryStream();

                // create the IO object that we represent
                tempestSoundIO = new TDNWin32TempestSoundIO();

                // create the streamlistener that feeds it
                tempestIOStreamListener = new TDNTempestIOStreamListener(tempestMemoryStream.GetLeftSide(), tempestSoundIO);

                // create the IO proxy
                tempestIOStreamProxy = new TDNIOStreamProxy(tempestMemoryStream.GetRightSide());

                // create our tempest
                tempest = new Tempest(tempestIOStreamProxy);

                // at this point here's what we have:
                //   - tempest is writing to tempestIOStreamProxy, which is its output device
                //   - tempestIOStreamProxy is writing to tempestMemoryStream
                //   - tempestIOStreamListener is reading from tempestMemoryStream and writing
                //     to tempestIO, which is the actual screen output device
                //
                // this is basically the identical scheme that we'll use to write to the real device
                //

                // set it to running
                startTime = DateTime.Now;
                tempest.Start();

                timer           = new DispatcherTimer();
                timer.Interval  = TimeSpan.FromMilliseconds(200);
                timer.IsEnabled = true;
                timer.Tick     += timer_Tick;

                vectorTimer           = new DispatcherTimer();
                vectorTimer.Interval  = TimeSpan.FromMilliseconds(50);
                vectorTimer.IsEnabled = true;
                vectorTimer.Tick     += vectorTimer_Tick;

                spinnerTimer           = new DispatcherTimer();
                spinnerTimer.Interval  = TimeSpan.FromMilliseconds(10);
                spinnerTimer.IsEnabled = true;
                spinnerTimer.Tick     += spinnerTimer_Tick;
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message);
                Close();
            }
        }