Hey everyone,
I created a Wiki as one of my first projects (have done close to 15 different programs now, mostly using C# and MySQL, but the Wiki was my first one).
Here is the code: http://csharppad.com/gist/ffe94448d7c912be933f
Here is an example of how I am doing this.
Right now, if we need to enter a new note into our Wiki, I have to go into Visual Studio, add a child node in the appropriate place, and then I have to do this so it populates the window on the right with the correct note:
if (e.Node.Name == "avatar")
{
richTextBox1.LoadFile("G:\\CS\\NET\\Wiki\\Wiki Notes\\avatar.rtf");
}
{
richTextBox1.LoadFile("G:\\CS\\NET\\Wiki\\Wiki Notes\\avatar.rtf");
}
It will load this:
I am fine with just doing it the Visual Studio way, but the other two techs in my department don't know C# and don't care to learn it (even though since I did all of the legwork, it would just be copying/pasting, and recompiling the program).
I am hoping there is a way to have a button they can press and add an additional note along with the path to the file that needs to display in the right pane.
Any tips?
Thanks!
Kyle

theLizardRank #1,079 · 1.8K reputationPosted Jul 30, 2015, 2:37 PM EDT
TreeNode child = new TreeNode("Child Node");
TreeNode sibling = new TreeNode("Sibling");
child.Nodes.Add("Sibling");
root.Nodes.Add(child);
tv.Nodes.Add(root);
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
/* TEXT FILE
MDT,\\CS\\NET\\Wiki\\WikiNotes\\mdtencryption.rtf
Apexv4,\\CS\\NET\\Wiki\\WikiNotes\\apexv4.rtf
Apexv5,\\CS\\NET\\Wiki\\WikiNotes\\apexv5.rtf
Symantec,\\CS\\NET\\Wiki\\WikiNotes\\symantec.rtf
LaserFicheClient,\\CS\\NET\\Wiki\\WikiNotes\\LaserFicheClient.rtf
AppleSetups,\\CS\\NET\\Wiki\\WikiNotes\\applesetups.rtf
ArcViewGPI,\\CS\\NET\\Wiki\\WikiNotes\\arcviewgpi.rtf
avcacommish,\\CS\\NET\\Wiki\\WikiNotes\\avcacommish.rtf
barracudawf,\\CS\\NET\\Wiki\\WikiNotes\\barracudawf.rtf
avatar,\\CS\\NET\\Wiki\\WikiNotes\\avatar.rtf
cadinstall,\\CS\\NET\\Wiki\\WikiNotes\\cadinstall.rtf
cadportedit,\\CS\\NET\\Wiki\\WikiNotes\\editcadports.rtf
wincams,\\CS\\NET\\Wiki\\WikiNotes\\wincams.rtf
thinprint,\\CS\\NET\\Wiki\\WikiNotes\\thinprint.rtf
citrixreceiver,\\CS\\NET\\Wiki\\WikiNotes\\citrixreceiver.rtf
mitel,\\CS\\NET\\Wiki\\WikiNotes\\mitel.rtf
transcription,\\CS\\NET\\Wiki\\WikiNotes\\transcription.rtf
eaglerec,\\CS\\NET\\Wiki\\WikiNotes\\eaglerec.rtf
cellmail,\\CS\\NET\\Wiki\\WikiNotes\\cellmail.rtf
javamsi,\\CS\\NET\\Wiki\\WikiNotes\\javamsi.rtf
fairreader,\\CS\\NET\\Wiki\\WikiNotes\\fairreader.rtf
filezillaconfig,\\CS\\NET\\Wiki\\WikiNotes\\filezillaconfig.rtf
interpage,\\CS\\NET\\Wiki\\WikiNotes\\interpage.rtf
hmisenginuity,\\CS\\NET\\Wiki\\WikiNotes\\hmisenginuity.rtf
internetdown,\\CS\\NET\\Wiki\\WikiNotes\\internetdown.rtf
jcsprint,\\CS\\NET\\Wiki\\WikiNotes\\jcsprint.rtf
jurymailers,\\CS\\NET\\Wiki\\WikiNotes\\jurypanelmailers.rtf
kiphs,\\CS\\NET\\Wiki\\WikiNotes\\kiphs.rtf
lansweepersetup,\\CS\\NET\\Wiki\\WikiNotes\\lansweepersetup.rtf
laserficherepository,\\CS\\NET\\Wiki\\WikiNotes\\laserficherepository.rtf
lattice,\\CS\\NET\\Wiki\\WikiNotes\\lattice.rtf
cadmaps,\\CS\\NET\\Wiki\\WikiNotes\\cadmaps.rtf
mobility,\\CS\\NET\\Wiki\\WikiNotes\\mobility.rtf
paradoxconfig,\\CS\\NET\\Wiki\\WikiNotes\\paradoxconfig.rtf
pbx,\\CS\\NET\\Wiki\\WikiNotes\\pbx.rtf
preahotline,\\CS\\NET\\Wiki\\WikiNotes\\preahotline.rtf
commishpresentation,\\CS\\NET\\Wiki\\WikiNotes\\commishpresentation.rtf
printscanadmin,\\CS\\NET\\Wiki\\WikiNotes\\printscanadmin.rtf
productcodes,\\CS\\NET\\Wiki\\WikiNotes\\productcodes.rtf
zip4update,\\CS\\NET\\Wiki\\WikiNotes\\zip4update.rtf
wiccims,\\CS\\NET\\Wiki\\WikiNotes\\wiccims.rtf
westlaw,\\CS\\NET\\Wiki\\WikiNotes\\westlaw.rtf
vpnsetup,\\CS\\NET\\Wiki\\WikiNotes\\vpnsetup.rtf
vsphere,\\CS\\NET\\Wiki\\WikiNotes\\vsphere.rtf
spillmanconfig,\\CS\\NET\\Wiki\\WikiNotes\\spillmanconfig.rtf
shoretelvoice,\\CS\\NET\\Wiki\\WikiNotes\\shoretelvoice.rtf
shoretelcommunicator,\\CS\\NET\\Wiki\\WikiNotes\\shoretelcommunicator.rtf
schedulesoftconfig,\\CS\\NET\\Wiki\\WikiNotes\\schedulesoftconfig.rtf
schedulesoftinstall,\\CS\\NET\\Wiki\\WikiNotes\\schedulesoftinstall.rtf
realmarketdata,\\CS\\NET\\Wiki\\WikiNotes\\realmarketdata.rtf
*/
namespace MoveNext
{
public partial class Form1 : Form
{
TreeNode selectedNode;
TreeNode root;
public Form1()
{
InitializeComponent();
root = new TreeNode("Software");
}
private void Form1_Load(object sender, EventArgs e)
{
tv.Nodes.Add(root);
loadNodes();
}
private void loadNodes()
{
StreamReader sr = new StreamReader(@"C:\Dev\WMI Creator\project\MoveNext\MoveNext\nodes.txt");
String line;
while((line = sr.ReadLine()) != null)
{
String[] s = line.Split(',');
TreeNode n = new TreeNode(s[0]);
n.Tag = s[1];
n.ImageIndex = 0;
root.Nodes.Add(n);
}
}
private void bnAddNode_Click(object sender, EventArgs e)
{
if (selectedNode != null)
{
TreeNode n = new TreeNode(teNodeName.Text);
n.Tag = teFileName.Text;
selectedNode.Nodes.Add(n);
}
}
private void bnOpenFile_Click(object sender, EventArgs e)
{
if (file.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
teFileName.Text = file.FileName;
}
}
private void tv_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
richTextBox1.Clear();
selectedNode = e.Node;
if (selectedNode.Tag != null)
{
Text = selectedNode.Tag.ToString();
if (File.Exists(selectedNode.Tag.ToString()))
richTextBox1.LoadFile(selectedNode.Tag.ToString(), RichTextBoxStreamType.PlainText);
}
}
}
}