Skip to content

Commit

Permalink
Avoid focus stealing and unintentional character label editing by add…
Browse files Browse the repository at this point in the history
…ing a clickable link to edit this information. Fixes evemondevteam#71.
  • Loading branch information
peterhaneve committed Oct 4, 2018
1 parent 73e0fab commit 94cd153
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
14 changes: 14 additions & 0 deletions src/EVEMon/CharacterMonitoring/CharacterMonitorHeader.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 19 additions & 4 deletions src/EVEMon/CharacterMonitoring/CharacterMonitorHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,16 @@ private void UpdateCharacterLabel(IEnumerable<string> allLabels)
m_updatingLabels = true;
try
{
string lbl = m_character.Label;
// Update the character labels
CustomLabelComboBox.Items.Clear();
foreach (string label in allLabels)
CustomLabelComboBox.Items.Add(label);
CustomLabelComboBox.Text = m_character.Label;
CustomLabelComboBox.Text = lbl;
// Provide clickable text if the label is blank
if (lbl.IsEmptyOrUnknown())
lbl = "Edit label";
CustomLabelLink.Text = lbl;
}
finally
{
Expand All @@ -270,7 +275,7 @@ private void UpdateAccountStatusInfo()
if (m_character == null)
return;

CCPCharacter ccpCharacter = m_character as CCPCharacter;
var ccpCharacter = m_character as CCPCharacter;
if (ccpCharacter == null)
{
AccountStatusTableLayoutPanel.Visible = false;
Expand Down Expand Up @@ -695,7 +700,7 @@ private void EveMonClient_CharacterInfoUpdated(object sender, CharacterChangedEv
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void EveMonClient_ConquerableStationListUpdated(object sender, EventArgs e)
{

UpdateInfoControls();
}

/// <summary>
Expand Down Expand Up @@ -950,7 +955,17 @@ private void ChangeAPIKeyInfoMenuItem_Click(object sender, EventArgs e)
}
}

/// <summary>
/// Occurs when the user edits the character's custom label.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="LinkLabelLinkClickedEventArgs"/> instance containing the event data.</param>
private void CustomLabelLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
CustomLabelLink.Visible = false;
CustomLabelComboBox.Visible = true;
}

#endregion

}
}

0 comments on commit 94cd153

Please sign in to comment.