Ability to open a URL that is attached to a puzzle
This commit is contained in:
parent
f929e84d29
commit
36b42e64d4
@ -1006,6 +1006,18 @@ namespace EduNetworkBuilder
|
||||
return randomizedList;
|
||||
}
|
||||
|
||||
public static bool OpenURLInExternalBrowser(string URL)
|
||||
{
|
||||
Uri uriResult;
|
||||
bool result = Uri.TryCreate(URL, UriKind.Absolute, out uriResult)
|
||||
&& (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);
|
||||
if(result)
|
||||
{
|
||||
System.Diagnostics.Process.Start(URL);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static List<TreeNode> GetAllNodes(this TreeView _self)
|
||||
{
|
||||
List<TreeNode> result = new List<TreeNode>();
|
||||
|
@ -238,6 +238,23 @@ namespace EduNetworkBuilder
|
||||
//Make a bunch of new buttons.
|
||||
int count=0;
|
||||
int offset = btnHelp.Height + 3;
|
||||
if (myNetwork.NetURL.GetText() != "")
|
||||
{
|
||||
tButton = new Button();
|
||||
tButton.Location = new Point(btnHelp.Location.X, rbHelp1.Location.Y + rbHelp1.Height + 5 + (offset * count));
|
||||
//tButton.Text = (count + 1).ToString();
|
||||
tButton.BackgroundImage = Properties.Resources.VidImage;
|
||||
tButton.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
tButton.Width = btnHelp.Width;
|
||||
tButton.Height = btnHelp.Height;
|
||||
tButton.Click += btnRead_Click;
|
||||
tButton.Name = myNetwork.PuzzleName + "_URL";
|
||||
tButton.Tag = myNetwork.NetURL.GetText();
|
||||
HelpPanel.Controls.Add(tButton);
|
||||
myTooltip.SetToolTip(tButton, NB.Translate("_OpenURL") + " " + myNetwork.PuzzleName);
|
||||
HelpTopicButtons.Add(tButton);
|
||||
count++;
|
||||
}
|
||||
foreach (HelpTopics HT in myNetwork.SuggestedReadings)
|
||||
{
|
||||
tButton = new Button();
|
||||
@ -270,6 +287,8 @@ namespace EduNetworkBuilder
|
||||
private void btnRead_Click(object sender, EventArgs e)
|
||||
{
|
||||
Button me = (Button)sender;
|
||||
if (me.Tag == null)
|
||||
{
|
||||
HelpTopics HT = NB.TryParseEnum<HelpTopics>(me.Name, HelpTopics.None);
|
||||
if (HT != HelpTopics.None)
|
||||
{
|
||||
@ -281,6 +300,15 @@ namespace EduNetworkBuilder
|
||||
UpdateMenu();
|
||||
myNetwork.TestForCompletion(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
//It should be a video URL
|
||||
string URL = (string)me.Tag;
|
||||
NB.OpenURLInExternalBrowser(URL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void myTooltip_Popup(Object sender, PopupEventArgs e)
|
||||
{
|
||||
|
@ -1985,4 +1985,8 @@
|
||||
<value>Message / Title</value>
|
||||
<comment>TW_Message = Message / Title</comment>
|
||||
</data>
|
||||
<data name="_OpenURL" xml:space="preserve">
|
||||
<value>Open a URL for the puzzle:</value>
|
||||
<comment>_OpenURL = Open a URL for the puzzle:</comment>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user