4 Replies - 1236 Views - Last Post: 25 November 2012 - 08:07 AM Rate Topic: -----

#1 gigaph   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 24-November 12

Problem to add sounds to your metro style software

Posted 24 November 2012 - 07:44 PM

i tried to use code in How to add sounds to your software but i can't use them in windows store / metro style platform, what should i do?

This post has been edited by GunnerInc: 24 November 2012 - 07:55 PM
Reason for edit:: Re formatted

Is This A Good Question/Topic? 0
  • +

Replies To: Problem to add sounds to your metro style software

#2 tlhIn`toq   User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6537
  • View blog
  • Posts: 14,450
  • Joined: 02-June 10

Re: Problem to add sounds to your metro style software

Posted 24 November 2012 - 09:04 PM

What does "can't use them" mean? 'Them' what? Resources? SoundPlayer class.

Lets see your R&D code for giving it a try, and the error(s) you got and we might see what we can come up with.
Was This Post Helpful? 0
  • +
  • -

#3 gigaph   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 24-November 12

Re: Problem to add sounds to your metro style software

Posted 25 November 2012 - 07:49 AM

Here's the problems:

1. I can't use
 using System.Media; 
and the error list told me: "The type or namespace name 'Media' does not exist in the namespace 'System' (are you missing an assembly reference?)"

2. If I use SoundPlayer instance like this
 SoundPlayer My_JukeBox = new SoundPlayer(@"C:\WINDOWS\Media\ding.wav"); 
the error list also told me: "The type or namespace name 'SoundPlayer' could not be found (are you missing a using directive or an assembly reference?"

Could you please tell me what should I do to add sound to my windows store software and to play it if I click the button?

Thank you.
Was This Post Helpful? 0
  • +
  • -

#4 tlhIn`toq   User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6537
  • View blog
  • Posts: 14,450
  • Joined: 02-June 10

Re: Problem to add sounds to your metro style software

Posted 25 November 2012 - 08:01 AM

http://msdn.microsof...stem.media.aspx

I didn't have to add any references. Just the using statement seen in line 15. Line 31 shows the use of the SoundPlayer class.

Did you perhaps target .NET version 1.1? The media class is only available in 2.0 and higher.

Attached Image

This post has been edited by tlhIn`toq: 25 November 2012 - 08:05 AM

Was This Post Helpful? 0
  • +
  • -

#5 tlhIn`toq   User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6537
  • View blog
  • Posts: 14,450
  • Joined: 02-June 10

Re: Problem to add sounds to your metro style software

Posted 25 November 2012 - 08:07 AM

Afterthought: What is the project type for your solution?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1