Exemple #1
0
        // Token: 0x06005176 RID: 20854 RVA: 0x0016D458 File Offset: 0x0016B658
        static MediaElement()
        {
            MediaElement.MediaFailedEvent      = EventManager.RegisterRoutedEvent("MediaFailed", RoutingStrategy.Bubble, typeof(EventHandler <ExceptionRoutedEventArgs>), typeof(MediaElement));
            MediaElement.MediaOpenedEvent      = EventManager.RegisterRoutedEvent("MediaOpened", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MediaElement));
            MediaElement.BufferingStartedEvent = EventManager.RegisterRoutedEvent("BufferingStarted", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MediaElement));
            MediaElement.BufferingEndedEvent   = EventManager.RegisterRoutedEvent("BufferingEnded", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MediaElement));
            MediaElement.ScriptCommandEvent    = EventManager.RegisterRoutedEvent("ScriptCommand", RoutingStrategy.Bubble, typeof(EventHandler <MediaScriptCommandRoutedEventArgs>), typeof(MediaElement));
            MediaElement.MediaEndedEvent       = EventManager.RegisterRoutedEvent("MediaEnded", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MediaElement));
            Style defaultValue = MediaElement.CreateDefaultStyles();

            FrameworkElement.StyleProperty.OverrideMetadata(typeof(MediaElement), new FrameworkPropertyMetadata(defaultValue));
            MediaElement.StretchProperty.OverrideMetadata(typeof(MediaElement), new FrameworkPropertyMetadata(Stretch.Uniform, FrameworkPropertyMetadataOptions.AffectsMeasure));
            MediaElement.StretchDirectionProperty.OverrideMetadata(typeof(MediaElement), new FrameworkPropertyMetadata(StretchDirection.Both, FrameworkPropertyMetadataOptions.AffectsMeasure));
            ControlsTraceLogger.AddControl(TelemetryControls.MediaElement);
        }
Exemple #2
0
        static MediaElement()
        {
            MediaElement.SourceProperty           = DependencyProperty.Register("Source", typeof(Uri), typeof(MediaElement), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender, new PropertyChangedCallback(AVElementHelper.OnSourceChanged)));
            MediaElement.VolumeProperty           = DependencyProperty.Register("Volume", typeof(double), typeof(MediaElement), new FrameworkPropertyMetadata(0.5, FrameworkPropertyMetadataOptions.None, new PropertyChangedCallback(MediaElement.VolumePropertyChanged)));
            MediaElement.BalanceProperty          = DependencyProperty.Register("Balance", typeof(double), typeof(MediaElement), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.None, new PropertyChangedCallback(MediaElement.BalancePropertyChanged)));
            MediaElement.IsMutedProperty          = DependencyProperty.Register("IsMuted", typeof(bool), typeof(MediaElement), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.None, new PropertyChangedCallback(MediaElement.IsMutedPropertyChanged)));
            MediaElement.ScrubbingEnabledProperty = DependencyProperty.Register("ScrubbingEnabled", typeof(bool), typeof(MediaElement), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.None, new PropertyChangedCallback(MediaElement.ScrubbingEnabledPropertyChanged)));
            MediaElement.UnloadedBehaviorProperty = DependencyProperty.Register("UnloadedBehavior", typeof(MediaState), typeof(MediaElement), new FrameworkPropertyMetadata(MediaState.Close, FrameworkPropertyMetadataOptions.None, new PropertyChangedCallback(MediaElement.UnloadedBehaviorPropertyChanged)));
            MediaElement.LoadedBehaviorProperty   = DependencyProperty.Register("LoadedBehavior", typeof(MediaState), typeof(MediaElement), new FrameworkPropertyMetadata(MediaState.Play, FrameworkPropertyMetadataOptions.None, new PropertyChangedCallback(MediaElement.LoadedBehaviorPropertyChanged)));
            MediaElement.StretchProperty          = Viewbox.StretchProperty.AddOwner(typeof(MediaElement));
            MediaElement.StretchDirectionProperty = Viewbox.StretchDirectionProperty.AddOwner(typeof(MediaElement));
            MediaElement.MediaFailedEvent         = EventManager.RegisterRoutedEvent("MediaFailed", RoutingStrategy.Bubble, typeof(EventHandler <ExceptionRoutedEventArgs>), typeof(MediaElement));
            MediaElement.MediaOpenedEvent         = EventManager.RegisterRoutedEvent("MediaOpened", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MediaElement));
            MediaElement.BufferingStartedEvent    = EventManager.RegisterRoutedEvent("BufferingStarted", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MediaElement));
            MediaElement.BufferingEndedEvent      = EventManager.RegisterRoutedEvent("BufferingEnded", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MediaElement));
            MediaElement.ScriptCommandEvent       = EventManager.RegisterRoutedEvent("ScriptCommand", RoutingStrategy.Bubble, typeof(EventHandler <MediaScriptCommandRoutedEventArgs>), typeof(MediaElement));
            MediaElement.MediaEndedEvent          = EventManager.RegisterRoutedEvent("MediaEnded", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MediaElement));
            Style defaultValue = MediaElement.CreateDefaultStyles();

            FrameworkElement.StyleProperty.OverrideMetadata(typeof(MediaElement), new FrameworkPropertyMetadata(defaultValue));
            MediaElement.StretchProperty.OverrideMetadata(typeof(MediaElement), new FrameworkPropertyMetadata(Stretch.Uniform, FrameworkPropertyMetadataOptions.AffectsMeasure));
            MediaElement.StretchDirectionProperty.OverrideMetadata(typeof(MediaElement), new FrameworkPropertyMetadata(StretchDirection.Both, FrameworkPropertyMetadataOptions.AffectsMeasure));
        }