예제 #1
0
        private void Start_Click(object sender, RoutedEventArgs e)
        {
            int bpm = Int16.Parse(textBox.Text);

            tik = new SoundPlayer(Properties.Resources.tik);
            tok = new SoundPlayer(Properties.Resources.tok);



            if (!isPlaying)
            {
                _time.Period = (int)(1000 * (60f / bpm));
                _time.Start();
                count         = 0;
                _time.Tick   += _timer_Tick;
                isPlaying     = true;
                Start.Content = "Stop";
            }
            else
            {
                _time.Tick -= _timer_Tick;
                _time.Stop();
                count         = 0;
                isPlaying     = false;
                Start.Content = "Start";
                for (int i = 0; i < timesignature; i++)
                {
                    blacks[i].Visibility = Visibility.Visible;
                    greys[i].Visibility  = Visibility.Hidden;
                }
            }
        }
예제 #2
0
        public void StartWorking()
        {
            bool b = InitJoystick();

            tmr.Period = periodWorking;
            currentTry = 0;
            tmr.Start();
        }
예제 #3
0
 private void btnStart_Click(object sender, EventArgs e)
 {
     try
     {
         counter         = 0;
         lblCounter.Text = counter.ToString();
         mmTimer.Start();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,
                         MessageBoxIcon.Stop);
     }
 }
예제 #4
0
    public static void Main(string[] args)
    {
        if (args.Length == 0)
        {
            Console.Write("Server name: ");
            Game.serverName = Console.ReadLine();
        }
        else
        {
            Game.serverName          = args[0];
            TrackerHandler.doConnect = false;
        }

        UdpClient client = new UdpClient();

        MessageBuffer msg = new MessageBuffer();

        msg.WriteByte(1);
        msg.WriteShort(Port.UDP);

        client.Send(msg.Array, msg.Size, new IPEndPoint(IPAddress.Parse("127.0.0.1"), 12345));
        client.Close();

        game = new Game();

        Multimedia.Timer timer = new Multimedia.Timer();
        timer.Period     = 7;
        timer.Resolution = 0;
        timer.Mode       = Multimedia.TimerMode.Periodic;
        timer.Tick      += timer_Tick;
        timer.Start();

        while (running)
        {
            Thread.Sleep(500);
            if (!timer.IsRunning)
            {
                Console.WriteLine("Timer stopped....");
            }
        }
    }
예제 #5
0
        /// <summary>
        /// Called by all constructors
        /// </summary>
        private void Setup()
        {
            SerialPortOpen = true;

            BufferPollTimer = new Multimedia.Timer();
            BufferPollTimer.Period = 1;
            BufferPollTimer.Resolution = 0;
            BufferPollTimer.Tick +=new EventHandler(BufferPollTimer_Tick);
            BufferPollTimer.Start();

            ResponseTimer = new Multimedia.Timer();
            ResponseTimer.Period = TimeOut;
            ResponseTimer.Mode = TimerMode.Periodic;
            ResponseTimer.Resolution = 0;
            ResponseTimer.Stop();
            ResponseTimer.Tick += new EventHandler(ResponseTimer_Tick);
        }
예제 #6
0
        public void StartWorking()
        {
            bool b = InitJoystick();

            tmr.Start();
        }