當前位置: 首頁>>代碼示例>>C#>>正文


C# Controls.MediaElement類代碼示例

本文整理匯總了C#中System.Windows.Controls.MediaElement的典型用法代碼示例。如果您正苦於以下問題:C# MediaElement類的具體用法?C# MediaElement怎麽用?C# MediaElement使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MediaElement類屬於System.Windows.Controls命名空間,在下文中一共展示了MediaElement類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的System.Windows.Controls.MediaElement類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。