Example #1
0
 private void playWindows(String note_octave)
 {
     System.Windows.Media.MediaPlayer mp = (MediaPlayer)deviceMap[note_octave];
     mp.Stop();
     mp.Position = new TimeSpan(0);
     mp.Play();
 }
Example #2
0
 public void Play(string link)
 {
     System.Windows.Media.MediaPlayer sound = new System.Windows.Media.MediaPlayer();
     sound.Open(new System.Uri(link));
     sound.Volume = 100;
     sound.Play();
 }
Example #3
0
        public Form1()
        {
            InitializeComponent();
            this.KeyPreview = true;
            readPath();
            foreach (Control c in this.groupBox1.Controls)
            {
                if (c.GetType() == typeof(Button))
                {
                    Button b = (Button)c;
                    if (b.Text.Equals("ignore"))
                    {
                        continue;
                    }

                    b.MouseDown  += new MouseEventHandler(button_pressed);
                    b.MouseUp    += new MouseEventHandler(button_released);
                    b.MouseLeave += new EventHandler(button_leave);

                    deviceMap.Add(b.Tag.ToString(), null);
                    load(b.Tag.ToString());
                }
                if (c.GetType() == typeof(CheckBox))
                {
                    CheckBox cb = (CheckBox)c;
                    cb.CheckedChanged += new EventHandler(checked_chagned);
                }
            }

            button37_Click(null, null);
            this.listBox1.MouseDoubleClick += new MouseEventHandler(list_double_clicked);



            toolTip1.SetToolTip(this.button43, "Save current score to clipboard");
            toolTip2.SetToolTip(this.checkBox37, "Turn on/off piano key sound");

            toolTip3.SetToolTip(this.button37, "Preset C,D,E of 2,3,4 octave. The default");

            toolTip4.SetToolTip(this.listBox1, "Double click on selected item to replay note from history");

            toolTip5.SetToolTip(this.progressBar1, "Streak of 20 to win the game!");


            toolTip6.SetToolTip(this.button40, "Also shortcut 'space' to next!");

            toolTip7.SetToolTip(this.button41, "Also shortcut 'r' to repeat!");

            System.Threading.Thread.Sleep(500);

            var c1 = new System.Windows.Media.MediaPlayer();

            c1.Open(new System.Uri(Path.GetFullPath(@"res/loading.wav")));


            deviceMap.Add("loading.wav", c1);
            System.Threading.Thread.Sleep(500);
            c1.Play();
        }
Example #4
0
        public EOSoundManager()
        {
            lock (_construction_locker_)
            {
                if (inst != null)
                {
                    _copyFrom(inst);
                    return;
                }

                string[] soundFiles = Directory.GetFiles(SFX_DIR, "*.wav");
                Array.Sort(soundFiles);

                string[] musicFiles = Directory.GetFiles(MFX_DIR, "*.mid");
                Array.Sort(musicFiles);

                m_sounds       = new List <SoundInfo>(81);
                m_guitarSounds = new List <SoundInfo>(36);
                m_harpSounds   = new List <SoundInfo>(36);
                m_music        = new List <Uri>(musicFiles.Length);

                foreach (string sfx in soundFiles)
                {
                    _correctTheFileLength(sfx);

                    using (FileStream fs = new FileStream(sfx, FileMode.Open, FileAccess.Read, FileShare.Read))
                    {
                        //Note: this MAY throw InvalidOperationException if the file is invalid. However, _correctTheFileLength fixes
                        //	this for the original sfx files.
                        SoundEffect nextEffect = SoundEffect.FromStream(fs);

                        if (sfx.ToLower().Contains("gui"))
                        {
                            m_guitarSounds.Add(nextEffect == null ? null : new SoundInfo(nextEffect));
                        }
                        else if (sfx.ToLower().Contains("har"))
                        {
                            m_harpSounds.Add(nextEffect == null ? null : new SoundInfo(nextEffect));
                        }
                        else
                        {
                            m_sounds.Add(nextEffect == null ? null : new SoundInfo(nextEffect));
                        }
                    }
                }

                m_songPlayer             = new System.Windows.Media.MediaPlayer();
                m_dispatcher             = Dispatcher.CurrentDispatcher;
                m_songPlayer.MediaEnded += (o, e) => m_songPlayer.Position = new TimeSpan(0);

                foreach (string mfx in musicFiles)
                {
                    m_music.Add(new Uri(mfx, UriKind.Relative));
                }

                inst = this;
            }
        }
Example #5
0
        public void PlayAllways()
        {
            var player = new System.Windows.Media.MediaPlayer();

            // player.Open(new Uri(@"C:\Users\marina.oleinik\source\repos\Snake_2020\Snake_2020\Allways.mp3", UriKind.Relative));
            player.Open(new Uri("Allways.mp3", UriKind.Relative));
            player.Volume = 100;
            player.Play();
        }
Example #6
0
        private void load(String note_octave)
        {
            var c = new System.Windows.Media.MediaPlayer();

            c.Volume = 0.5;
            c.Open(new System.Uri(Path.GetFullPath(getAudioPath(note_octave))));
            deviceMap[note_octave] = c;
            System.Threading.Thread.Sleep(100);
        }
Example #7
0
 private void playSound(Uri path)
 {
     new Thread(() => {
         var c = new System.Windows.Media.MediaPlayer();
         c.Open(path);
         c.Play();
         Thread.Sleep(2000);
         c.Stop();
     }).Start();
 }
Example #8
0
        /// <summary>
        /// 播放声音
        /// </summary>
        /// <param name="soundName">声音名</param>
        public static void PalyAudio(string soundName, double volume)
        {
            if (String.IsNullOrEmpty(soundName) || soundName.Contains("无"))
            {
                return;
            }

            string path = Entity.App.AudioList[soundName].ToString();

            if (!System.IO.File.Exists(path))
            {
                return;
            }

            /*
             * SoundPlayer类特点
             * 1)仅支持.wav音频文件;
             * 2)不支持同时播放多个音频(任何新播放的操作将终止当前正在播放的);
             * 3)无法控制声音的音量;
             * if (path.EndsWith(".wav"))
             * {
             *    using (System.Media.SoundPlayer player = new System.Media.SoundPlayer(path))
             *    {
             *        player.Play();//播放波形文件
             *    }
             * }
             */
            if (_player != null)
            {
                StopAudio();
            }
            System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                if (path.EndsWith(".mp3") || path.EndsWith(".wma") || path.EndsWith(".wav"))
                {
                    try
                    {
                        _player = new System.Windows.Media.MediaPlayer();
                        _player.Open(new Uri(path));
                        _player.Volume = volume / 100;//大小为0~1.0
                        _player.Play();
                        //_player.MediaOpened+=
                    }
                    catch (Exception ex)
                    {
                        Log.SaveLog("Core Common_PalyAudio", ex.ToString());
                    }
                }
            }));
        }
Example #9
0
 /// <summary>
 /// 播放按钮被按下
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (!isPlaying)
     {
         isPlaying         = true;
         Buttonplay.Source = pauseBitmapImage;
         media             = new MediaPlayer();//播放类
         Thread t1 = new Thread(new ThreadStart(InitSong));
         t1.Start();
     }
     else
     {
         media.Pause();
         isPlaying         = false;
         Buttonplay.Source = playingImage;
     }
 }
 /// <summary>
 /// The method that needs to be called first before you use other Sound class methods.
 /// </summary>
 private static void InitializePlayer()
 {
     if (!Initialized)
     {
         MusicPlayer             = new MediaPlayer();
         MusicPlayer.MediaEnded += RestartMusic;
         TempMasterVolume        = MasterVolume;
         TempMusicVolume         = MusicVolume;
         TempSfxVolume           = SfxVolume;
         MusicPlayer.Volume      = MusicVolume;
         Initialized             = true;
     }
     if (VolumeChanged)
     {
         VolumeChanged = false;
     }
 }
Example #11
0
        private void VideoDrawingAnimationWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            var player = new System.Windows.Media.MediaPlayer();

            player.MediaEnded += PlayerOnMediaEnded;

            player.Open(new Uri(@"AnimationPerformanceDemo\Assets\1.mp4", UriKind.RelativeOrAbsolute));

            var videoDrawing = new VideoDrawing {
                Rect = new Rect(0, 0, 1920, 1080), Player = player
            };

            var brush = new DrawingBrush(videoDrawing);

            Background = brush;

            player.Play();
        }
Example #12
0
        /// <summary>
        /// 停止播放声音
        /// </summary>
        public static void StopAudio()
        {
            System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                try
                {
                    if (_player != null)
                    {
                        _player.Stop();
                    }

                    _player = null;
                }
                catch (Exception ex)
                {
                    Log.SaveLog("Core Common_StopAudio", ex.ToString());
                }
            }));
        }
Example #13
0
        public void Play(Label txtKron, Playlist playlist, ProgressBar progress, bool isSpectrumOn)
        {
            _player             = new System.Windows.Media.MediaPlayer();
            _player.MediaEnded += delegate { NextSong(playlist, txtKron, progress, isSpectrumOn); };
            SongNameLabel(txtKron, playlist.listOfFiles[0][1]);
            if (playlist.listOfFiles[0][2] == ".wav" && isSpectrumOn == true)
            {
                //UnityLaunch();
                //Thread.Sleep(2150);
                //Thread.Sleep(2485);
                AsynchronousClient.StartClient(playlist.listOfFiles[0][0]);
            }
            Uri uri = new Uri(playlist.listOfFiles[0][0]);

            _player.Open(uri);
            _player.MediaOpened += delegate { SetMax(progress); };
            currentSongID        = 0;
            _player.Play();
            SetTimer(progress);
            _player.Volume = volume;
        }
Example #14
0
        public bool Play_Sound(SoundPlayer player)
        {
            if (avaliable_sound_device.WaitOne(0))
            {
                Task t = Task.Run(() =>
                {
                    var wmplayer = new System.Windows.Media.MediaPlayer();
                    //player.Play();
                    if (player == soundPlayer_1)
                    {
                        wmplayer.Open(new System.Uri(@"C:\\sound\\dongdong2.wav"));
                        wmplayer.Play();
                    }
                    if (player == soundPlayer_2)
                    {
                        wmplayer.Open(new System.Uri(@"C:\\sound\\ci2.wav"));
                        wmplayer.Play();
                    }
                    //wmplayer.controls.play();
                    //wmplayer.close();

                    this.avaliable_sound_device.Release();
                });

                Task t2 = Task.Run(() =>
                {
                    // send a message to server
                    tcpClient.write1();
                });


                return(true);
            }
            else
            {
                System.Console.WriteLine("sound device not avaliable");
                return(false);
            }
        }
Example #15
0
 public abstract void DrawVideo(MediaPlayer player, System.Windows.Rect rectangle);
Example #16
0
 public abstract void DrawVideo(MediaPlayer player, System.Windows.Rect rectangle, System.Windows.Media.Animation.AnimationClock rectangleAnimations);
Example #17
0
        public EOSoundManager()
        {
            lock (_construction_locker_)
            {
                if (inst != null)
                {
                    _copyFrom(inst);
                    return;
                }

                string[] soundFiles = Directory.GetFiles(SFX_DIR, "*.wav");
                Array.Sort(soundFiles);

                string[] musicFiles = Directory.GetFiles(MFX_DIR, "*.mid");
                Array.Sort(musicFiles);

                m_sounds = new List<SoundInfo>(81);
                m_guitarSounds = new List<SoundInfo>(36);
                m_harpSounds = new List<SoundInfo>(36);
                m_music = new List<Uri>(musicFiles.Length);

                foreach (string sfx in soundFiles)
                {
                    _correctTheFileLength(sfx);

                    using (FileStream fs = new FileStream(sfx, FileMode.Open, FileAccess.Read, FileShare.Read))
                    {
                        //Note: this MAY throw InvalidOperationException if the file is invalid. However, _correctTheFileLength fixes
                        //	this for the original sfx files.
                        SoundEffect nextEffect = SoundEffect.FromStream(fs);

                        if (sfx.ToLower().Contains("gui"))
                            m_guitarSounds.Add(nextEffect == null ? null : new SoundInfo(nextEffect));
                        else if (sfx.ToLower().Contains("har"))
                            m_harpSounds.Add(nextEffect == null ? null : new SoundInfo(nextEffect));
                        else
                            m_sounds.Add(nextEffect == null ? null : new SoundInfo(nextEffect));
                    }
                }

                m_songPlayer = new System.Windows.Media.MediaPlayer();
                m_dispatcher = Dispatcher.CurrentDispatcher;
                m_songPlayer.MediaEnded += (o, e) => m_songPlayer.Position = new TimeSpan(0);

                foreach (string mfx in musicFiles)
                    m_music.Add(new Uri(mfx, UriKind.Relative));

                inst = this;
            }
        }
Example #18
0
 private void tmrRandom_Tick(object sender, EventArgs e)
 {
     if (counter < 2)
     {
         lblJudul.Text = "Acak Permainan ke - " + (counter + 1).ToString();
         new System.Threading.Thread(() =>
         {
             var c = new System.Windows.Media.MediaPlayer();
             c.Open(new System.Uri(@Application.StartupPath + "\\random\\c.wav"));
             c.Play();
         }).Start();
         if ((_start.AddSeconds(3) - DateTime.UtcNow).Ticks <= 0)
         {
             tmrRandom.Interval = tmrRandom.Interval + 50;
         }
         if ((_start.AddMilliseconds(6000) - DateTime.UtcNow).Ticks <= 0)
         {
             do
             {
                 if (!done[select])
                 {
                     tmrRandom.Enabled  = false;
                     tmrRandom.Interval = 55;
                     done[select]       = true;
                     go();
                     break;
                 }
                 else
                 {
                     select = rnd.Next(0, 7);
                 }
             } while ((done[select]));
         }
         select = rnd.Next(0, 7);
         for (int a = 0; a < 7; a++)
         {
             if (a != select)
             {
                 use[a] = bg[a];
             }
             else
             {
                 use[a] = bgs[a];
             }
         }
         label0.Image = use[0];
         label1.Image = use[1];
         label2.Image = use[2];
         label3.Image = use[3];
         label4.Image = use[4];
         label5.Image = use[5];
         label6.Image = use[6];
     }
     else
     {
         tmrRandom.Enabled = false;
         Akhir akhir = new Akhir(p1, p2);
         p.Stop();
         this.Hide();
         akhir.ShowDialog();
     }
 }
 public abstract void DrawVideo(MediaPlayer player, System.Windows.Rect rectangle);
Example #20
0
		public abstract void DrawVideo (MediaPlayer player, Rect rect, AnimationClock clock);
Example #21
0
 private void cek()
 {
     if (p1lock && p2lock)
     {
         generate();
     }
     if (!p1lock)
     {
         char p1a = '\0', p1b = '\0';
         if (p1m.Count != 0)
         {
             p1a = (char)p1m.Pop();
         }
         if (p1m.Count != 0)
         {
             p1b = (char)p1m.Pop();
         }
         if (p1b == '\0')
         {
             p1m.Push(p1a);
         }
         else
         {
             if (p1a == 'a' && p1b == 'd')
             {
                 p1geleng++;
                 p1angguk = 0;
                 p1m.Clear();
             }
             else if (p1a == 'w' && p1b == 's')
             {
                 p1geleng = 0;
                 p1angguk++;
                 p1m.Clear();
             }
             else
             {
                 p1geleng = 0;
                 p1angguk = 0;
                 p1m.Push(p1b);
                 p1m.Push(p1a);
             }
         }
         if (p1angguk == 3)
         {
             if (now.ans == question)
             {
                 new System.Threading.Thread(() =>
                 {
                     var c = new System.Windows.Media.MediaPlayer();
                     c.Open(new System.Uri(@Application.StartupPath + "\\s5\\G1Benar.wav"));
                     c.Play();
                 }).Start();
                 _soal           = DateTime.UtcNow.AddSeconds(4);
                 picP1BS.Image   = Image.FromFile(Application.StartupPath + "\\s5\\1.png");
                 picP1BS.Visible = true;
                 tmrBS1.Enabled  = true;
                 p1score        += 100;
                 pp1.Text        = p1score.ToString();
                 p1lock          = true;
                 p2lock          = true;
                 cek();
             }
             else
             {
                 new System.Threading.Thread(() =>
                 {
                     var c = new System.Windows.Media.MediaPlayer();
                     c.Open(new System.Uri(@Application.StartupPath + "\\s5\\G1Salah.wav"));
                     c.Play();
                 }).Start();
                 picP1BS.Image   = Image.FromFile(Application.StartupPath + "\\s5\\0.png");
                 picP1BS.Visible = true;
                 tmrBS1.Enabled  = true;
             }
         }
         if (p1geleng == 3)
         {
             if (now.ans != question && p1geleng == 3)
             {
                 new System.Threading.Thread(() =>
                 {
                     var c = new System.Windows.Media.MediaPlayer();
                     c.Open(new System.Uri(@Application.StartupPath + "\\s5\\G1Benar.wav"));
                     c.Play();
                 }).Start();
                 _soal           = DateTime.UtcNow.AddSeconds(4);
                 picP1BS.Image   = Image.FromFile(Application.StartupPath + "\\s5\\1.png");
                 picP1BS.Visible = true;
                 tmrBS1.Enabled  = true;
                 p1score        += 100;
                 pp1.Text        = p1score.ToString();
                 p1lock          = true;
                 p2lock          = true;
                 cek();
             }
             else
             {
                 new System.Threading.Thread(() =>
                 {
                     var c = new System.Windows.Media.MediaPlayer();
                     c.Open(new System.Uri(@Application.StartupPath + "\\s5\\G1Salah.wav"));
                     c.Play();
                 }).Start();
                 picP1BS.Image   = Image.FromFile(Application.StartupPath + "\\s5\\0.png");
                 picP1BS.Visible = true;
                 tmrBS1.Enabled  = true;
             }
         }
     }
     if (!p2lock)
     {
         char p2a = '\0', p2b = '\0';
         if (p2m.Count != 0)
         {
             p2a = (char)p2m.Pop();
         }
         if (p2m.Count != 0)
         {
             p2b = (char)p2m.Pop();
         }
         if (p2b == '\0')
         {
             p2m.Push(p2a);
         }
         else
         {
             if (p2a == 'j' && p2b == 'l')
             {
                 p2geleng++;
                 p2angguk = 0;
                 p2m.Clear();
             }
             else if (p2a == 'i' && p2b == 'k')
             {
                 p2geleng = 0;
                 p2angguk++;
                 p2m.Clear();
             }
             else
             {
                 p2geleng = 0;
                 p2angguk = 0;
                 p2m.Push(p2b);
                 p2m.Push(p2a);
             }
         }
         if (p2angguk == 3)
         {
             if (now.ans == question)
             {
                 new System.Threading.Thread(() =>
                 {
                     var c = new System.Windows.Media.MediaPlayer();
                     c.Open(new System.Uri(@Application.StartupPath + "\\s5\\G1Benar.wav"));
                     c.Play();
                 }).Start();
                 _soal           = DateTime.UtcNow.AddSeconds(4);
                 picP2BS.Image   = Image.FromFile(Application.StartupPath + "\\s5\\1.png");
                 picP2BS.Visible = true;
                 tmrBS2.Enabled  = true;
                 p2score        += 100;
                 pp2.Text        = p2score.ToString();
                 p2lock          = true;
                 p1lock          = true;
                 cek();
             }
             else
             {
                 new System.Threading.Thread(() =>
                 {
                     var c = new System.Windows.Media.MediaPlayer();
                     c.Open(new System.Uri(@Application.StartupPath + "\\s5\\G1Salah.wav"));
                     c.Play();
                 }).Start();
                 picP2BS.Image   = Image.FromFile(Application.StartupPath + "\\s5\\0.png");
                 picP2BS.Visible = true;
                 tmrBS2.Enabled  = true;
             }
         }
         if (p2geleng == 3)
         {
             if (now.ans != question && p2geleng == 3)
             {
                 new System.Threading.Thread(() =>
                 {
                     var c = new System.Windows.Media.MediaPlayer();
                     c.Open(new System.Uri(@Application.StartupPath + "\\s5\\G1Benar.wav"));
                     c.Play();
                 }).Start();
                 _soal           = DateTime.UtcNow.AddSeconds(4);
                 picP2BS.Image   = Image.FromFile(Application.StartupPath + "\\s5\\1.png");
                 picP2BS.Visible = true;
                 tmrBS2.Enabled  = true;
                 p2score        += 100;
                 pp2.Text        = p2score.ToString();
                 p2lock          = true;
                 p1lock          = true;
                 cek();
             }
             else
             {
                 new System.Threading.Thread(() =>
                 {
                     var c = new System.Windows.Media.MediaPlayer();
                     c.Open(new System.Uri(@Application.StartupPath + "\\s5\\G1Salah.wav"));
                     c.Play();
                 }).Start();
                 picP2BS.Image   = Image.FromFile(Application.StartupPath + "\\s5\\0.png");
                 picP2BS.Visible = true;
                 tmrBS2.Enabled  = true;
             }
         }
     }
 }
Example #22
0
        public void OnHostEvent(object sender, ProgressChangedEventArgs e)
        {
            if (e.UserState is Exception)
            {
                Exception ex = e.UserState as Exception;
                PopupString(ex.ToString() + "\r\n" + ex.StackTrace.ToString());
            }
            if (e.UserState is string)
            {
                /*
                 * string line = (string)e.UserState;
                 *
                 * textHistory.AppendText(line + "\r\n");
                 * textHistory.ScrollToEnd();
                 */
            }
            else if (e.UserState is EvalBundle)
            {
                EvalBundle b = (EvalBundle)e.UserState;
                ProcessEvals(b);
            }
            else if (e.UserState is DictBundle)
            {
                DictBundle b = (DictBundle)e.UserState;

                if (b.path == "download-result")
                {
                    OfferDownloads(b);
                    if (accessLibraryDlg != null)
                    {
                        accessLibraryDlg.Consider(b);
                    }
                }
                else
                {
                    if (b.path == "_gameaid/_filenames")
                    {
                        filenameDict = b.dict;
                    }

                    partyInfo1.Consider(b);
                    partyInfo2.Consider(b);
                    vs1.Consider(b);
                    readyRolls.Consider(b);

                    if (openSaveRollsDlg != null)
                    {
                        openSaveRollsDlg.Consider(b);
                    }

                    map1.Consider(b);
                    map2.Consider(b);

                    foreach (var sq in Squad.Children)
                    {
                        var sheet = sq as VirtualSheet;
                        if (sheet != null)
                        {
                            sheet.Consider(b);
                        }
                    }
                }
            }
            else if (e.UserState is DownloadFile)
            {
                DownloadFile file = e.UserState as DownloadFile;

                // Configure open file dialog box
                var dlg = new System.Windows.Forms.SaveFileDialog();
                dlg.Title           = "Save Download";
                dlg.FileName        = file.name;
                dlg.DefaultExt      = ".xlsx";                           // Default file extension
                dlg.Filter          = "Character Sheets (.xlsx)|*.xlsx"; // Filter files by extension
                dlg.OverwritePrompt = true;
                dlg.CheckPathExists = true;

                // Show open file dialog box
                System.Windows.Forms.DialogResult result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    try
                    {
                        System.IO.File.WriteAllBytes(dlg.FileName, file.bytes);
                    }
                    catch (Exception ex)
                    {
                        System.Windows.MessageBox.Show(ex.Message);
                        return;
                    }
                }
            }
            else if (e.UserState is AudioReport)
            {
                AudioReport audio = e.UserState as AudioReport;

                string url = "";

                switch (audio.desc)
                {
                case "speak":
                    if (reader == null)
                    {
                        try
                        {
                            // tolerate reader acquisition failure more gracefully

                            reader = new SpeechSynthesizer();

                            // var l = new List<VoiceInfo>();
                            //
                            // foreach (InstalledVoice voice in reader.GetInstalledVoices())
                            // {
                            //     VoiceInfo info = voice.VoiceInfo;
                            //     string AudioFormats = "";
                            //     foreach (SpeechAudioFormatInfo fmt in info.SupportedAudioFormats)
                            //     {
                            //         AudioFormats += String.Format("{0}\n",
                            //         fmt.EncodingFormat.ToString());
                            //     }
                            //
                            //     l.Add(info);
                            //
                            // }

                            reader.SelectVoice("Microsoft Zira Desktop");
                        }
                        catch
                        {
                        }
                    }

                    if (reader != null)
                    {
                        reader.SpeakAsync(audio.text);
                    }
                    break;

                case "ownage":
                    switch (audio.killcount)
                    {
                    case 1:
                        url = "http://myserver.com/uploads/killshot/1.mp3";
                        break;

                    case 2:
                        url = "http://myserver.com/uploads/killshot/4.mp3";
                        break;

                    case 3:
                        url = "http://myserver.com/uploads/killshot/6.mp3";
                        break;

                    case 4:
                        url = "http://myserver.com/uploads/killshot/7.mp3";
                        break;

                    case 5:
                        url = "http://myserver.com/uploads/killshot/10.mp3";
                        break;

                    case 6:
                        url = "http://myserver.com/uploads/killshot/9.mp3";
                        break;

                    case 7:
                    default:
                        url = "http://myserver.com/uploads/killshot/14.mp3";
                        break;
                    }
                    break;

                case "fumble":
                    url = "http://myserver.com/uploads/killshot/0.mp3";
                    break;

                default:
                    url = "http://myserver.com/uploads/misc/" + audio.desc;
                    break;
                }

                if (url != "")
                {
                    var player = new System.Windows.Media.MediaPlayer();
                    player.Open(new Uri(url));
                    player.MediaOpened += new EventHandler((object s, EventArgs a) => { player.Play(); });
                    player.MediaEnded  += new EventHandler((object s, EventArgs a) => { player.Close(); });
                }
            }
            else if (e.UserState is HoursReport)
            {
                HoursReport h = e.UserState as HoursReport;
                vs1.SetRemainingHours(h.hours);
            }
        }
Example #23
0
 /// <summary>
 ///     DrawVideo -
 ///     Draw a Video into the region specified by the Rect.
 ///     The Video will potentially be stretched and distorted to fit the Rect.
 ///     For more fine grained control, consider filling a Rect with an VideoBrush via
 ///     DrawRectangle.
 /// </summary>
 /// <param name="player"> The MediaPlayer to draw. </param>
 /// <param name="rectangle"> The Rect into which the media will be fit. </param>
 public override void DrawVideo(
     MediaPlayer player,
     Rect rectangle)
 {
     Debug.Assert(false);
 }
Example #24
0
 public PlayMusic()
 {
     _mp = new System.Windows.Media.MediaPlayer();
     _mp.Open(new Uri(@"E:\ProjecktC#\Tank\TankModel\music.mp3"));
     //mp.Open(new Uri("c:\pathtomedia\MySound.wav"));
 }
Example #25
0
		public abstract void DrawVideo (MediaPlayer player, Rect rect);
 public abstract void DrawVideo(MediaPlayer player, System.Windows.Rect rectangle, System.Windows.Media.Animation.AnimationClock rectangleAnimations);