本文整理汇总了C#中System.Media.SoundPlayer.Load方法的典型用法代码示例。如果您正苦于以下问题:C# System.Media.SoundPlayer.Load方法的具体用法?C# System.Media.SoundPlayer.Load怎么用?C# System.Media.SoundPlayer.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Media.SoundPlayer
的用法示例。
在下文中一共展示了System.Media.SoundPlayer.Load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LaserSound
public void LaserSound()
{
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = "peww1.wav";
player.Load();
player.Play();
player.Play();
}
示例2: MainForm
public MainForm() {
InitializeComponent();
pa.KeyPressEvent += Pa_KeyPressEvent;
pa.Start();
player = new System.Media.SoundPlayer(@"Resources\1.wav");
player.Load();
}
示例3: playSound
private void playSound(string path)
{
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = path;
player.Load();
player.Play();
}
示例4: Init
public static void Init(Player player)
{
SoundPlayer = new System.Media.SoundPlayer();
ClickSoundPlayer = new System.Media.SoundPlayer(Properties.Resources.clickDefault);
ClickSoundPlayer.Load();
VolumeSoundPlayer = new System.Media.SoundPlayer(Properties.Resources.clickVolume);
VolumeSoundPlayer.Load();
VolumeEndOfScaleSoundPlayer = new System.Media.SoundPlayer(Properties.Resources.cyk);
VolumeEndOfScaleSoundPlayer.Load();
EndOfListSoundPlayer = new System.Media.SoundPlayer(Properties.Resources.zium);
EndOfListSoundPlayer.Load();
Slides = new List<Slide>();
SlideManager.playerForm = player;
playerForm.FormClosed += (s, e) =>
{
SlideManager.Dispose();
SoundPlayer.Dispose();
ClickSoundPlayer.Dispose();
VolumeSoundPlayer.Dispose();
};
LoadSlidesDefinitions();
}
示例5: Winner2
public Winner2()
{
InitializeComponent();
System.Media.SoundPlayer timeclap = new System.Media.SoundPlayer();
timeclap.Stream = Properties.Resources.Clap;
timeclap.Load();
timeclap.Play();
}
示例6: PlaySoundFile
public void PlaySoundFile(string pathToFile)
{
if (File.Exists(pathToFile))
{
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = pathToFile;
player.Load();
player.Play();
}
}
示例7: playmusic
void playmusic()
{
if(Properties.Settings.music_on)
{
System.Media.SoundPlayer player = new System.Media.SoundPlayer(new MemoryStream(Properties.Resources.frametraxx_Manga_Action));
frm_options.music_playing = Properties.Settings.music_on;
player.Load();
player.Play();
}
}
示例8: iWav
public iWav(string archivo, IPluginHost pluginHost)
{
InitializeComponent();
this.pluginHost = pluginHost;
ReadLanguage();
FileStream fs = new FileStream(archivo, FileMode.Open);
snd = new System.Media.SoundPlayer(fs);
snd.Load();
fs.Close();
fs.Dispose();
btnPlay.PerformClick();
}
示例9: Main
public static void Main(string[] args)
{
string dir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly ().Location);
try{
player = new System.Media.SoundPlayer (System.IO.Path.Combine (dir, "sound.wav"));
player.Load();
}
catch(Exception ex){player = null;}
run = true;
string username;
Console.Write ("Username:");
username = Console.ReadLine ();
session = new LiveCodingChat.Livecoding.LivecodingSession (ReadLoginMethod(),username);
session.PasswordRequested += Session_PasswordRequested;
session.SessionAutenticated += Session_SessionAutenticated;
session.EnsureAuthenticated ();
while (run) {//TODO: wird eine gui anwendung :P
System.Threading.Thread.Sleep (10);
}
}
示例10: Finish
/// <summary>
/// 下载完成(需要判断下载完成还是用户手动停止)
/// </summary>
public void Finish(object e)
{
//如果需要在安全的线程上下文中执行
if (this.InvokeRequired)
{
this.Invoke(new AcTaskDelegate(Finish), e);
return;
}
ParaFinish p = (ParaFinish)e;
TaskInfo task = p.SourceTask;
ListViewItem item = (ListViewItem)task.UIItem;
//设置完成时间
task.FinishTime = DateTime.Now;
//如果下载成功
if (p.Successed)
{
//更新item
item.SubItems[GetColumn("Status")].Text = task.Status.ToString();
item.SubItems[GetColumn("Name")].Text = task.Title;
item.SubItems[GetColumn("Progress")].Text = @"100%"; //下载进度
item.SubItems[GetColumn("Speed")].Text = ""; //下载速度
//打开文件夹
if (Config.setting.OpenFolderAfterComplete)
Process.Start(Config.setting.SavePath);
//播放声音
if (Config.setting.PlaySound)
{
try
{
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
//优先播放设置文件中的声音(必须是wav格式&忽略大小写)
if (File.Exists(Config.setting.SoundFile) && Config.setting.SoundFile.EndsWith(".wav", StringComparison.CurrentCultureIgnoreCase))
{
player.SoundLocation = Config.setting.SoundFile;
}
else
{
//然后播放程序目录下的msg.wav文件
if (File.Exists(Path.Combine(Application.StartupPath, "msg.wav")))
{
player.SoundLocation = Path.Combine(Application.StartupPath, "msg.wav");
}
else //如果都没有则播放资源文件中的声音文件
{
player.Stream = Resources.remind;
}
}
player.Load();
player.Play();
player.Dispose();
}
catch { }
}
}
else //如果用户取消下载
{
if (item != null)
{
//更新item
item.SubItems[GetColumn("Status")].Text = task.Status.ToString();
item.SubItems[GetColumn("Speed")].Text = ""; //下载速度
}
}
//移除item
if (lsv.Items.Contains(item))
if (!IsMatchCurrentFilter(task))
lsv.Items.Remove(item);
//继续下一任务或关机
ProcessNext();
}
示例11: alarm
public void alarm()
{
System.Media.SoundPlayer player = new System.Media.SoundPlayer(Properties.Resources.mtl);
player.Load();
player.PlayLooping();
}
示例12: playSound
private void playSound(string file)
{
log.Debug("playsound("+ file +") - Begin");
if (sound)
{
var path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\Res\\Sounds\\" + file + ".wav";
log.Debug(path.ToString());
System.Media.SoundPlayer sp = new System.Media.SoundPlayer(path);
try
{
sp.Load();
sp.Play();
}
catch (System.IO.FileNotFoundException exp)
{
log.Debug("File not found ex" + exp.ToString());
log.Debug(path.ToString());
}
}
log.Debug("playsound() - End");
}
示例13: button1_Click
private void button1_Click(object sender, EventArgs e)
{
// this.axWindowsMediaPlayer1.URL = this.Text;
player = new System.Media.SoundPlayer();
player.SoundLocation = this.Text;
player.Load();
player.Play();
capturebuffer.Start(true);
if (File.Exists(Path.GetDirectoryName(file) + "//" + Path.GetFileNameWithoutExtension(file) + ".lrc"))
{
th = new Thread(new ThreadStart(DisplayLyrics));
th.Start();
}
th2 = new Thread(new ThreadStart(SleepT));
th2.Start();
// LyricTimer();
}
示例14: Reiniciar
private void Reiniciar()
{
//Mandamos a llamar el sonido
System.Media.SoundPlayer SonidoComida = new System.Media.SoundPlayer(Properties.Resources.Perder);
SonidoComida.Load();
SonidoComida.Play();
//Cuando tocas haces colision, el timer pasa a false y mostramos el msj
timer1.Enabled = false;
MessageBox.Show("Perdiste. \nTu Puntuacion es " + puntuacion);
//Agregamos la puntuacion
/*Puntuacion.Add(puntuacion);*/
player.Puntos = puntuacion;
//Volvemos a cero las puntuaciones
BarraPuntuacionSerpiente.Text = "0";
puntuacion = 0;
//Volvemos a cero los niveles
BarraDeNivel.Text = "0";
//Reiniciamos el timer de la velocidad
timer1.Interval = 140;
//Modificamos los botones, cuadros de texto y labels, para que se presentar como uno quiere
BotonIniciar.Enabled = false;
BotonInstrucciones.Enabled = true;
BotonPuntuaciones.Enabled = true;
clearBtn.Enabled = true;
NombreTxt.Visible = true;
BtnAgregar.Visible = true;
LblIngresa.Visible = true;
NombreTxt.Enabled = true;
BtnAgregar.Enabled = true;
//Iniciamos el nuevo juego
serpiente = new Serpiente();
}
示例15: TasksListViewModel
public TasksListViewModel(
[Import] ITasksService tasksService,
[Import] IBacklogService backlogService,
[Import] IBackgroundExecutor backgroundExecutor,
[Import] IEventAggregator eventAggregator,
[Import] IDialogService dialogService,
[Import] IAuthorizationService authorizationService)
{
this.tasksService = tasksService;
this.backlogService = backlogService;
this.executor = backgroundExecutor;
this.aggregator = eventAggregator;
this.dialogs = dialogService;
this.authorizator = authorizationService;
tasksViewSource = new System.Windows.Data.CollectionViewSource();
tasksViewSource.SortDescriptions.Add(new SortDescription("Task.Priority", ListSortDirection.Descending));
tasksViewSource.SortDescriptions.Add(new SortDescription("Task.TaskType", ListSortDirection.Descending));
tasksViewSource.SortDescriptions.Add(new SortDescription("Task.TaskNumber", ListSortDirection.Descending));
tasksViewSource.Filter += new System.Windows.Data.FilterEventHandler(tasksViewSource_Filter);
delayFilter = new DelayAction(500, new DelayAction.ActionDelegate(Refresh));
backlogViewSource = new System.Windows.Data.CollectionViewSource();
backlogViewSource.SortDescriptions.Add(new SortDescription("SprintNumber", ListSortDirection.Ascending));
backlogViewSource.SortDescriptions.Add(new SortDescription("OccurrenceConstraint", ListSortDirection.Ascending));
backlogViewSource.SortDescriptions.Add(new SortDescription("BusinessPriority", ListSortDirection.Ascending));
backlogViewSource.SortDescriptions.Add(new SortDescription("BacklogItemNumber", ListSortDirection.Ascending));
clockUpdate = new DelayAction(1000, new DelayAction.ActionDelegate(UpdateClock), false);
player = new System.Media.SoundPlayer();
player.Stream = Properties.Resources.whistles;
player.Load();
ListMode = ListModes.POST_IT_MODE;
NewTaskType = (short)TaskTypes.DEVELOPMENT_TASK;
OnLoadCommand = new DelegateCommand(() => { if (NeedRefresh) LoadData(); });
ShowDetailWindowCommand = new DelegateCommand<TaskViewModel>(ShowDetail);
CreateTaskCommand = new DelegateCommand(CanCreateTask, CreateTask);
CreateEmptyTaskCommand = new DelegateCommand(CanCreateEmptyTask, CreateTask);
ChangeListModeCommand = new DelegateCommand(ChangeListMode);
MoveTaskCommand = new DelegateCommand<Windows.Helpers.DragDrop.DropCommandParameter>(MoveTask);
ChangeTaskItemCommand = new DelegateCommand<Windows.Helpers.DragDrop.DropCommandParameter>(ChangeTaskItem);
ShowJoinDialogCommand = new DelegateCommand(CanJoinProject, ShowJoinDialog);
StartStopClockCommand = new DelegateCommand(StartStopClock);
SetNewTaskTypeCommand = new DelegateCommand<Int16>(t => { NewTaskType = t; });
CopyTasksCommand = new DelegateCommand(CopyTasksToClipboard);
PasteTasksCommand = new DelegateCommand(PasteTasks);
SelectAllTasksCommand = new DelegateCommand(SelectAllTasks);
CloseItemCommand = new DelegateCommand<BacklogItem>(CloseItem);
AddNewTagCommand = new DelegateCommand(CanAddTags, AddNewTag);
RemoveTagCommand = new DelegateCommand<TaskTag>(CanAddTags, RemoveTag);
UpdateTagCommand = new DelegateCommand<TaskTag>(CanAddTags, UpdateTag);
aggregator.Subscribe<Project>(ScrumFactoryEvent.ViewProjectDetails, p => {
Project = p;
StopClock();
OnPropertyChanged("CurrentSprintLabel");
});
aggregator.Subscribe<ICollection<MemberProfile>>(ScrumFactoryEvent.ProjectMembersChanged, OnMembersChanged);
aggregator.Subscribe<ICollection<Role>>(ScrumFactoryEvent.ProjectRolesChanged, OnRolesChanged);
aggregator.Subscribe<Task>(ScrumFactoryEvent.TaskChanged, OnTaskChanged);
aggregator.Subscribe(ScrumFactoryEvent.ApplicationWhentForeground, OnAppForeground);
aggregator.Subscribe<BacklogItem>(ScrumFactoryEvent.ShowTasksForItem, ShowTasksForItem);
aggregator.Subscribe<BacklogItem[]>(ScrumFactoryEvent.BacklogItemsChanged, UpdateChangedItems);
aggregator.Subscribe(ScrumFactoryEvent.SprintsShifted, AskForRefresh);
aggregator.Subscribe<Project>(ScrumFactoryEvent.ProjectStatusChanged, SetReplanItemWhenChanged);
aggregator.Subscribe<Task>(ScrumFactoryEvent.TaskSelectedChanged, OnTaskSelectedChanged);
}