Exemplo n.º 1
0
        private void 開くOToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "MIDIファイル(*.mid)|*.mid";
            openFileDialog1.ShowDialog();
            var filePath = openFileDialog1.FileName;

            if (string.IsNullOrWhiteSpace(filePath) || !File.Exists(filePath))
            {
                return;
            }

            if (mPlayer.IsPlay)
            {
                mPlayer.Stop();
                btnPalyStop.Text = "再生";
            }

            try {
                mSMF = new SMF.SMF(filePath);
                mPlayer.SetEventList(mSMF.EventList);
                hsbSeek.Maximum = mPlayer.MaxTick;
                Text            = Path.GetFileNameWithoutExtension(filePath);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.ToString());
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Player instance = new Player();

            instance.Play();
            instance.Pause();
            instance.Record();
            instance.Stop();

            Console.ReadKey();
        }
Exemplo n.º 3
0
        private async void MainPage_Click1(object sender, RoutedEventArgs e)
        {
            //var msg = new MessageDialog(path + @"\" + (sender as Button).Content).ShowAsync();

            Player.Stop();

            Play.Content = "Play";


            file = await StorageFile.GetFileFromPathAsync(path + @"\" + (sender as Button).Content);

            NameMusic.Text = "Name music: " + file.Name;
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            // Setup up logging with log4net
            XmlConfigurator.Configure();

            string ep = Properties.Settings.Default.RegistryEndPoint;
            if (args.Length > 0)
            {
                if (args[0].ToLower().Contains("local"))
                {
                    ep = Properties.Settings.Default.LocalRegistryEndPoint;
                }
            }
            Player player = new Player()
            {
                IdentityInfo = new IdentityInfo()
                {
                    LastName = Properties.Settings.Default.LastName,
                    FirstName = Properties.Settings.Default.FirstName,
                    ANumber = Properties.Settings.Default.ANumber,
                    Alias = Properties.Settings.Default.Alias
                },
                ProcessLabel = Properties.Settings.Default.ProcessLabel,
                RegistryEndPoint = new PublicEndPoint()
                {
                    HostAndPort = ep
                }
            };
            
            logger.Debug("Starting player");
            Thread playerThread = new Thread(new ThreadStart(player.Start));
            playerThread.Start();

            PlayerUI ui = new PlayerUI(player);
            Application.Run(ui);

            player.Stop();
            playerThread.Join();
        }
Exemplo n.º 5
0
 private void button4_Click(object sender, EventArgs e)
 {
     pl.Stop();
 }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            Player player = new Player();

            Console.ForegroundColor = ConsoleColor.Blue;
            Console.WriteLine("Вас приветствует класс Player!");
            int  c = 0;
            bool b = true;
            char Doo;

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("Для записи видео нажмите 1\nДля просмотра видео нажмите 2,\nДля выхода из Проигрывателя нажмите 0");
            Console.ForegroundColor = ConsoleColor.White;
            c = Convert.ToInt32(Console.ReadLine());
            switch (c)
            {
            case 1:
                Doo = '1';
                while (b == true)
                {
                    switch (Doo)
                    {
                    case '1':
                        player.Record();
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        Console.WriteLine("Следующие действия: \n 2--> Пауза\n3-->Стоп, 0-->Выход");
                        Console.ForegroundColor = ConsoleColor.White;
                        Doo = Convert.ToChar(Console.ReadLine());
                        break;

                    case '2':
                        player.Pause();
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        Console.WriteLine("Следующие действия: \n 1--> Возобновть запись\n3-->Стоп, 0-->Выход");
                        Console.ForegroundColor = ConsoleColor.White;
                        Doo = Convert.ToChar(Console.ReadLine());
                        break;

                    case '3':
                        player.Stop();
                        b = false;
                        break;

                    case '0':
                        b = false;
                        break;

                    default:
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("Вы ввели неправильную команду!");
                        Console.ForegroundColor = ConsoleColor.White;
                        b = false;
                        break;
                    }
                }
                break;

            case 2:
                Doo = '1';
                while (b == true)
                {
                    switch (Doo)
                    {
                    case '1':
                        player.Play();
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        Console.WriteLine("Следующие действия: \n 2--> Пауза\n3-->Стоп, 0-->Выход");
                        Console.ForegroundColor = ConsoleColor.White;
                        Doo = Convert.ToChar(Console.ReadLine());
                        break;

                    case '2':
                        player.Pause();
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        Console.WriteLine("Следующие действия: \n 1--> Возобновть просмотр\n3-->Стоп, 0-->Выход");
                        Console.ForegroundColor = ConsoleColor.White;
                        Doo = Convert.ToChar(Console.ReadLine());
                        break;

                    case '3':
                        player.Stop();
                        b = false;
                        break;

                    case '0':
                        b = false;
                        break;

                    default:
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("Вы ввели неправильную команду!");
                        Console.ForegroundColor = ConsoleColor.White;
                        b = false;
                        break;
                    }
                }
                break;

            case 0:
                Console.WriteLine("Вы вышли из проигрывателя!");
                break;

            default:
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Неправильная команда! Будет осуществлен выход из плеера!");
                Console.ForegroundColor = ConsoleColor.White;
                break;
            }
        }