Ejemplo n.º 1
0
        /// <summary>
        /// Beendet eine Aufzeichnung.
        /// </summary>
        /// <param name="sourceName">Der Name des Senders.</param>
        /// <param name="key">Die Identifikation der Aufzeichnung.</param>
        public void StopRecordingFeed(string sourceName, string key)
        {
            // Look it up
            var source = m_provider.Translate(sourceName);

            if (source == null)
            {
                throw new ArgumentException("unbekannter sender", "sourceName");
            }

            // Find the feed
            var feed = FindFeed(source);

            if (feed == null)
            {
                return;
            }
            else if (!feed.IsRecording(key))
            {
                return;
            }

            // Prepare the change
            using (var tx = new FeedTransaction(this))
            {
                // Mark as active
                tx.DisableRecording(feed, key);

                // Avoid cleanup
                tx.Commit();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Beendet alle Aufträge.
        /// </summary>
        public void Shutdown()
        {
            // Prepare the change
            using (var tx = new FeedTransaction(this))
            {
                // All feeds
                foreach (var feed in Feeds)
                {
                    // Primary
                    if (feed.IsPrimaryView)
                    {
                        tx.DisablePrimaryView(feed);
                    }

                    // Secondary
                    if (feed.IsSecondaryView)
                    {
                        tx.DisableSecondaryView(feed);
                    }

                    // Recording
                    foreach (var recording in feed.Recordings.ToArray())
                    {
                        tx.DisableRecording(feed, recording);
                    }
                }

                // Process all
                tx.Commit();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Verändert die primäre Anzeige.
        /// </summary>
        /// <param name="sourceName">Die neue primäre Anzeige.</param>
        /// <returns>Gesetzt, wenn die Änderung erfolgreich war.</returns>
        public bool TryStartPrimaryFeed(string sourceName)
        {
            // Look it up
            var source = m_provider.Translate(sourceName);

            if (source == null)
            {
                throw new ArgumentException("unbekannter sender", "sourceName");
            }

            // Find the feed
            var feed = FindFeed(source);

            if (feed != null)
            {
                if (feed.IsPrimaryView)
                {
                    return(true);
                }
            }

            // Device we schedule on
            Device device;

            // Prepare the change
            using (var tx = new FeedTransaction(this))
            {
                // See if we are secondary
                if (feed != null)
                {
                    if (feed.IsSecondaryView)
                    {
                        tx.DisableSecondaryView(feed);
                    }
                }

                // Locate the current primary view
                var previous = PrimaryView;
                if (previous != null)
                {
                    tx.DisablePrimaryView(previous);
                }

                // Make sure we can receive it
                device = EnsurePrimaryFeed(source, tx);
                if (device == null)
                {
                    return(false);
                }

                // Avoid cleanup
                tx.Commit();
            }

            // Schedule for report
            device.FireWhenAvailable(source.Source, OnPrimaryViewChanged);

            // Report success
            return(true);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Beginnt eine Aufzeichnung.
        /// </summary>
        /// <param name="sourceName">Der Name des Senders.</param>
        /// <param name="key">Die Identifikation der Aufzeichnung.</param>
        /// <returns>Gesetzt, wenn der Start erfolgreich war.</returns>
        public bool TryStartRecordingFeed(string sourceName, string key)
        {
            // Look it up
            var source = m_provider.Translate(sourceName);

            if (source == null)
            {
                throw new ArgumentException("unbekannter sender", "sourceName");
            }

            // Find the feed
            var feed = FindFeed(source);

            if (feed != null)
            {
                if (feed.IsRecording(key))
                {
                    return(false);
                }
            }

            // Device to use
            Device device;

            // Prepare the change
            using (var tx = new FeedTransaction(this))
            {
                // Make sure we can receive it
                device = EnsureRecordingFeed(source, tx);
                if (device == null)
                {
                    return(false);
                }

                // Avoid cleanup
                tx.Commit();
            }

            // Report recording
            device.FireWhenAvailable(source.Source, key, OnRecordingChanged);

            // May want to make it primary
            if (PrimaryView == null)
            {
                device.FireWhenAvailable(source.Source, OnPrimaryViewChanged);
            }

            // Report success
            return(true);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Verändert eine sekundäre Anzeige.
        /// </summary>
        /// <param name="sourceName">Der Name des Senders.</param>
        /// <returns>Gesetzt, wenn die Änderung erfolgreich war.</returns>
        public bool TryStartSecondaryFeed(string sourceName)
        {
            // Look it up
            var source = m_provider.Translate(sourceName);

            if (source == null)
            {
                throw new ArgumentException("unbekannter sender", "sourceName");
            }

            // Find the feed
            var feed = FindFeed(source);

            if (feed != null)
            {
                if (feed.IsSecondaryView)
                {
                    return(true);
                }
                else if (feed.IsPrimaryView)
                {
                    return(false);
                }
            }

            // The device we use
            Device device;

            // Prepare the change
            using (var tx = new FeedTransaction(this))
            {
                // Make sure we can receive it
                device = EnsureFeed(source);
                if (device == null)
                {
                    return(false);
                }

                // Avoid cleanup
                tx.Commit();
            }

            // Report as active as soon as available
            device.FireWhenAvailable(source.Source, OnSecondaryViewChanged);

            // Report success
            return(true);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Beendet eine Aufzeichnung.
        /// </summary>
        /// <param name="sourceName">Der Name des Senders.</param>
        /// <param name="key">Die Identifikation der Aufzeichnung.</param>
        public void StopRecordingFeed( string sourceName, string key )
        {
            // Look it up
            var source = m_provider.Translate( sourceName );
            if (source == null)
                throw new ArgumentException( "unbekannter sender", "sourceName" );

            // Find the feed
            var feed = FindFeed( source );
            if (feed == null)
                return;
            else if (!feed.IsRecording( key ))
                return;

            // Prepare the change
            using (var tx = new FeedTransaction( this ))
            {
                // Mark as active
                tx.DisableRecording( feed, key );

                // Avoid cleanup
                tx.Commit();
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Beginnt eine Aufzeichnung.
        /// </summary>
        /// <param name="sourceName">Der Name des Senders.</param>
        /// <param name="key">Die Identifikation der Aufzeichnung.</param>
        /// <returns>Gesetzt, wenn der Start erfolgreich war.</returns>
        public bool TryStartRecordingFeed( string sourceName, string key )
        {
            // Look it up
            var source = m_provider.Translate( sourceName );
            if (source == null)
                throw new ArgumentException( "unbekannter sender", "sourceName" );

            // Find the feed
            var feed = FindFeed( source );
            if (feed != null)
                if (feed.IsRecording( key ))
                    return false;

            // Device to use
            Device device;

            // Prepare the change
            using (var tx = new FeedTransaction( this ))
            {
                // Make sure we can receive it
                device = EnsureRecordingFeed( source, tx );
                if (device == null)
                    return false;

                // Avoid cleanup
                tx.Commit();
            }

            // Report recording
            device.FireWhenAvailable( source.Source, key, OnRecordingChanged );

            // May want to make it primary
            if (PrimaryView == null)
                device.FireWhenAvailable( source.Source, OnPrimaryViewChanged );

            // Report success
            return true;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Beendet alle Aufträge.
        /// </summary>
        public void Shutdown()
        {
            // Prepare the change
            using (var tx = new FeedTransaction( this ))
            {
                // All feeds
                foreach (var feed in Feeds)
                {
                    // Primary
                    if (feed.IsPrimaryView)
                        tx.DisablePrimaryView( feed );

                    // Secondary
                    if (feed.IsSecondaryView)
                        tx.DisableSecondaryView( feed );

                    // Recording
                    foreach (var recording in feed.Recordings.ToArray())
                        tx.DisableRecording( feed, recording );
                }

                // Process all
                tx.Commit();
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Verändert eine sekundäre Anzeige.
        /// </summary>
        /// <param name="sourceName">Der Name des Senders.</param>
        /// <returns>Gesetzt, wenn die Änderung erfolgreich war.</returns>
        public bool TryStartSecondaryFeed( string sourceName )
        {
            // Look it up
            var source = m_provider.Translate( sourceName );
            if (source == null)
                throw new ArgumentException( "unbekannter sender", "sourceName" );

            // Find the feed
            var feed = FindFeed( source );
            if (feed != null)
                if (feed.IsSecondaryView)
                    return true;
                else if (feed.IsPrimaryView)
                    return false;

            // The device we use
            Device device;

            // Prepare the change
            using (var tx = new FeedTransaction( this ))
            {
                // Make sure we can receive it
                device = EnsureFeed( source );
                if (device == null)
                    return false;

                // Avoid cleanup
                tx.Commit();
            }

            // Report as active as soon as available
            device.FireWhenAvailable( source.Source, OnSecondaryViewChanged );

            // Report success
            return true;
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Verändert die primäre Anzeige.
        /// </summary>
        /// <param name="sourceName">Die neue primäre Anzeige.</param>
        /// <returns>Gesetzt, wenn die Änderung erfolgreich war.</returns>
        public bool TryStartPrimaryFeed( string sourceName )
        {
            // Look it up
            var source = m_provider.Translate( sourceName );
            if (source == null)
                throw new ArgumentException( "unbekannter sender", "sourceName" );

            // Find the feed
            var feed = FindFeed( source );
            if (feed != null)
                if (feed.IsPrimaryView)
                    return true;

            // Device we schedule on
            Device device;

            // Prepare the change
            using (var tx = new FeedTransaction( this ))
            {
                // See if we are secondary
                if (feed != null)
                    if (feed.IsSecondaryView)
                        tx.DisableSecondaryView( feed );

                // Locate the current primary view
                var previous = PrimaryView;
                if (previous != null)
                    tx.DisablePrimaryView( previous );

                // Make sure we can receive it
                device = EnsurePrimaryFeed( source, tx );
                if (device == null)
                    return false;

                // Avoid cleanup
                tx.Commit();
            }

            // Schedule for report
            device.FireWhenAvailable( source.Source, OnPrimaryViewChanged );

            // Report success
            return true;
        }