Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MediaEngine" /> class.
        /// </summary>
        /// <param name="parent">The associated parent object.</param>
        /// <param name="connector">The parent implementing connector methods.</param>
        /// <exception cref="InvalidOperationException">Thrown when the static Initialize method has not been called.</exception>
        public MediaEngine(object parent, IMediaConnector connector)
        {
            // Associate the parent as the media connector that implements the callbacks
            Parent    = parent;
            Connector = connector;
            Commands  = new CommandManager(this);
            State     = new MediaEngineState(this);
            Timing    = new TimingController(this);

            // Don't start up timers or any other stuff if we are in design-time
            if (Platform.IsInDesignTime)
            {
                return;
            }

            // Check initialization has taken place
            lock (InitLock)
            {
                if (IsInitialized == false)
                {
                    throw new InvalidOperationException(
                              $"{nameof(MediaEngine)} not initialized. Call the static method {nameof(Initialize)}");
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MediaEngine" /> class.
        /// </summary>
        /// <param name="parent">The associated parent object.</param>
        /// <param name="connector">The parent implementing connector methods.</param>
        /// <exception cref="InvalidOperationException">Thrown when the static Initialize method has not been called.</exception>
        public MediaEngine(object parent, IMediaConnector connector)
        {
            // var props = typeof(MediaEngine).GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
            // foreach (var p in props)
            // {
            //     Console.WriteLine(p);
            // }

            // Assiciate the parent as the media connector that implements the callbacks
            Parent    = parent;
            Connector = connector;
            Commands  = new MediaCommandManager(this);

            // Don't start up timers or any other stuff if we are in design-time
            if (Platform.IsInDesignTime)
            {
                return;
            }

            // Check initialization has taken place
            lock (InitLock)
            {
                if (IsIntialized == false)
                {
                    throw new InvalidOperationException(
                              $"{nameof(MediaEngine)} not initialized. Call the static method {nameof(Initialize)}");
                }
            }
        }
Ejemplo n.º 3
0
 public SearchViewModel()
 {
     this.connector           = new SpotifyConnector();
     this.SearchArtistCommand = new RelayCommand <string>(this.SearchArtist);
     this.NavigationViewModel = new SearchNavigationViewModel(this);
     this.GoBackCommand       = this.NavigationViewModel.GoBackCommand;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MediaEngine" /> class.
 /// </summary>
 /// <param name="parent">The associated parent object.</param>
 /// <param name="connector">The parent implementing connector methods.</param>
 /// <exception cref="InvalidOperationException">Thrown when the static Initialize method has not been called.</exception>
 public MediaEngine(object parent, IMediaConnector connector)
 {
     // Associate the parent as the media connector that implements the callbacks
     Parent    = parent;
     Connector = connector;
     Commands  = new CommandManager(this);
     State     = new MediaEngineState(this);
     Timing    = new TimingController(this);
 }
 public GeneralGraphBuilder(IFilterRegister filterRegister,
                            IMediaConnector mediaConnector,
                            IErrorHandler errorHandler,
                            FilterGraph filterGraph)
 {
     this.filterRegister = filterRegister;
     this.mediaConnector = mediaConnector;
     this.errorHandler   = errorHandler;
     this.filterGraph    = filterGraph;
 }