• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Controls.MediaElement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Controls.MediaElement的典型用法代码示例。如果您正苦于以下问题:C# MediaElement类的具体用法?C# MediaElement怎么用?C# MediaElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MediaElement类属于System.Windows.Controls命名空间,在下文中一共展示了MediaElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: App

        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard Silverlight initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Show graphics profiling information while debugging.
            if (System.Diagnostics.Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are handed off to GPU with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Disable the application idle detection by setting the UserIdleDetectionMode property of the
                // application's PhoneApplicationService object to Disabled.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }

            // Find the AlarmSound resource and store it
            alarmSound = (MediaElement)this.Resources["AlarmSound"];
        }
开发者ID:alum01,项目名称:Emergency-App,代码行数:37,代码来源:App.xaml.cs


示例2: OnApplyTemplate

        public override void OnApplyTemplate()
        {
            if (this.mediaElement != null)
            {
                this.mediaElement.Loaded -= this.Media_Loaded;
                this.mediaElement.MediaEnded -= this.MediaElement_MediaEnded;
            }

            if (this.playPauseButton != null)
            {
                this.playPauseButton.HoverClick -= this.PlayPauseButton_HoverClick;
            }

            base.OnApplyTemplate();

            this.mediaElement = this.Template.FindName(Media, this) as MediaElement;
            this.playPauseButton = this.Template.FindName(PlayPauseButton, this) as HoverDwellButton;

            if (this.mediaElement != null)
            {
                this.mediaElement.Loaded += this.Media_Loaded;
                this.mediaElement.MediaEnded += this.MediaElement_MediaEnded;
            }

            if (this.playPauseButton != null)
            {
                this.playPauseButton.HoverClick += this.PlayPauseButton_HoverClick;
            }
        }
开发者ID:GesTherapy,项目名称:Functional_Reaching,代码行数:29,代码来源:VideoPlayer.cs


示例3: Player

 private Player()
 {
     _player = new MediaElement();
     _player.LoadedBehavior = MediaState.Manual;
     _player.UnloadedBehavior = MediaState.Manual;
     _player.ScriptCommand += new EventHandler<MediaScriptCommandRoutedEventArgs>(RaiseSongChanged);
 }
开发者ID:EricLambrecht,项目名称:InternetRadio,代码行数:7,代码来源:Player.cs


示例4: Courses

        public Courses(SurfaceWindow1 parentWindow)
            : base(parentWindow)
        {
            InitializeComponent();
            DataContext = this;

            accordian_fx = new MediaElement();
            accordian_fx.LoadedBehavior = MediaState.Manual;
            accordian_fx.UnloadedBehavior = MediaState.Manual;
            accordian_fx.LoadedBehavior = MediaState.Manual;
            accordian_fx.Volume = 1.0;
            accordian_fx.IsMuted = false;

            Cse_items.Add(new DataItem("Description", new Controls.FlowDocControl("Resources/docs/specialisations/cse_info.xaml")));
            Cse_items.Add(new DataItem("Careers", new Controls.FlowDocControl("Resources/docs/specialisations/cse_careers.xaml")));
            Cse_items.Add(new DataItem("Courses", new Controls.CoursesControl("cse")));
            Cse_items.Add(new DataItem("Programme Advisor", new Controls.FlowDocControl("Resources/docs/specialisations/cse_advisor.xaml")));

            Se_items.Add(new DataItem("Description", new Controls.FlowDocControl("Resources/docs/specialisations/se_info.xaml")));
            Se_items.Add(new DataItem("Careers", new Controls.FlowDocControl("Resources/docs/specialisations/se_careers.xaml")));
            Se_items.Add(new DataItem("Courses", new Controls.CoursesControl("se")));
            Se_items.Add(new DataItem("Programme Advisor", new Controls.FlowDocControl("Resources/docs/specialisations/se_advisor.xaml")));

            Eee_items.Add(new DataItem("Description", new Controls.FlowDocControl("Resources/docs/specialisations/eee_info.xaml")));
            Eee_items.Add(new DataItem("Careers", new Controls.FlowDocControl("Resources/docs/specialisations/eee_careers.xaml")));
            Eee_items.Add(new DataItem("Courses", new Controls.CoursesControl("eee")));
            Eee_items.Add(new DataItem("Programme Advisor", new Controls.FlowDocControl("Resources/docs/specialisations/eee_advisor.xaml")));

            setControl(new Controls.FlowDocControl("Resources/docs/tap_course.xaml"));
        }
开发者ID:jcgharvey,项目名称:se306p2,代码行数:30,代码来源:Courses.xaml.cs


示例5: ServiceItem

        public ServiceItem()
        {
            VideoPlayer = new MediaElement();
            AudioPlayer = new MediaPlayer();

            //string loopFilter = "";

            //// specific filters to prevent announcement loops from being included in song loops
            //loopFilter = "background*.mp*";

            //FileInfo[] padsDi = new DirectoryInfo(Properties.Resources.PadPath).GetFiles("*.mp3");
            //FileInfo[] loopsDi = new DirectoryInfo(Properties.Resources.LoopPath).GetFiles(loopFilter);

            //Pads = new List<string>();

            //Pads.Add("");

            //foreach (FileInfo pad in padsDi)
            //    Pads.Add(System.IO.Path.GetFileNameWithoutExtension(pad.Name));

            //Loops = new List<string>();

            //Loops.Add("");

            //foreach (FileInfo loop in loopsDi)
            //    Loops.Add(System.IO.Path.GetFileNameWithoutExtension(loop.Name.Remove(0, loopFilter.Length - 4)));
        }
开发者ID:tobeyun,项目名称:MyPresenter,代码行数:27,代码来源:ServiceItem.cs


示例6: init

        public void init(List<MediaElement> mediaElements)
        {
            intro = mediaElements[0];
            death = mediaElements[1];
            eat_ghost = mediaElements[2];
            extra_life = mediaElements[3];
            eat_dot = mediaElements[4];
            eat_fruit = mediaElements[5];
            background = mediaElements[6];
            alarm = mediaElements[7];
            power = mediaElements[8];


            intro.MediaEnded += new RoutedEventHandler(Intro_Ended);
            death.MediaEnded += new RoutedEventHandler(Death_Ended);
            alarm.MediaEnded += new RoutedEventHandler(Alarm_Ended);
            background.MediaEnded += new RoutedEventHandler(Background_Ended);
            eat_dot.MediaEnded += new RoutedEventHandler(EatDot_Ended);
            power.MediaEnded += new RoutedEventHandler(Power_Ended);

            isAlarmPlaying = false;
            isBackgroundPlaying = false;
            isEatDotPlaying = false;
            isPowerPlaying = false;

            /*     intro.Source = new Uri(@"..\..\Sounds\pacman_song1.wav", UriKind.Relative);
                 death.Source = new Uri(@"..\..\Sounds\pacman_death.wav", UriKind.Relative);
                 eat_ghost.Source = new Uri(@"..\..\Sounds\pacman_getghost.wav", UriKind.Relative);
                 extra_life.Source = new Uri(@"..\..\Sounds\pacman_extralife.wav", UriKind.Relative);
                 eat_dot.Source = new Uri(@"..\..\Sounds\pacman_coinin.wav", UriKind.Relative);
                 eatfruit.Source = new Uri(@"..\..\Sounds\pacman_eatfruit.wav", UriKind.Relative);
                 background.Source = new Uri(@"..\..\Sounds\pacman_background1.wav", UriKind.Relative);
                 alarm.Source = new Uri(@"..\..\Sounds\pacman_alarm1.wav", UriKind.Relative);*/
        }
开发者ID:Nady93,项目名称:PacmanAlpha,代码行数:34,代码来源:SoundEffect.cs


示例7: VideoJigsawRectPiece

 public VideoJigsawRectPiece(MediaElement mediaElement, int col, int row, double pieceSize)
     : base(mediaElement, col, row, pieceSize)
 {
     this._origin = new Point((col * pieceSize), (double)(row * pieceSize));
     this.Position = new Point((col * pieceSize), (double)(row * pieceSize));
     base.InitShapeProperties();
 }
开发者ID:JeffJin,项目名称:JigsawPuzzel,代码行数:7,代码来源:VideoJigsawRectPiece.cs


示例8: VideoService

        public VideoService(
            Rectangle viewFinder,
            MediaElement player
            )
        {
            // Initial State
            _State = PlayState.Paused;
            _CanRecord = false;

            _Record = new SwitchableCommand(OnRecord);
            _Play = new SwitchableCommand(OnPlay);
            _Stop = new SwitchableCommand(OnPause);

            _ViewFinder = viewFinder;

            _Player = player;
            _Player.MediaEnded += MediaEnded;

            _CaptureSource = new CaptureSource();
            _CaptureSource.CaptureFailed += CaptureFailed;

            _FileSink = new FileSink();
            _Brush = new VideoBrush();

            _HasRecording = new BehaviorSubject<bool>(false);
        }
开发者ID:SNSB,项目名称:DiversityMobile,代码行数:26,代码来源:VideoService.cs


示例9: FullScreenPlayer

        public FullScreenPlayer(Node current, Player ucPlayer, MediaElement parent, TimeSpan now)
        {
            InitializeComponent();

            //if (!File.Exists(current.Filelocation))
            //{
            //    MessageBox.Show("文件不存在!!");
            //}
            //else
            //{
            //    VideoUtil.encode(current.Filelocation);
            //}
            this.parent = parent;
            this.current = current;
            this.ucPlayer = ucPlayer;
            player.Width = SystemParameters.VirtualScreenWidth;
            player.Height = SystemParameters.VirtualScreenHeight - 45;

            //wpfMediaPlayer.URL = current.Filelocation;

            //player.Play();

            DispatcherTimer timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick += timer_Tick;
            timer.Start();

            player.Source = new Uri(current.Filelocation, UriKind.Relative);
            player.Position = now;
            player.Play();
        }
开发者ID:huiyi-outsourcing,项目名称:SimuTraining,代码行数:31,代码来源:FullScreenPlayer.xaml.cs


示例10: TitleScreenPage

        public TitleScreenPage(Window win, MediaElement bgMusic)
        {
            main = win;
            music = bgMusic;

            InitializeComponent();
        }
开发者ID:insonia78,项目名称:project,代码行数:7,代码来源:TitleScreenPage.xaml.cs


示例11: enemyMissile

        public enemyMissile(double left, double top)
        {
            // use this to create the missile on the fly.
            // calling function is going to supply the
            // X Y Coordinate to create at.
            // set up a rectangle
            // fill in the values - background, picture,
            StackPanel panel = new StackPanel();
            Rectangle missileRect = new Rectangle();
            missileRect.Height = 3;
            missileRect.Width = 12;
            missileRect.Fill = new SolidColorBrush(Colors.Black );
            missileRect.Stroke = new SolidColorBrush(Colors.Yellow);
            missileRect.RadiusX = 1;
            missileRect.RadiusY = 1;
            panel.Children.Add(missileRect);

            MediaElement me = new MediaElement();
            me.Source = new Uri("/laser.mp3", UriKind.Relative);
            panel.Children.Add(me);

            this.Content = panel;
            Canvas.SetTop(this, top);
            Canvas.SetLeft(this, left);
            me.Play();
        }
开发者ID:BrianJVarley,项目名称:Side_Scroller_Mini_Game,代码行数:26,代码来源:enemyShip.cs


示例12: SetSourceAsync

        public Task SetSourceAsync(IMediaStreamSource source)
        {
            return Dispatch(() =>
            {
                source.ValidateEvent(MediaStreamFsm.MediaEvent.MediaStreamSourceAssigned);

                var wasSet = Interlocked.Exchange(ref _sourceIsSet, 1);

                Debug.Assert(0 == wasSet);

                if (null != _mediaElement)
                {
                    UiThreadCleanup();

                    var mediaElement = _mediaElement;
                    _mediaElement = null;

                    _destroyMediaElement(mediaElement);
                }

                _mediaElement = _createMediaElement();

                if (null != _mediaElement)
                    _mediaElement.SetSource((MediaStreamSource)source);
                else
                    Debug.WriteLine("MediaElementManager.SetSourceAsync() null media element");
            });
        }
开发者ID:Jesn,项目名称:MangGuoTv,代码行数:28,代码来源:MediaElementManager.cs


示例13: TV_Control

 public TV_Control(MediaElement mE)
 {
   Messenger.Default.Register<int>(this, "EPGRequest_ChannelChange", EPG_Request);
   delayChannelChangeTimer = new System.Timers.Timer(1000);
   delayChannelChangeTimer.Elapsed += new ElapsedEventHandler(DelayedChannelChange);
   this.mediaElement1 = mE;
 }
开发者ID:hirec,项目名称:SmartHomeV2,代码行数:7,代码来源:TV_Control.cs


示例14: WpfMediaPlayer

        public WpfMediaPlayer(MediaElement mediaElement)
        {
            if (mediaElement == null)
                throw new ArgumentNullException("mediaElement");

            this.mediaElement = mediaElement;
        }
开发者ID:hur1can3,项目名称:Espera,代码行数:7,代码来源:WpfMediaPlayer.cs


示例15: MediaFile

        public MediaFile(string path, DateTime startDate, DateTime endDate)
        {
            if (path == String.Empty)
            {
                throw new System.InvalidOperationException("Please enter a url for your media.");
            }
            else if (startDate == null || endDate == null)
            {
                throw new System.InvalidOperationException("Please enter a start and end date.");
            }

                this.url = path;
                this.fileName = path.Split('\\').Last();
                this.fileExt = fileName.Split('.').Last();
                this.fileName = fileName.Split('.').First();
                this.typeID = MediaFileUtilities.getFileTypeID(this.fileExt);
                this.fileType = MediaFileUtilities.getFileType(this.fileExt);
                MediaElement thisMediaFile = new MediaElement();
                thisMediaFile.Source = new Uri(path);
                this.width = (int)thisMediaFile.Width;
                this.height = (int)thisMediaFile.Height;
                this.dateStart = startDate;
                this.dateEnd = endDate;

            this.insertQuery = "INSERT INTO Media([url],[filename],[file_extension],[type_id],[width],[height],[date_start],[date_end])"
                    + "VALUES ('" + url + "','" + fileName + "','" + fileExt + "','" + typeID + "','" + width + "','"
                    + height + "','" + dateStart + "','" + dateEnd + "');";
        }
开发者ID:arjabbar,项目名称:PilotPlayer,代码行数:28,代码来源:MediaFile.cs


示例16: utworz_magiczne_zaklecie

        public MAGICZNE_ZAKLECIE utworz_magiczne_zaklecie(MediaElement m1, MediaElement m2, Canvas c1, Label l1)
        {
            MAGICZNE_ZAKLECIE magia = new MAGICZNE_ZAKLECIE();
            magia.wybierz_zaklecie(m1,m2,c1,l1);

            return magia;
        }
开发者ID:kira333,项目名称:MyProjects,代码行数:7,代码来源:PODSUMOWANIE.cs


示例17: DoublePlayer

        /// <summary>
        /// Initializes a new instance of the <see cref="DoublePlayer" /> class.
        /// </summary>
        /// <param name="player1">The player1.</param>
        /// <param name="progress1">The progress1.</param>
        /// <param name="remaining1">The remaining1.</param>
        /// <param name="p2">The p2.</param>
        /// <param name="progress2">The progress2.</param>
        /// <param name="remaining2">The remaining2.</param>
        public DoublePlayer(MediaElement player1, ProgressBar progress1, TextBlock remaining1, MediaElement p2, ProgressBar progress2, TextBlock remaining2)
        {
            _player1 = player1;
            _player1.MediaOpened += _player1_MediaOpened;
            _player1.LoadedBehavior = MediaState.Manual;
            _player1.UnloadedBehavior = MediaState.Stop;
            _player1.MediaEnded += _player1_MediaEnded;
            _progress1 = progress1;
            _remaining1 = remaining1;
            _player2 = p2;
            _player2.MediaOpened += _player2_MediaOpened;
            _player2.LoadedBehavior = MediaState.Manual;
            _player2.UnloadedBehavior = MediaState.Stop;
            _player2.MediaEnded += _player2_MediaEnded;
            _progress2 = progress2;
            _remaining2 = remaining2;

            // set the update timer for the progress bars
            _timerPlayer1.Interval = TimeSpan.FromMilliseconds(1000);
            _timerPlayer1.Tick += new EventHandler(TriggerUIRefresh);
            _timerPlayer1.Start();

            Active = _player1;
            InActive = _player2;
        }
开发者ID:Lords-Von-Handschreiber,项目名称:Juke-Mobile,代码行数:34,代码来源:DoublePlayer.cs


示例18: GameRepository_MediaElementAdded

 private void GameRepository_MediaElementAdded(MediaElement me)
 {
     if (!visualSoundsContainer.Children.Contains(me))
     {
         visualSoundsContainer.Children.Add(me);
     }
 }
开发者ID:MartyIX,项目名称:SoTh,代码行数:7,代码来源:Round.cs


示例19: DrawDialog

        public void DrawDialog(DialogGroup dialogControl)
        {
            this.CurrentDialog = dialogControl;

            Grid container = (Grid)LogicalTreeHelper.FindLogicalNode(WindowController.Get<MainWindow>(), "grid_View");

            Game.Instance.Player.Location.BlurBackground();

            this.Dialog = null;
            container.Children.RemoveRange(1, container.Children.Count);

            MediaElement pb = new MediaElement();
            if (this.CurrentDialog.Current().Image != null)
            {
                pb.Stretch = System.Windows.Media.Stretch.Uniform;
                pb.Name = "pb_Action";
                pb.StretchDirection = StretchDirection.Both;
                pb.Source = new Uri(this.CurrentDialog.Current().Image);
                pb.VerticalAlignment = VerticalAlignment.Center;
                pb.HorizontalAlignment = HorizontalAlignment.Center;
                container.Children.Add(pb);
            }
            
            container.PreviewMouseRightButtonUp += ToggleDialog;

            this.CurrentDialog.Current().PrepareBeginEffects(container);

            this.AddDialogControl();

            this.CurrentDialog.Current().StartBeginEffects();
        }
开发者ID:Tragedian-HLife,项目名称:HLife,代码行数:31,代码来源:DialogController.cs


示例20: OnElementChanged

    protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Frame> e)
    {
      base.OnElementChanged(e);
      if (Element == null)
        return;

      player = new MediaElement();
      player.AutoPlay = true;
      player.MediaOpened += (sender, args) =>
      {

        timer.Start();

      };
      this.Control.Child = player;

      timer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 1) };
      timer.Tick += timer_Tick;

      if (string.IsNullOrWhiteSpace(Player.Url))
        return;

      InitPlayer();
      
    }
开发者ID:Adam--,项目名称:Hanselman.Forms,代码行数:25,代码来源:AudioPlayerRenderer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Controls.Menu类代码示例发布时间:2022-05-26
下一篇:
C# Controls.ListViewItem类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap