• <tfoot id='MzDKY'></tfoot>
    • <bdo id='MzDKY'></bdo><ul id='MzDKY'></ul>

      <i id='MzDKY'><tr id='MzDKY'><dt id='MzDKY'><q id='MzDKY'><span id='MzDKY'><b id='MzDKY'><form id='MzDKY'><ins id='MzDKY'></ins><ul id='MzDKY'></ul><sub id='MzDKY'></sub></form><legend id='MzDKY'></legend><bdo id='MzDKY'><pre id='MzDKY'><center id='MzDKY'></center></pre></bdo></b><th id='MzDKY'></th></span></q></dt></tr></i><div id='MzDKY'><tfoot id='MzDKY'></tfoot><dl id='MzDKY'><fieldset id='MzDKY'></fieldset></dl></div>
    1. <legend id='MzDKY'><style id='MzDKY'><dir id='MzDKY'><q id='MzDKY'></q></dir></style></legend>

        <small id='MzDKY'></small><noframes id='MzDKY'>

        c# WPF 如何在不声明新源的情况下从 mediaended 事件处理程序重复 MediaElement 播放?

        c# WPF how to repeat MediaElement playback from mediaended event handler without declaring new source?(c# WPF 如何在不声明新源的情况下从 mediaended 事件处理程序重复 MediaElement 播放?)

          • <bdo id='h3HPG'></bdo><ul id='h3HPG'></ul>
            <tfoot id='h3HPG'></tfoot>

              <small id='h3HPG'></small><noframes id='h3HPG'>

                <tbody id='h3HPG'></tbody>
              <legend id='h3HPG'><style id='h3HPG'><dir id='h3HPG'><q id='h3HPG'></q></dir></style></legend>

              1. <i id='h3HPG'><tr id='h3HPG'><dt id='h3HPG'><q id='h3HPG'><span id='h3HPG'><b id='h3HPG'><form id='h3HPG'><ins id='h3HPG'></ins><ul id='h3HPG'></ul><sub id='h3HPG'></sub></form><legend id='h3HPG'></legend><bdo id='h3HPG'><pre id='h3HPG'><center id='h3HPG'></center></pre></bdo></b><th id='h3HPG'></th></span></q></dt></tr></i><div id='h3HPG'><tfoot id='h3HPG'></tfoot><dl id='h3HPG'><fieldset id='h3HPG'></fieldset></dl></div>

                • 本文介绍了c# WPF 如何在不声明新源的情况下从 mediaended 事件处理程序重复 MediaElement 播放?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在 WPF 中播放视频.我希望它循环播放,所以我所做的是当 mediaended 事件触发时,我播放我的视频.所以这会让我陷入困境.问题是为什么我必须再次创建新源?为什么我不能直接叫'play'?

                  I'm playing a video in WPF.i want it to loop so what I did is when the mediaended event fires, I play back my video. so this will get me a loop. prob is why do u I have to create new source again? why can't I just call 'play'?

                  出于某种原因,我不想在 XAML 中这样做.

                  I don't want to do it in XAML as for some reason.

                  看看我的代码片段:

                  string startPath System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
                  
                  
                  public Window1()
                      {
                          InitializeComponent();
                          media.Source = new Uri(startPath + @"playlist.wpl");
                          media.play();
                      }
                  
                  private void Media_Ended(object sender, EventArgs e)
                      {
                          media.Source = new Uri(startPath + @"playlist.wpl"); //if i dont put this line, video wont play..seems like it cant get the source
                          media.Play();
                      }
                  

                  或者是否有适当的方法来循环不是在 XAML 中而是在此处的 .cs 文件中?

                  or is there a proper way to loop NOT in XAML but in here .cs file?

                  推荐答案

                  不要在 Media_Ended 处理程序的开头重置 Source,而是尝试将 Position 值设置回起始位置.Position 属性是一个 TimeSpan,因此您可能想要...

                  Instead of resetting the Source at the start of your Media_Ended handler, try setting the Position value back to the start position. The Position property is a TimeSpan so you probably want something like...

                  private void Media_Ended(object sender, EventArgs e)
                  {
                      media.Position = TimeSpan.Zero;
                      media.Play();
                  }
                  

                  这篇关于c# WPF 如何在不声明新源的情况下从 mediaended 事件处理程序重复 MediaElement 播放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  C# namespace alias - what#39;s the point?(C# 命名空间别名 - 有什么意义?)
                  Using Xpath With Default Namespace in C#(在 C# 中使用具有默认命名空间的 Xpath)
                  Generating an EDMX from a DB2 Database(从 DB2 数据库生成 EDMX)
                  IBM .NET Data Provider Connection String issue with Library List(库列表的 IBM .NET 数据提供程序连接字符串问题)
                  .NET DB2 OLEDB pre-requisites(.NET DB2 OLEDB 先决条件)
                  Referring to Code in IBM.Data.DB2 makes that Assembly Unavailable to the rest of my Solution(引用 IBM.Data.DB2 中的代码使该程序集对我的解决方案的其余部分不可用)
                  • <legend id='xb0uN'><style id='xb0uN'><dir id='xb0uN'><q id='xb0uN'></q></dir></style></legend>
                      <tbody id='xb0uN'></tbody>
                        <bdo id='xb0uN'></bdo><ul id='xb0uN'></ul>

                          <tfoot id='xb0uN'></tfoot>

                          <small id='xb0uN'></small><noframes id='xb0uN'>

                        1. <i id='xb0uN'><tr id='xb0uN'><dt id='xb0uN'><q id='xb0uN'><span id='xb0uN'><b id='xb0uN'><form id='xb0uN'><ins id='xb0uN'></ins><ul id='xb0uN'></ul><sub id='xb0uN'></sub></form><legend id='xb0uN'></legend><bdo id='xb0uN'><pre id='xb0uN'><center id='xb0uN'></center></pre></bdo></b><th id='xb0uN'></th></span></q></dt></tr></i><div id='xb0uN'><tfoot id='xb0uN'></tfoot><dl id='xb0uN'><fieldset id='xb0uN'></fieldset></dl></div>