当前位置: 首页>>代码示例>>C#>>正文


C# System.Media.SoundPlayer.Load方法代码示例

本文整理汇总了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();
 }
开发者ID:JJgutierrez,项目名称:Team-Offense,代码行数:8,代码来源:OffenseMode.cs

示例2: MainForm

 public MainForm() {
     InitializeComponent();
     pa.KeyPressEvent += Pa_KeyPressEvent;
     pa.Start();
     player = new System.Media.SoundPlayer(@"Resources\1.wav");
     player.Load();
 }
开发者ID:xxy1991,项目名称:cozy,代码行数:7,代码来源:MainForm.cs

示例3: playSound

 private void playSound(string path)
 {
     System.Media.SoundPlayer player = new System.Media.SoundPlayer();
     player.SoundLocation = path;
     player.Load();
     player.Play();
 }
开发者ID:tmargacz,项目名称:Szyfrator,代码行数:7,代码来源:SHOW_SOURCE_WINDOW_3.cs

示例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();
        }
开发者ID:mtomana,项目名称:beatrice,代码行数:26,代码来源:SlideManager.cs

示例5: Winner2

 public Winner2()
 {
     InitializeComponent();
     System.Media.SoundPlayer timeclap = new System.Media.SoundPlayer();
     timeclap.Stream = Properties.Resources.Clap;
     timeclap.Load();
     timeclap.Play();
 }
开发者ID:NCCUCS-Windows-Programming,项目名称:HitRat,代码行数:8,代码来源:Winner2.xaml.cs

示例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();
     }
 }
开发者ID:DeadDreamer,项目名称:enslaver2000,代码行数:10,代码来源:SoundHelper.cs

示例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();
     }
 }
开发者ID:makroground,项目名称:BattleFood,代码行数:10,代码来源:frm_start.cs

示例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();
        }
开发者ID:MetLob,项目名称:tinke,代码行数:14,代码来源:iWav.cs

示例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);
            }
        }
开发者ID:jvbsl,项目名称:LiveCodingChat,代码行数:21,代码来源:Program.cs

示例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();
        }
开发者ID:renning22,项目名称:SnifferPlayer,代码行数:77,代码来源:FormMain.cs

示例11: alarm

 public void alarm()
 {
     System.Media.SoundPlayer player = new System.Media.SoundPlayer(Properties.Resources.mtl);
     player.Load();
     player.PlayLooping();
 }
开发者ID:daiyyr,项目名称:yuescount,代码行数:6,代码来源:Form1.cs

示例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");
        }
开发者ID:B3J4y,项目名称:Poker,代码行数:23,代码来源:MainWindow.xaml.cs

示例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();
        }
开发者ID:764664,项目名称:SimpleKaraoke,代码行数:20,代码来源:Form2.cs

示例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();
 }
开发者ID:eduardofreak,项目名称:Juegodelaserpiente,代码行数:32,代码来源:Form1.cs

示例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);
        }
开发者ID:klot-git,项目名称:scrum-factory,代码行数:91,代码来源:TasksListViewModel.cs


注:本文中的System.Media.SoundPlayer.Load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。