/// <summary>
        /// Aktualisiert die Anzeige nach einem Sendersuchlauf mit gespeichertem Profil.
        /// </summary>
        /// <param name="state">Wird ignoriert.</param>
        private void ProcessScan(object state)
        {
            // Reload profiles
            ProfileManager.Refresh();

            // Get the selection
            ProfileItem item = (ProfileItem)selProfiles.SelectedItem;

            if (null == item)
            {
                return;
            }

            // Find
            Profile profile = ProfileManager.FindProfile(item.Profile.Name);

            if (null == profile)
            {
                return;
            }

            // Reload
            item.Profile = profile;

            // Load station selection list
            selStation.Items.Clear();
            selStation.Items.AddRange(SourceItem.GetSourceItems(item.Profile));
        }
        /// <summary>
        /// Ermittelt die ausgewählten Quellen.
        /// </summary>
        /// <param name="directory">Optional ein Verzeichnis für die Aufzeichnungsdateien.</param>
        /// <returns>Alle ausgewählten Quellen.</returns>
        public ReceiveInformation[] GetSources(string directory)
        {
            // Create helper
            List <ReceiveInformation> sources = new List <ReceiveInformation>();

            // Process all
            foreach (Control control in Controls)
            {
                // Change type
                SelectStream selector = control as SelectStream;
                if (null == selector)
                {
                    continue;
                }

                // Get the selection
                SourceItem item = selector.Source;
                if (null == item)
                {
                    continue;
                }

                // Construct the information
                sources.Add(
                    new ReceiveInformation
                {
                    RecordingPath = item.GetRecordingPath(directory),
                    SelectionKey  = item.Selection.SelectionKey,
                    Streams       = selector.Selection
                });
            }

            // Report
            return(sources.ToArray());
        }
        /// <summary>
        /// Aktiviert eine einzelne Quelle für den <i>Zapping Modus</i>.
        /// </summary>
        /// <param name="sender">Wird ignoriert.</param>
        /// <param name="e">Wird ignoriert.</param>
        private void cmdSetZapping_Click(object sender, EventArgs e)
        {
            // Attach to source
            SourceItem item = (SourceItem)selStation.SelectedItem;

            if (null == item)
            {
                return;
            }

            // Be safe
            try
            {
                // Forward
                CurrentRequest = CurrentServer.BeginSetZappingSource(item.Selection.SelectionKey, txStream.Text);

                // Install processor
                m_ResultProcessor = ProcessState;
            }
            catch (Exception ex)
            {
                // Report
                MessageBox.Show(this, ex.Message, Text);
            }

            // Update GUI
            UpdateGUI();
        }
        /// <summary>
        /// Beginnt die Sammlung für die Programmzeitschrift.
        /// </summary>
        /// <param name="sender">Wird ignoriert.</param>
        /// <param name="e">Wird ignoriert.</param>
        private void cmdStartEPG_Click(object sender, EventArgs e)
        {
            // Attach to source
            SourceItem item = (SourceItem)selStation.SelectedItem;

            // Be safe
            try
            {
                // List of sources
                List <SourceIdentifier> sources = new List <SourceIdentifier>();

                // Add the one
                if (null != item)
                {
                    sources.Add(item.Selection.Source);
                }

                // Start
                CurrentRequest = CurrentServer.BeginStartEPGCollection(sources.ToArray(), EPGExtensions.PREMIEREDirect | EPGExtensions.PREMIERESport | EPGExtensions.FreeSatUK);
            }
            catch (Exception ex)
            {
                // Report
                MessageBox.Show(this, ex.Message, Text);
            }

            // Update GUI
            UpdateGUI();
        }
        /// <summary>
        /// Aktiviert oder deaktivert den Netzwerkversand.
        /// </summary>
        /// <param name="sender">Wird ignoriert.</param>
        /// <param name="e">Wird ignoriert.</param>
        private void cmdStream_Click(object sender, EventArgs e)
        {
            // Attach to source
            SourceItem item = (SourceItem)selStation.SelectedItem;

            if (null == item)
            {
                return;
            }

            // Be safe
            try
            {
                // Load
                string target = txStream.Text.Trim();

                // Forward
                CurrentRequest = CurrentServer.BeginSetStreamTarget(item.Selection.Source, string.IsNullOrEmpty(target) ? null : target);
            }
            catch (Exception ex)
            {
                // Report
                MessageBox.Show(this, ex.Message, Text);
            }

            // Update GUI
            UpdateGUI();
        }
        /// <summary>
        /// Stoppt den Empfang einer Quelle.
        /// </summary>
        /// <param name="sender">Wird ignoriert.</param>
        /// <param name="e">Wird ignoriert.</param>
        private void cmdUnReceive_Click(object sender, EventArgs e)
        {
            // Attach to source
            SourceItem item = (SourceItem)selStation.SelectedItem;

            if (null == item)
            {
                return;
            }

            // Be safe
            try
            {
                // Forward
                CurrentRequest = CurrentServer.BeginRemoveSource(item.Selection.Source);
            }
            catch (Exception ex)
            {
                // Report
                MessageBox.Show(this, ex.Message, Text);
            }

            // Update GUI
            UpdateGUI();
        }
        /// <summary>
        /// Aktiviert den Empfang einer Quelle.
        /// </summary>
        /// <param name="sender">Wird ignoriert.</param>
        /// <param name="e">Wird ignoriert.</param>
        private void cmdReceive_Click(object sender, EventArgs e)
        {
            // Attach to source
            SourceItem item = (SourceItem)selStation.SelectedItem;

            if (null == item)
            {
                return;
            }

            // Be safe
            try
            {
                // Ask user what to do
                using (StartRecording dlg = new StartRecording())
                {
                    // Load it
                    dlg.LoadItems(selStation.Items, item);

                    // Show up
                    if (DialogResult.OK != dlg.ShowDialog(this))
                    {
                        return;
                    }

                    // Forward
                    CurrentRequest = CurrentServer.BeginAddSources(dlg.GetSources(txDir.Text));

                    // Add result processor
                    m_ResultProcessor = ProcessNewStream;
                }
            }
            catch (Exception ex)
            {
                // Report
                MessageBox.Show(this, ex.Message, Text);
            }

            // Update GUI
            UpdateGUI();
        }
        /// <summary>
        /// Es wurde ein geräteprofil ausgewählt.
        /// </summary>
        /// <param name="sender">Wird ignoriert.</param>
        /// <param name="e">Wir dignoriert.</param>
        private void selProfiles_SelectionChangeCommitted(object sender, EventArgs e)
        {
            // Get the selection
            ProfileItem item = (ProfileItem)selProfiles.SelectedItem;

            // Remember
            Properties.Settings.Default.ProfileName = (null == item) ? null : item.Profile.Name;
            Properties.Settings.Default.Save();

            // Load station selection list
            selStation.Items.Clear();

            // Try to resolve profile
            if (null != item)
            {
                selStation.Items.AddRange(SourceItem.GetSourceItems(item.Profile));
            }

            // Refresh
            UpdateGUI();
        }
Exemple #9
0
        /// <summary>
        /// Initialisiert die Liste der möglichen Quellen.
        /// </summary>
        /// <param name="allItems">Die Liste aller Quellen.</param>
        /// <param name="primary">Die primär ausgewählte Quelle.</param>
        public void LoadItems(IEnumerable allItems, SourceItem primary)
        {
            // Process all
            foreach (SourceItem item in allItems)
            {
                if (Equals(item.Selection.Location, primary.Selection.Location))
                {
                    if (Equals(item.Selection.Group, primary.Selection.Group))
                    {
                        selStation.Items.Add(item);
                    }
                }
            }

            // Choose the primary one
            selStation.SelectedItem = primary;

            // Not changable if loaded this way
            selStation.Enabled = false;

            // Set button
            cmdMore.Enabled = (selStation.Items.Count > 1);
        }
 /// <summary>
 /// Initialisiert die Liste der möglichen Quellen.
 /// </summary>
 /// <param name="allItems">Die Liste aller Quellen.</param>
 /// <param name="primary">Die primär ausgewählte Quelle.</param>
 public void LoadItems( IEnumerable allItems, SourceItem primary )
 {
     // Forward
     selStream.LoadItems( allItems, primary );
 }
        /// <summary>
        /// Initialisiert die Liste der möglichen Quellen.
        /// </summary>
        /// <param name="allItems">Die Liste aller Quellen.</param>
        /// <param name="primary">Die primär ausgewählte Quelle.</param>
        public void LoadItems( IEnumerable allItems, SourceItem primary )
        {
            // Process all
            foreach (SourceItem item in allItems)
                if (Equals( item.Selection.Location, primary.Selection.Location ))
                    if (Equals( item.Selection.Group, primary.Selection.Group ))
                        selStation.Items.Add( item );

            // Choose the primary one
            selStation.SelectedItem = primary;

            // Not changable if loaded this way
            selStation.Enabled = false;

            // Set button
            cmdMore.Enabled = (selStation.Items.Count > 1);
        }
 /// <summary>
 /// Initialisiert die Liste der möglichen Quellen.
 /// </summary>
 /// <param name="allItems">Die Liste aller Quellen.</param>
 /// <param name="primary">Die primär ausgewählte Quelle.</param>
 public void LoadItems(IEnumerable allItems, SourceItem primary)
 {
     // Forward
     selStream.LoadItems(allItems, primary);
 }