Click here to Skip to main content
15,903,388 members
Home / Discussions / C#
   

C#

 
QuestionShow Internet Optiions Dialog with C# [modified] Pin
Adiphe26-May-06 0:55
Adiphe26-May-06 0:55 
AnswerRe: Show Internet Optiions Dialog with C# [modified] Pin
Shajeel26-May-06 1:32
Shajeel26-May-06 1:32 
GeneralRe: Show Internet Optiions Dialog with C# [modified] Pin
Adiphe26-May-06 1:38
Adiphe26-May-06 1:38 
AnswerRe: Show Internet Optiions Dialog with C# [modified] Pin
Shajeel26-May-06 2:24
Shajeel26-May-06 2:24 
GeneralRe: Show Internet Optiions Dialog with C# [modified] Pin
Adiphe26-May-06 2:47
Adiphe26-May-06 2:47 
QuestionCLONE FORM Pin
Greeky26-May-06 0:52
Greeky26-May-06 0:52 
AnswerRe: CLONE FORM Pin
Robert Rohde26-May-06 1:49
Robert Rohde26-May-06 1:49 
Questionduplicate items in treeview [modified] Pin
lushgrass26-May-06 0:34
lushgrass26-May-06 0:34 
i'm having problems with treeview updating.
i'm trying to redraw the tree so that it reflects an ArrayList of servers and devices. below is my code.
sorry about the parsing. will try to come back and fix it up.

public void TreeRefresh()
{
this.m_tvTree.BeginUpdate();
this.m_tvTree.ExpandAll();
PruneTreeBranches();
GrowTreeBranches();
this.m_tvTree.ExpandAll();
this.m_tvTree.EndUpdate();
}

private void PruneTreeBranches()
{
TreeNode tn = this.m_tvTree.TopNode;
while(tn != null)
{
if(tn.Tag.ToString().IndexOf("s") == 0)
{
string ip = tn.Tag.ToString().Substring(2);
CServer server = m_Servers.GetServer(ip);
if(server == null)
{
DeleteTreeNode(tn);
tn = this.m_tvTree.TopNode;
continue;
}
}
else if(tn.Tag.ToString().IndexOf("d") == 0)
{
string ip = tn.Tag.ToString().Substring(4);
CServer server = m_Servers.GetServer(ip);
if(server == null)
{
DeleteTreeNode(tn);
tn = this.m_tvTree.TopNode;
continue;
}
int port = Convert.ToInt32(tn.Tag.ToString().Substring(2,1));
CDevice device = server.FindDevice(port);
if(device == null)
{
DeleteTreeNode(tn);
tn = this.m_tvTree.TopNode;
continue;
}
}
else
{
DeleteTreeNode(tn);
tn = this.m_tvTree.TopNode;
continue;
}
tn = tn.NextVisibleNode;
}
}

private void DeleteTreeNode(TreeNode tn)
{
this.m_tvTree.Nodes.Remove(tn);
}

private void GrowTreeBranches()
{
if(this.m_bShowServers)
{
for(int ii = 0; ii < m_Servers.Count; ii++)
{
CServer server = (CServer)m_Servers[ii];
GrowServerBranch(server);
}
}
else
{
for(int ii = 0; ii < m_Servers.Count; ii++)
{
CServer server = (CServer)m_Servers[ii];
for(int jj = 0; jj < server.Devices.Count; jj++)
{
CDevice device = (CDevice) server.Devices[jj];
TreeNode dn = GrowDeviceBranch(device, server.IpAddress);
if(IsNew(dn.Tag.ToString()) == null)
this.m_tvTree.Nodes.Add(dn);
}
}
}
}

private void GrowServerBranch(CServer server)
{
TreeNode tn = IsNew("s "+server.IpAddress);
if(tn == null)
{
tn = new TreeNode();
tn.Tag = "s " + server.IpAddress;
tn.SelectedImageIndex = 5;
tn.ImageIndex = 5;
this.m_tvTree.Nodes.Add(tn);
}
if(server.ServerAlias == server.DefaultAlias)
tn.Text = server.ServerAlias + ": " + server.IpAddress;
else
tn.Text = server.ServerAlias;
for(int ii = 0; ii < server.Devices.Count; ii++)
{
TreeNode dn = GrowDeviceBranch((CDevice)server.Devices[ii], server.IpAddress);
if(IsNew(dn.Tag.ToString()) == null)
tn.Nodes.Add(dn);
}
}

private TreeNode GrowDeviceBranch(CDevice device, string ip)
{
TreeNode tn = IsNew("d "+device.Port+" "+ip);
if(tn == null)
{
tn = new TreeNode();
tn.Tag = "d "+ device.Port + " " + ip;
}
tn.Text = device.Manufacturer + " - " + device.ModelNumber;
tn.SelectedImageIndex = device.Status.Status;
tn.ImageIndex = device.Status.Status;
return tn;
}

private TreeNode IsNew(string mCheck)
{
TreeNode tn = this.m_tvTree.TopNode;
while(tn != null)
{
if(tn.Tag.ToString() == mCheck)
return tn;
tn = tn.NextVisibleNode;
}
return null;
}
QuestionShowing and hiding controls [modified] Pin
travellermania26-May-06 0:27
travellermania26-May-06 0:27 
AnswerRe: Showing and hiding controls Pin
Larantz26-May-06 0:34
Larantz26-May-06 0:34 
GeneralRe: Showing and hiding controls Pin
travellermania26-May-06 0:49
travellermania26-May-06 0:49 
GeneralRe: Showing and hiding controls Pin
Robert Rohde26-May-06 1:46
Robert Rohde26-May-06 1:46 
GeneralRe: Showing and hiding controls [modified] Pin
travellermania26-May-06 21:43
travellermania26-May-06 21:43 
AnswerRe: Showing and hiding controls [modified] Pin
Robert Rohde26-May-06 0:41
Robert Rohde26-May-06 0:41 
AnswerRe: Showing and hiding controls [modified] Pin
LongRange.Shooter26-May-06 4:06
LongRange.Shooter26-May-06 4:06 
QuestionSelected a listviewitem Pin
NewbieDude25-May-06 23:56
NewbieDude25-May-06 23:56 
AnswerRe: Selected a listviewitem Pin
Ed.Poore26-May-06 0:21
Ed.Poore26-May-06 0:21 
Questionhowto get data in datatable ? Pin
cmpeng3425-May-06 23:38
cmpeng3425-May-06 23:38 
AnswerRe: howto get data in datatable ? Pin
albCode25-May-06 23:52
albCode25-May-06 23:52 
GeneralMessage Closed Pin
25-May-06 23:57
cmpeng3425-May-06 23:57 
GeneralRe: howto get data in datatable ? [modified] Pin
Larantz26-May-06 0:17
Larantz26-May-06 0:17 
QuestionHelp with calling NetFileEnum from NetApi32.dll Pin
dlaw148925-May-06 23:05
dlaw148925-May-06 23:05 
Questiona question about displaying time ? help ... Pin
cmpeng3425-May-06 23:05
cmpeng3425-May-06 23:05 
AnswerRe: a question about displaying time ? help ... Pin
_AK_25-May-06 23:14
_AK_25-May-06 23:14 
AnswerRe: a question about displaying time ? help ... Pin
rah_sin25-May-06 23:21
professionalrah_sin25-May-06 23:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.