/// <summary> /// Füllt die Anzeige mit den Daten des aktuellen Geräteprofils. /// </summary> /// <param name="sender">Wird ignoriert.</param> /// <param name="e">Wird ignoriert.</param> private void ProfileDialog_Load(object sender, EventArgs e) { // Attach to the profile Profile profile = m_PlugIn.Profile; // Name txName.Text = profile.Name; // Find the hardware entry foreach (HardwareTypeItem item in selType.Items) { if (Equals(item.Type, profile.HardwareType)) { // Choose it selType.SelectedItem = item; // Done break; } } // Must create new if (null == selType.SelectedItem) { if (!string.IsNullOrEmpty(profile.HardwareType)) { // Create item HardwareTypeItem tempItem = new HardwareTypeItem { Type = profile.HardwareType }; // Remember it selType.Items.Add(tempItem); // Select it selType.SelectedItem = tempItem; } } // Flags ckDisableEPG.Checked = m_PlugIn.Profile.DisableProgramGuide; // Change profile type var satProfile = m_PlugIn.Profile as SatelliteProfile; if (null != satProfile) { // Show DVB-S2 selection ckDVBS2.Checked = satProfile.DisableS2Groups; ckDVBS2.Visible = true; } // Load edit control selType_SelectionChangeCommitted(selType, EventArgs.Empty); // Finish UpdateGUI(); }
/// <summary> /// Aktualisiert die Anzeige nach einer Änderung. /// </summary> private void UpdateGUI() { // Assume not valid m_PlugIn.IsValid = false; // Always update try { // Get the selection HardwareTypeItem item = (HardwareTypeItem)selType.SelectedItem; if (null == item) { return; } if (null == item.Type) { return; } // No name at all if (string.IsNullOrEmpty(txName.Text)) { return; } // Check for invalid file name characters if (txName.Text.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0) { return; } // If name changes make sure that there is no other profile with the same name Profile other = JMS.DVB.ProfileManager.FindProfile(txName.Text); if (null != other) { if (other != m_PlugIn.Profile) { return; } } // We allow it if the source selection is valid m_PlugIn.IsValid = (null != selShare.SelectedItem); } finally { // Update GUI m_Site.UpdateGUI(); } }
/// <summary> /// Füllt die Anzeige mit den Daten des aktuellen Geräteprofils. /// </summary> /// <param name="sender">Wird ignoriert.</param> /// <param name="e">Wird ignoriert.</param> private void ProfileDialog_Load( object sender, EventArgs e ) { // Attach to the profile Profile profile = m_PlugIn.Profile; // Name txName.Text = profile.Name; // Find the hardware entry foreach (HardwareTypeItem item in selType.Items) if (Equals( item.Type, profile.HardwareType )) { // Choose it selType.SelectedItem = item; // Done break; } // Must create new if (null == selType.SelectedItem) if (!string.IsNullOrEmpty( profile.HardwareType )) { // Create item HardwareTypeItem tempItem = new HardwareTypeItem { Type = profile.HardwareType }; // Remember it selType.Items.Add( tempItem ); // Select it selType.SelectedItem = tempItem; } // Flags ckDisableEPG.Checked = m_PlugIn.Profile.DisableProgramGuide; // Change profile type var satProfile = m_PlugIn.Profile as SatelliteProfile; if (null != satProfile) { // Show DVB-S2 selection ckDVBS2.Checked = satProfile.DisableS2Groups; ckDVBS2.Visible = true; } // Load edit control selType_SelectionChangeCommitted( selType, EventArgs.Empty ); // Finish UpdateGUI(); }
/// <summary> /// Beginnt mit der Ausführung der Aufgabe. /// </summary> /// <returns>Gesetzt, wenn die Aufgabe synchron abgeschlossen wurde.</returns> bool IPlugInControl.Start() { // Set the driver type HardwareTypeItem item = (HardwareTypeItem)selType.SelectedItem; if (null == item) { m_PlugIn.Profile.HardwareType = null; } else { m_PlugIn.Profile.HardwareType = item.Type; } // See if we are using DVB-S SatelliteProfile satProfile = m_PlugIn.Profile as SatelliteProfile; if (null != satProfile) { satProfile.DisableS2Groups = ckDVBS2.Checked; } // Copy device data back to profile m_PlugIn.CurrentEditor.UpdateProfile(); // Copy flags m_PlugIn.Profile.DisableProgramGuide = ckDisableEPG.Checked; // Copy our data back to profile if (0 == selShare.SelectedIndex) { m_PlugIn.Profile.UseSourcesFrom = null; } else { m_PlugIn.Profile.UseSourcesFrom = (string)selShare.SelectedItem; } // Clear out recording parameters m_PlugIn.Profile.Parameters.RemoveAll(p => !string.IsNullOrEmpty(p.Name) && m_RecordingSettings.ContainsKey(p.Name)); // Add all m_PlugIn.Profile.Parameters.AddRange(m_RecordingSettings.Where(p => !string.IsNullOrEmpty(p.Value)).Select(p => new ProfileParameter(p.Key, p.Value))); // Check for rename if (0 == string.Compare(m_PlugIn.Profile.Name, txName.Text, true)) { // Just put to disk m_PlugIn.Profile.Save(); } else { // Attach to the current file position FileInfo oldPath = m_PlugIn.Profile.ProfilePath; // Make the new path FileInfo newPath = new FileInfo(Path.Combine(oldPath.DirectoryName, txName.Text + oldPath.Extension)); // Delete it silently newPath.Delete(); // Update file state oldPath.Refresh(); // See if files are the same bool isSameFile = !oldPath.Exists; // Restart the profile manager DVB.ProfileManager.Refresh(); // Try to save m_PlugIn.Profile.Save(newPath); // Delete the old path if we are not renaming in place if (!isSameFile) { oldPath.Delete(); } // Make it current m_Site.SelectProfile(txName.Text); } // See if we should configure the scan locations if (string.IsNullOrEmpty(m_PlugIn.Profile.UseSourcesFrom)) { if (m_PlugIn.Profile.ScanLocations.Count < 1) { m_Site.SelectNextPlugIn(typeof(Configuration)); } } // Did it return(true); }