2015-08-01 11:58:53 -06:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
using System.Resources;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace EduNetworkBuilder
|
|
|
|
|
{
|
|
|
|
|
public partial class RTFWindow : Form
|
|
|
|
|
{
|
|
|
|
|
public RTFWindow()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
LanguagifyComponents();
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Used when viewing help from the ? button. This displays network specific help information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="theHelp"></param>
|
|
|
|
|
/// <param name="theTests"></param>
|
|
|
|
|
public RTFWindow(string title, string theHelp, List<NetTest> theTests)
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
LanguagifyComponents();
|
|
|
|
|
BuilderWindow myWin = (BuilderWindow)Application.OpenForms["BuilderWindow"];
|
|
|
|
|
if (myWin != null)
|
|
|
|
|
{
|
|
|
|
|
StartPosition = FormStartPosition.Manual;
|
|
|
|
|
Point newlocation = new Point(myWin.Location.X + myWin.Width + 5, myWin.Location.Y);
|
|
|
|
|
if (newlocation.X > (Screen.PrimaryScreen.Bounds.Width + 5))
|
|
|
|
|
{
|
|
|
|
|
newlocation = new Point(Screen.PrimaryScreen.Bounds.Width - 5, newlocation.Y);
|
|
|
|
|
}
|
|
|
|
|
Location = newlocation;
|
|
|
|
|
}
|
|
|
|
|
System.Drawing.Font currentFont = rtbContent.SelectionFont;
|
|
|
|
|
Text = title;
|
|
|
|
|
rtbContent.Text = theHelp;
|
|
|
|
|
rtbContent.SelectAll();
|
|
|
|
|
rtbContent.SelectionFont = new Font(
|
|
|
|
|
currentFont.FontFamily,
|
|
|
|
|
currentFont.Size + 2, FontStyle.Regular);
|
|
|
|
|
rtbContent.DeselectAll();
|
|
|
|
|
}
|
2015-08-08 07:12:34 -06:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Start an RTFWindow with the specified information showing
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="WhatToShow"></param>
|
2015-08-01 11:58:53 -06:00
|
|
|
|
public RTFWindow(RTFWindowContents WhatToShow)
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
LanguagifyComponents();
|
|
|
|
|
string currentDir = Directory.GetCurrentDirectory();
|
|
|
|
|
string myRTF;
|
2015-08-08 11:09:22 -06:00
|
|
|
|
Form myWin = null;
|
|
|
|
|
myWin = Application.OpenForms["RTFWindow"];
|
|
|
|
|
if (myWin == null)
|
|
|
|
|
{
|
|
|
|
|
myWin = Application.OpenForms["BuilderWindow"];
|
|
|
|
|
}
|
|
|
|
|
if (myWin != null)
|
|
|
|
|
{
|
|
|
|
|
StartPosition = FormStartPosition.Manual;
|
|
|
|
|
Point newlocation = new Point(myWin.Location.X + myWin.Width + 5, myWin.Location.Y);
|
|
|
|
|
if (newlocation.X > (Screen.PrimaryScreen.Bounds.Width + 5))
|
|
|
|
|
{
|
|
|
|
|
newlocation = new Point(Screen.PrimaryScreen.Bounds.Width - 5, newlocation.Y);
|
|
|
|
|
}
|
|
|
|
|
Location = newlocation;
|
|
|
|
|
}
|
2015-08-01 11:58:53 -06:00
|
|
|
|
if (WhatToShow == RTFWindowContents.help)
|
|
|
|
|
{
|
|
|
|
|
myRTF = Properties.Resources.Help;
|
|
|
|
|
rtbContent.Rtf = myRTF;
|
|
|
|
|
}
|
|
|
|
|
else if (WhatToShow == RTFWindowContents.about)
|
|
|
|
|
{
|
|
|
|
|
myRTF = Properties.Resources.about;
|
|
|
|
|
rtbContent.Rtf = myRTF;
|
|
|
|
|
}
|
|
|
|
|
else if (WhatToShow == RTFWindowContents.release_notes)
|
|
|
|
|
{
|
|
|
|
|
myRTF = Properties.Resources.ReleaseNotes;
|
|
|
|
|
rtbContent.Rtf = myRTF;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-08 11:09:22 -06:00
|
|
|
|
public void JumpToSelection(string WhatToFind)
|
|
|
|
|
{
|
|
|
|
|
int indexToText = rtbContent.Find(WhatToFind);
|
|
|
|
|
if (indexToText > 0)
|
|
|
|
|
{
|
|
|
|
|
rtbContent.SelectionStart = indexToText;
|
|
|
|
|
rtbContent.ScrollToCaret();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void JumpToSelection(HelpTopics WhatToFind)
|
|
|
|
|
{
|
|
|
|
|
string toFind = NB.Translate(NB.GetHelpTopicKey(WhatToFind));
|
|
|
|
|
JumpToSelection(toFind);
|
|
|
|
|
}
|
2015-08-01 11:58:53 -06:00
|
|
|
|
private void LanguagifyComponents()
|
|
|
|
|
{
|
|
|
|
|
Text = NB.Translate("RTFW_rtbContent");
|
|
|
|
|
Text = NB.Translate("RTFW_btnOK");
|
|
|
|
|
Text = NB.Translate("RTFW_Form");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnOK_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|