Ejemplo n.º 1
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.º 2
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.º 3
0
        /// <summary>
        /// Stellt sicher, dass eine Aufzeichnung gestartet werden kann.
        /// </summary>
        /// <param name="source">Der gewünschte Sender.</param>
        /// <param name="tx">Die aktuelle Änderungsumgebung.</param>
        /// <returns>Gesetzt, wenn die Aufzeichnung möglich war.</returns>
        private Device EnsureRecordingFeed( SourceSelection source, FeedTransaction tx )
        {
            // Make sure we can receive it
            var device = EnsurePrimaryFeed( source, tx );
            if (device != null)
                return device;

            // See if there is a primary
            var primary = PrimaryView;
            if (primary == null)
                return null;

            // Switch off primary
            tx.DisablePrimaryView( primary );

            // Try again - may fail
            return EnsurePrimaryFeed( source, tx );
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Stellt sicher, dass eine Aufzeichnung gestartet werden kann.
        /// </summary>
        /// <param name="source">Der gewünschte Sender.</param>
        /// <param name="tx">Die aktuelle Änderungsumgebung.</param>
        /// <returns>Gesetzt, wenn die Aufzeichnung möglich war.</returns>
        private Device EnsureRecordingFeed(SourceSelection source, FeedTransaction tx)
        {
            // Make sure we can receive it
            var device = EnsurePrimaryFeed(source, tx);

            if (device != null)
            {
                return(device);
            }

            // See if there is a primary
            var primary = PrimaryView;

            if (primary == null)
            {
                return(null);
            }

            // Switch off primary
            tx.DisablePrimaryView(primary);

            // Try again - may fail
            return(EnsurePrimaryFeed(source, tx));
        }
Ejemplo n.º 5
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.º 6
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;
        }