Example #1
1
 //when form loads, load sounds, start new game
 private void Form1_Load(object sender, EventArgs e)
 {
     backgroundplayer = new WindowsMediaPlayer();
     backgroundplayer.URL = @backgroundsoundlocation;
     backgroundplayer.controls.play();
     turnplayer = new WindowsMediaPlayer();
     turnplayer.URL = @turnsoundlocation;
     turnplayer.controls.stop();
     fruitplayer = new WindowsMediaPlayer();
     fruitplayer.URL = @fruitsoundlocation;
     fruitplayer.controls.stop();
     myCanvas = new Bitmap(600, 400);
     g = Graphics.FromImage(myCanvas);
     pictureBox1.Image = myCanvas;
     newGame();
     timer1.Start();
 }
Example #2
0
    public SoundControl()
    {
        sound = new SoundPlayer();
        mainSound = new WMPLib.WindowsMediaPlayer();
        mainSound.URL = "1.mp3";
        mainSound.settings.setMode("loop", true);
        sound.SoundLocation = "2.wav";

    }
 public void Dong(string buf)
 {
     if (Filter(buf).Contains("!Dong"))
     {
         //new SoundPlayer(@"Sounds\WTD.wav").Play(); .WAV
         WMPLib.WindowsMediaPlayer a = new WMPLib.WindowsMediaPlayer(); //.mp3
         a.URL = @"Sounds\WTD.mp3";
         a.controls.play();
     }
 }
Example #4
0
 public static void Play(string songRelPath)
 {
     if (m_isPlaying)
     {
         Stop();
         m_player.close();
     }
     m_player = new WMPLib.WindowsMediaPlayer();
     var filePath=Path.Combine(m_songsBaseLibary, songRelPath);
     if (!File.Exists(filePath))
     {
         throw new FileNotFoundException("File " + filePath + " doesn't exist");
     }
     m_player.URL = filePath;
     m_player.controls.play();
     m_isPlaying = true;
 }
        SquareView[,] squares; /*!< Tableau a deux dimensions des vues des cases */

        #endregion Fields

        #region Constructors

        /*!
        * \fn MainGame()
        * \brief Constructeur standard de la vue du jeu
                * \return
        */
        public MainGame()
        {
            wplayer = new WMPLib.WindowsMediaPlayer();
            InitializeComponent();
            controller = new Controller.Controller(this);
            log = new LogView(this);
            App.wrapper.setObserver(this);
            InitializeTabs();
            InitializeGameGrid();
            InitializePlayersView();
            MouseMove += onShootMouseMove;
            MouseUp += onShootMouseUp;
            shootLine = new Line();
            ShowCurrentPlayer();
            animateBackground();

            var path = System.IO.Path.Combine(
                 System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
                , "sounds/theme.mp3");
            wplayer.URL = path;
            wplayer.controls.play();
            wplayer.PlayStateChange += new _WMPOCXEvents_PlayStateChangeEventHandler(player_PlayStateChange);
        }
 /*!
 * \fn void onClicNormalSquare(Object sender, MouseEventArgs e)
 * \brief Appelle le controller avec les coordonnees du clic
 * \param Object sender, MouseEventArgs e parametres standards inutilises
 * \return
 */
 public void onClicNormalSquare(Object sender, MouseEventArgs e)
 {
     player = new WMPLib.WindowsMediaPlayer();
     var path = System.IO.Path.Combine(
      System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
     , "sounds/move.mp3");
     player.URL = path;
     player.controls.play();
     int posx = Grid.GetColumn((Rectangle)sender);
     int posy = Grid.GetRow((Rectangle)sender);
     controller.clicNormalSquare(posx,posy);
 }
Example #7
0
        private void mainForm_Shown(object sender, EventArgs e)
        {
            //morhpeus font for prettier labels. not mandatory
            //MorpheusFont morpheusFont = new MorpheusFont();
            //morpheusFont.Load();
            //playButtonLabel.Font = new Font(morpheusFont.fontFamily(), 12, FontStyle.Regular);

            settingsFile.Read();
            if (settingsFile.startUpSound() == true)
            {
                WMPLib.WindowsMediaPlayer player = new WMPLib.WindowsMediaPlayer();
                player.URL = @Directory.GetCurrentDirectory() + "\\sound\\startup.mp3";
                player.controls.play();
            }

            //change control properties on runtime
            //upArrowPicture.Parent = newsTextLabel;
            //upArrowPicture.Location = new Point(436, -2);
            //downArrowPicture.Parent = newsTextLabel;
            //downArrowPicture.Location = new Point(436, 73);

            trayIcon.BalloonTipTitle = "TrueWoW Launcher";
            trayIcon.BalloonTipText = "Launcher minimized to tray. Right click icon for menu.";
            if (settingsFile.minimizeToTray() == true)
            {
                trayIcon.Visible = true;
            }
            else
            {
                trayIcon.Visible = false;
            }
            #region BLP-TEST
            //try
            //{
            //    if (this.blpLoader != null)
            //    {
            //        this.blpLoader.close();
            //        this.blpLoader = null;
            //    }

            //    FileStream file = new FileStream("example.blp", FileMode.Open);
            //    this.blpLoader = new SereniaBLPLib.BlpFile(file);

            //    // loading bitmap level 0
            //    loadedBLP = this.blpLoader.getBitmap(0);
            //    Rectangle imgDimensions = new Rectangle();
            //    imgDimensions.Location = new Point(50, 15);
            //    imgDimensions.Width = 155;
            //    imgDimensions.Height = 32;

            //    playButtonBitmap = loadedBLP.Clone(imgDimensions, loadedBLP.PixelFormat);
            //    playButton.Image = playButtonBitmap;

            //    if (this.blpLoader != null)
            //    {
            //        this.blpLoader.close();
            //        this.blpLoader = null;
            //    }

            //    file.Close();
            //    file = new FileStream("Glues-BigButton-Glow.blp", FileMode.Open);
            //    this.blpLoader = new SereniaBLPLib.BlpFile(file);

            //    loadedBLP = this.blpLoader.getBitmap(0);
            //    imgDimensions = new Rectangle();
            //    imgDimensions.Location = new Point(43, 7);
            //    imgDimensions.Width = 170;
            //    imgDimensions.Height = 50;

            //    playButtonBitmap = loadedBLP.Clone(imgDimensions, loadedBLP.PixelFormat);
            //    playButtonHoover.Image = playButtonBitmap;

            //}
            //catch (FileNotFoundException fe)
            //{
            //    MessageBox.Show("The 'example.blp' was not found!");
            //}
            #endregion

            //read data inside zip
            ZipStorer newsZIP = ZipStorer.Open(@Directory.GetCurrentDirectory() + "\\news\\news.zip", FileAccess.Read);

            // Read all directory contents
            List<ZipStorer.ZipFileEntry> dir = newsZIP.ReadCentralDir();

            // Extract all files in target directory
            string path;
            bool result;
            foreach (ZipStorer.ZipFileEntry entry in dir)
            {
                path = Path.Combine(@Directory.GetCurrentDirectory() + "\\news\\", Path.GetFileName(entry.FilenameInZip));
                result = newsZIP.ExtractFile(entry, path);
            }
            newsZIP.Close();

            this.Refresh();

            readedNews.Read();

            for (int i = 0; i < readedNews.newsCount(); i++)
            {
                Label tmpControl = new Label();
                if (i == 0)
                {
                    tmpControl.BackColor = System.Drawing.Color.Aqua;
                }
                else
                {
                    tmpControl.BackColor = System.Drawing.Color.Gray;
                }
                tmpControl.Cursor = System.Windows.Forms.Cursors.Hand;
                tmpControl.Name = "newsSelector" + i.ToString();
                //tmpControl. = "newsSelector" + i.ToString();
                tmpControl.Size = new System.Drawing.Size(10, 10);
                tmpControl.Click += new System.EventHandler(this.newsSelectorSelected_Click);
                this.Controls.Add(tmpControl);
                tmpControl.Parent = this.newsPicture;
                tmpControl.Location = new System.Drawing.Point((3 + (i * 16)), 3);
                newsSelector.Add(tmpControl);
            }

            newsPicture.ImageLocation = @Directory.GetCurrentDirectory() + "\\news\\" + readedNews.newsImg(0);
            newsTittleLabel.Text = readedNews.newsTittle(0);
            newsTextLabel.Text = readedNews.newsText(0);
            newsSelectorHistory = 0;

            newsLoopWorker.RunWorkerAsync();
        }
Example #8
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     seconds--;
     if (seconds == -1) {
         MinutesBox.ReadOnly = false;
         SecondsBox.ReadOnly = false;
         SetColor(Color.ForestGreen);
         timer1.Stop();
     } else {
         if (seconds == 0) {
             SetColor(Color.Maroon);
             WMPLib.WindowsMediaPlayer wmp = new WMPLib.WindowsMediaPlayer();
             wmp.URL = @"End.wav";
             wmp.controls.play();
             Console.ReadLine();
         } else if (seconds <= 10) {
             SetColor(Color.Chocolate);
         } else {
             SetColor(Color.ForestGreen);
         }
         SetTimeBoxNumber(seconds);
     }
 }
Example #9
0
        private void PlayFile()
        {
            Player = new WMPLib.WindowsMediaPlayer();
            Player.PlayStateChange +=
                new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(Player_PlayStateChange);
            Player.MediaError +=
                new WMPLib._WMPOCXEvents_MediaErrorEventHandler(Player_MediaError);

            Random random = new Random();
            idAudio = Convert.ToInt32(random.Next(1, 3).ToString());

            switch (idAudio)
            {
                case 1:
                    Player.URL = "C:\\VideoIndaiatuba\\audio1.mp3";
                    break;

                case 2:
                    Player.URL = "C:\\VideoIndaiatuba\\audio2.mp3";
                    break;

                default:
                    Player.URL = "C:\\VideoIndaiatuba\\audio1.mp3";
                    break;
            }

            Player.controls.play();
        }
Example #10
0
        internal void LoadMusicInTable(List<string> songs)
        {
            try
            {
                isPlaying = false;
                PlayButton.BackgroundImage = Pimung.Properties.Resources.playButton2;
                nowPlaying.Text = "";
                elapsedTime.Text = "00:00";
                totalTime.Text = "00:00";
                fullOval.Width = 0;
                if (bwMusic.IsBusy)
                    bwMusic.CancelAsync();
                if (bwMusic2.IsBusy)
                    bwMusic2.CancelAsync();
                if (songPlayed != -1)
                {
                    MusicToTable[songPlayed].PlayStateChange -= new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(OnPlayStateChange);
                    aTimer.Elapsed -= new ElapsedEventHandler(OnTimedEvent);
                    MusicToTable[songPlayed].settings.setMode("loop", false);
                    MusicToTable[songPlayed].controls.stop();
                    songPlayed = -1;
                }
                MusicToTable.Clear();
                amount = songs.Count;

                int numberOfRows = songGrid.Rows.Count;
                for (int j = 0; j < numberOfRows; j++)
                {
                    songGrid.Rows.Remove(songGrid.Rows[0]);
                }

                for (int i = 0; i < songs.Count; i++)
                {
                    WMPLib.WindowsMediaPlayer song = new WMPLib.WindowsMediaPlayer();
                    MusicToTable.Add(song);
                    MusicToTable[i].URL = songs[i];
                    MusicToTable[i].settings.mute = true;
                    MusicToTable[i].PlayStateChange += new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(AddMusicInTable);
                }
            }
            catch (Exception ext)
            {
                MessageBox.Show("Something went wrong :( Are you sure that you haven't changed the files' path? The following exception occurred: " + ext);
            }
        }
Example #11
0
 public void PlayFile(String url)
 {
     Player = new WMPLib.WindowsMediaPlayer();
     Player.PlayStateChange +=
         new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(Player_PlayStateChange);
     Player.MediaError +=
         new WMPLib._WMPOCXEvents_MediaErrorEventHandler(Player_MediaError);
     Player.URL = url;
     Player.controls.play();
 }
        /// <summary>
        /// Returns a collection of Song objects from the Windows Media Player library.
        /// </summary>
        /// <returns></returns>
        public static IEnumerable<WmpSong> GetSongsFromLibrary()
        {
            WMPLib.WindowsMediaPlayer wmp = new WMPLib.WindowsMediaPlayer();
              IWMPMediaCollection media = wmp.mediaCollection;
              IWMPPlaylist pList = media.getAll();

              for (int i = 0; i < pList.count; i++)
              {
            IWMPMedia item = pList.get_Item(i);

            WmpSong currentSong = new WmpSong();
            if (item.getItemInfo("CanonicalFiletype") == "mp3")
            {
              foreach (LibraryField libField in Enum.GetValues(typeof(LibraryField)))
              {
            string attrName;
            switch (libField)
            {
              case LibraryField.AlbumTitle:
                {
                  attrName = "WM/AlbumTitle";
                  currentSong.AlbumTitle = item.getItemInfo(attrName);
                  break;
                }

              case LibraryField.ArtistName:
                {
                  attrName = "WM/AlbumArtist";
                  currentSong.ArtistName = item.getItemInfo(attrName);
                  break;
                }

              case LibraryField.CollectionId:
                {
                  attrName = "WM/WMCollectionID";
                  currentSong.WmCollectionId = item.getItemInfo(attrName);
                  break;
                }

              case LibraryField.DateAdded:
                {
                  attrName = "AcquisitionTime";
                  string dateAddedStr = item.getItemInfo(attrName);
                  //Convert from UTC time
                  DateTime utcDateAdded = DateTime.SpecifyKind(DateTime.Parse(dateAddedStr), DateTimeKind.Utc);
                  currentSong.DateAdded = utcDateAdded.ToLocalTime();
                  break;
                }

              case LibraryField.Duration:
                {
                  attrName = "Duration";
                  currentSong.Duration = double.Parse(item.getItemInfo(attrName));
                  break;
                }

              //TODO: Add Label support!

              case LibraryField.LastPlayed:
                {
                  attrName = "UserLastPlayedTime";
                  string lastPlayedStr = item.getItemInfo(attrName);
                  if (!string.IsNullOrEmpty(lastPlayedStr))
                  {
                    //Convert from UTC time
                    DateTime utcLastPlayed = DateTime.SpecifyKind(DateTime.Parse(lastPlayedStr), DateTimeKind.Utc);
                    currentSong.LastPlayed = utcLastPlayed.ToLocalTime();
                  }
                  break;
                }

              case LibraryField.ReleaseDate:
                {
                  attrName = "ReleaseDate";
                  string releaseDateStr = item.getItemInfo(attrName);
                  if (!string.IsNullOrEmpty(releaseDateStr))
                    currentSong.ReleaseDate = DateTime.Parse(releaseDateStr).Date;
                  break;
                }

              case LibraryField.SongTitle:
                {
                  attrName = "Title";
                  currentSong.SongTitle = item.getItemInfo(attrName);
                  break;
                }

              case LibraryField.SongTrackingId:
                {
                  attrName = "TrackingID";
                  currentSong.SongTrackingId = item.getItemInfo(attrName);
                  break;
                }

              case LibraryField.SourceUrl:
                {
                  attrName = "SourceURL";
                  currentSong.SourceUrl = item.getItemInfo(attrName);
                  break;
                }

              case LibraryField.TrackNumber:
                {
                  attrName = "WM/TrackNumber";
                  currentSong.TrackNumber = int.Parse(item.getItemInfo(attrName));
                  break;
                }

              default:
                continue;
            }
              }

              yield return currentSong;
            }
              }
        }
Example #13
0
 public void Dispose()
 {
     bool isEnabled = this.bufferingTimer == null;
     if (!isEnabled)
     {
         this.bufferingTimer.Tick -= new EventHandler(this.BufferingTimerTick);
     }
     this.bufferingTimer = null;
     isEnabled = !this.positionTimer.IsEnabled;
     if (!isEnabled)
     {
         this.positionTimer.Stop();
     }
     this.positionTimer.Tick -= new EventHandler(this.PositionTimerTick);
     this.positionTimer = null;
     isEnabled = this.playerObject == null;
     if (!isEnabled)
     {
         playerObject.MediaError += playerObject_MediaError;
         playerObject.Buffering += playerObject_Buffering;
         playerObject.MediaChange += playerObject_MediaChange;
         playerObject.PlayStateChange += playerObject_PlayStateChange;
         this.playerObject.close();
     }
     this.playerObject = null;
 }
Example #14
0
 static Player()
 {
     queue = new ConcurrentQueue<Song>();
     wmp = new WMPLib.WindowsMediaPlayer();
     wmp.PlayStateChange += new _WMPOCXEvents_PlayStateChangeEventHandler(wmp_PlayStateChange);
 }
Example #15
0
 private PlayerWrapper()
 {
     Player = new WindowsMediaPlayer();
     Player.settings.volume = 50;
 }
Example #16
0
        protected override string ExecuteOrder(string param = null)
        {
            int songalias_beginindex = param.IndexOf(keyword) + keyword.Length;
            string songalias = param.Substring(songalias_beginindex);
            try
            {
                WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();
                string path = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + "\\";
                string songname;

                bool songalias_exist = true;	// if songalias isn't exist then variable will be toggled in switch instruction
                switch (songalias)
                {
                    case song_cantina: songname = "Star Wars - Cantina.mp3"; break;
                    case song_CSI: songname = "The who - Won't get fooled again.mp3"; break;
                    default: { songalias_exist = false; songname = ""; } break;
                }

                if (songalias_exist) wplayer.URL = path + songname;
                wplayer.controls.play();
            }
            catch (Exception e) { return e.Message; }
            return null;
        }
Example #17
0
 public void play(int i)
 {
     this.wplayer = new WMPLib.WindowsMediaPlayer();
     this.wplayer.PlayStateChange += new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(wplayer_PlayStateChange);
     this.wplayer.URL = listMusics[i].getPath();
     this.wplayer.settings.volume = this.tb.Value;
     this.wplayer.controls.play();
 }
 //contructor
 public CurrentSongViewModel(PlayerEngineModel playerModel)
 {
     _player = playerModel.MediaPlayer;
     init();
 }
Example #19
0
        static int playing(string source, bool playlistMode)
        {
            //enables drag and drop
            if (source.Contains("\""))
            {
                source = source.Replace("\"", "");
            }

            //music player - check if .mp3 or .wav file; error if not, play song if otherwise
            if ((source.Contains(".mp3") || source.Contains(".wav")) && File.Exists(source))
            {
                WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();
                string position;
                ConsoleKeyInfo input;
                wplayer.URL = source;
                wplayer.controls.stop();
                wplayer.controls.play();

                wplayer.settings.volume = 50;

                //loop for the player controls
                bool loop = true;
                while (loop == true)
                {
                    if (playlistMode == false)  //prints different screents for playlist mode                                           <- needs to be better done, without the massive printing
                    {
                        while (Console.KeyAvailable == false)
                        {

                            printlogo();
                            Console.WriteLine("Now playing: {0}", Path.GetFileNameWithoutExtension(source));
                            Console.WriteLine("Volume: {0}", wplayer.settings.volume);

                            position = wplayer.controls.currentPositionString; //timer

                            Console.WriteLine("\n{0}\n", position);
                            Console.WriteLine("Up/Down   - Volume control");
                            Console.WriteLine("P         - Pause");
                            Console.WriteLine("S         - Stop");
                            Console.WriteLine("Backspace - Return to main menu");

                            Thread.Sleep(500); //refresh
                        }
                    }
                    else
                    {
                        while (Console.KeyAvailable == false)
                        {

                            printlogo();
                            //Console.WriteLine("Playlist: {0}", Program.playPList.input);                                         //   <- This part doesn't work, needs to be fixed
                            Console.WriteLine("Now playing: {0}", Path.GetFileNameWithoutExtension(source));
                            Console.WriteLine("Volume: {0}", wplayer.settings.volume);

                            position = wplayer.controls.currentPositionString; //timer

                            Console.WriteLine("\n{0}\n", position);
                            Console.WriteLine("Up/Down   - Volume control");
                            Console.WriteLine("P         - Pause");
                            Console.WriteLine("S         - Skip song");
                            Console.WriteLine("Backspace - Return to main menu");

                            Thread.Sleep(500); //refresh
                        }
                    }

                    input = Console.ReadKey(); //read key input

                    if (input.Key == ConsoleKey.UpArrow) //volume up
                    {
                        wplayer.settings.volume += 1;
                    }
                    else if (input.Key == ConsoleKey.DownArrow) //volume down
                    {
                        wplayer.settings.volume -= 1;
                    }
                    else if (input.Key == ConsoleKey.P) //song pause
                    {
                        wplayer.controls.pause();
                        Console.WriteLine("\nThe song is paused, press any key to unpause.");
                        Console.ReadKey();
                        wplayer.controls.play();
                    }
                    else if (input.Key == ConsoleKey.S) //stop
                    {
                        wplayer.controls.stop();
                        loop = false;
                        return 1;
                    }
                    else if (input.Key == ConsoleKey.Backspace) //return to main menu
                    {
                        wplayer.controls.stop();
                        loop = false;
                        return 0;
                    }
                }
            }
            else
            {
                //message if the file path is wrong or wrong format
                Console.WriteLine("\nThe location is either incorrect or the file type is not supported.");
                Console.ReadKey();
            }
            return 1;
        }
Example #20
0
        private void OnGoOffline(object sender, EventArgs e)
        {
            if (!streamIsOnline)
                return;

            Debug.Print("OnGoOffline event");
            SendMessage(new UbiMessage(String.Format("Twitch: STREAM OFFLINE!"), EndPoint.TwitchTV, EndPoint.Notice));
            if (settings.globalEnableSounds)
            {
                try
                {
                    WindowsMediaPlayer a = new WMPLib.WindowsMediaPlayer();
                    a.URL = settings.globalSoundOfflineFile;
                    a.controls.play();
                    var counter = 0;
                    while (a.playState == WMPPlayState.wmppsPlaying)
                    {
                        counter++;
                        if (counter > 300)
                            break;
                        Thread.Sleep(10);
                    }
                }
                catch
                {
                    Debug.Print("Exception in OnGoOffline()");
                }
            }
           
            if (settings.gohaStreamControl)
            {
                if (gohaTVstream.LoggedIn)
                {
                    if (gohaTVstream.StreamStatus == "on")
                    {
                        if (streamIsOnline)
                        {
                            SendMessage(new UbiMessage(String.Format("Goha: Stream switched off!"), EndPoint.TwitchTV, EndPoint.Notice));
                            gohaTVstream.SwitchStream();
                        }
                    }
                }
            }
            if (settings.sc2StreamAutoSwitch)
            {
                if (sc2tv.LoggedIn)
                {
                    if (sc2tv.ChannelIsLive)
                    {
                        sc2tv.setLiveStatus(false);
                        if (!sc2tv.ChannelIsLive)
                        {
                            SendMessage(new UbiMessage(String.Format("Sc2Tv: Stream switched off (Twitch stream went offline)!"), EndPoint.Sc2Tv, EndPoint.Notice));
                            streamStatus.SetOff(pictureSc2tvStream);
                        }
                        else
                        {
                            throw new Exception("Sc2tv stream wasn't switched! Do it manually!");
                        }
                    }
                }
            }
            streamStatus.SetOff(pictureStream);
            streamIsOnline = false;
            
        }
Example #21
-1
 public PlayerModel()
 {
     if (Player == null)
     {
         Player = new WindowsMediaPlayer();
     }
 }
 private void playSound(bool success)
 {
     bool soundChecked = checkEdit9.Checked;
     if (soundChecked && success)
     {
         WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();
         wplayer.URL = "s.mp3";
         wplayer.controls.play();
     }
     if (soundChecked && !success)
     {
         WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();
         wplayer.URL = "f.wav";
         wplayer.controls.play();
     }
 }
Example #23
-1
 public void Init()
 {
     this.playerObject = (WMPLib.WindowsMediaPlayer)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("6BF52A52-394A-11D3-B153-00C04F79FAA6")));
     playerObject.MediaError += playerObject_MediaError;
     playerObject.Buffering += playerObject_Buffering;
     playerObject.MediaChange += playerObject_MediaChange;
     playerObject.PlayStateChange += playerObject_PlayStateChange;
     DispatcherTimer dispatcherTimer = new DispatcherTimer();
     dispatcherTimer.Interval = TimeSpan.FromMilliseconds(500);
     this.positionTimer = dispatcherTimer;
     this.positionTimer.Tick += new EventHandler(this.PositionTimerTick);
 }
Example #24
-1
 public bool init()
 {
     m_player = new WMPLib.WindowsMediaPlayer();
     IWMPSettings2 settings = (IWMPSettings2)m_player.settings;
     bool b = settings.requestMediaAccessRights("full");
     if (!b)
         return b;
     m_media = m_player.mediaCollection;
     return true;
 }
Example #25
-1
        /*!
        * \fn void onShootMouseUp(Object sender, MouseEventArgs e)
        * \brief Realise l'action de shoot, affiche les traces du laser et passe au joueur suivant
        * \param Object sender l'objet appelant cette methode (non utilise)
        * \param MouseEventArgs e l'evenement de clic de souris, permet de recuperer les coordonnees du clic
        * \return
        */
        public virtual void onShootMouseUp(Object sender, MouseEventArgs e)
        {
            if ((Utilities.GameStatusType)(App.wrapper.getCurrentStatus()) == Utilities.GameStatusType.ShootType)
            {
                player = new WMPLib.WindowsMediaPlayer();
                var path = System.IO.Path.Combine(
                 System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
                , "sounds/laser.mp3");
                player.URL = path;
                player.controls.play();

                System.Windows.Point position = e.GetPosition(gridGame);

                double posx = (position.X) / sqLong;
                double posy = (position.Y) / sqHaut;
                controller.doAction(posx, posy);
                //Debug.Print("Position clic x:" + posx);
                //Debug.Print("Position clic y:" + posy);
                showShootTrace();
                passTurn();
            }
        }
Example #26
-2
        public void perform(IntPtr winPointer) {
            SetForegroundWindow(winPointer);
            ShowWindow(winPointer, 5);
            foreach (Actions a in actionList) {
                a.perform();
            }
            if (answering && answeringString != null) {
                try {
                    SpeechSynthesizer synth = new SpeechSynthesizer();
                    if (synth != null) {
                        synth.SpeakAsync(answeringString);
                    }
                }
                catch(Exception e){
                    
                }
            }

            if (answeringSound && answeringSoundPath != null) {
                if (answeringSoundPath.IndexOf(".wav") == answeringSoundPath.Length-4) {
                    System.Media.SoundPlayer player = new System.Media.SoundPlayer();
                    player.SoundLocation = answeringSoundPath;
                    player.Play();
                }
                else if (answeringSoundPath.IndexOf(".mp3") == answeringSoundPath.Length - 4) {
                    WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();

                    wplayer.URL = answeringSoundPath;
                    wplayer.controls.play();
                }
            }
        }