Skip to content

Commit

Permalink
Support topic redirect.
Browse files Browse the repository at this point in the history
  • Loading branch information
fancidev committed Jun 25, 2017
1 parent 73f3107 commit 0e49be0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
16 changes: 16 additions & 0 deletions HelpBrowser/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,22 @@ private void OnActiveTopicChanged(object sender, EventArgs e)
txtSource.Text = FormatHexData((byte[])topic.Source);
else
txtSource.Text = "";

// Special handling for commands.
if (topic.IsHidden && !string.IsNullOrEmpty(topic.ExecuteCommand))
{
if (topic.ExecuteCommand[0] == 'P')
{
// TODO: parse mark
string redirectTarget = topic.ExecuteCommand.Substring(2);
if (MessageBox.Show(this, "Redirect to " + redirectTarget + "?",
"Redirect", MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question) == DialogResult.Yes)
{
viewModel.NavigateTo(new HelpUri(redirectTarget));
}
}
}
}

private void lstTopics_SelectedIndexChanged(object sender, EventArgs e)
Expand Down
3 changes: 3 additions & 0 deletions QuickHelp/HelpTopic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ public override string ToString()
/// </summary>
public bool IsHidden { get; set; }

/// <summary>
/// Gets or sets the command to execute.
/// </summary>
public string ExecuteCommand { get; set; }

/// <summary>
Expand Down

0 comments on commit 0e49be0

Please sign in to comment.