/// <summary> /// Es wurde ein Geräteprofil ausgewählt. /// </summary> /// <param name="sender">Wird ignoriert.</param> /// <param name="e">Wird ignoriert.</param> private void selProfile_SelectionChangeCommitted(object sender, EventArgs e) { // Load selection ProfileItem item = (ProfileItem)selProfile.SelectedItem; // Update state CurrentProfile = (null == item.Profile) ? null : item.Profile.Name; // Update master CheckButtons(); }
/// <summary> /// Füllt die Eingabeelemente dieses Arbeitsschritts. /// </summary> /// <param name="sender">Wird ignoriert.</param> /// <param name="e">Wird ignoriert.</param> private void NewProfileSelector_Load(object sender, EventArgs e) { // Load all profiles List <Profile> profiles = new List <Profile>(ProfileManager.AllProfiles); // Restrict by plug-in MainForm.CurrentPlugIn.FilterNewProfiles(profiles); // Sort profiles.Sort((l, r) => l.Name.CompareTo(r.Name)); // Find the selection string selected = CurrentProfile; // Add starter selProfile.Items.Add(new ProfileItem { IsRequired = (MainForm.CurrentPlugIn.MinimumNewProfiles > 0) }); // Select this selProfile.SelectedIndex = 0; // Convert List <ProfileItem> items = profiles.ConvertAll(p => new ProfileItem { Profile = p }); // Add the rest selProfile.Items.AddRange(items.ToArray()); // Special if (2 == selProfile.Items.Count) { // Get rid of the special selection selProfile.Items.RemoveAt(0); // Select the only one selProfile.SelectedIndex = 0; // Disable selection selProfile.Enabled = false; // Fire event selProfile_SelectionChangeCommitted(selProfile, EventArgs.Empty); } else { // See if selection exists ProfileItem item = items.FirstOrDefault(i => (null != i.Profile) && (0 == string.Compare(i.Profile.Name, selected, true))); // Select if (null != item) { // Update selProfile.SelectedItem = item; // Fire event selProfile_SelectionChangeCommitted(selProfile, EventArgs.Empty); } } // May forward automatically MainForm.ProcessAutoForward(); }