Array and TreeView

  • Thread starter Thread starter Trond Hoiberg
  • Start date Start date
T

Trond Hoiberg

I have a lil problem i am struggling with.
I have a folder LOGFILES that contains subfolder. Like this:
MACHINE1
--DATE1
--DATE2
--DATE3

MACHINE2
--DATE1
--DATE2
--DATE3

Within the folders DATEx there are files. log files. Is there a way i can
create a class that builds up an array or hastable like this:

Machine1 Date1 log1
Machine1 Date2 log1
Machine1 Date3 log1
Machine1 Date3 log2
Machine1 Date3 log3
Machine2 Date1 log1
Machine2 Date1 log2
Machine2 Date1 log2
Machine2 Date2 log1
Machine2 Date3 log1

The reason why i want to do this is because i want to populate a TreeView
control with these data.
The optimal solution would be to generate an object pr file and store that
as a collection in a date object. And the date object as a collection in a
MACHINE object. That way i can populate the treeView control with data from
inside the file insted of the filename.

Like this:

MACHINE1
--DATE1
----log1
--DATE2
----log1
--DATE3
----log1
----log2
----log3
MACHINE2
--DATE1
----log1

and so on

If anyone has a tip or can point me to info related to this I will
appreciate it

best regards
Trond
 
Hi,

I'd build the class hierarchy (the MachineCollection class, the Machine
class, the DateFolderCollection class and the DateFolder class) upfront.
Then, I'd write some facade class capable of populating the root
MachineCollection with the data. Finally, I'd create a control inherited
from TreeView which would have a constructor accepting the MachineCollection
as a parameter and would then populate the treeview from the given
hierarchy.
 
Thank you, this was a little abstract for me, but i will give it a try and
see if i can solve it. I am a newbee regarding CSharp as you might have
guessed :-)

Best regards
Trond



Dmitriy Lapshin said:
Hi,

I'd build the class hierarchy (the MachineCollection class, the Machine
class, the DateFolderCollection class and the DateFolder class) upfront.
Then, I'd write some facade class capable of populating the root
MachineCollection with the data. Finally, I'd create a control inherited
from TreeView which would have a constructor accepting the
MachineCollection as a parameter and would then populate the treeview from
the given hierarchy.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

Trond Hoiberg said:
I have a lil problem i am struggling with.
I have a folder LOGFILES that contains subfolder. Like this:
MACHINE1
--DATE1
--DATE2
--DATE3

MACHINE2
--DATE1
--DATE2
--DATE3

Within the folders DATEx there are files. log files. Is there a way i can
create a class that builds up an array or hastable like this:

Machine1 Date1 log1
Machine1 Date2 log1
Machine1 Date3 log1
Machine1 Date3 log2
Machine1 Date3 log3
Machine2 Date1 log1
Machine2 Date1 log2
Machine2 Date1 log2
Machine2 Date2 log1
Machine2 Date3 log1

The reason why i want to do this is because i want to populate a TreeView
control with these data.
The optimal solution would be to generate an object pr file and store
that as a collection in a date object. And the date object as a
collection in a MACHINE object. That way i can populate the treeView
control with data from inside the file insted of the filename.

Like this:

MACHINE1
--DATE1
----log1
--DATE2
----log1
--DATE3
----log1
----log2
----log3
MACHINE2
--DATE1
----log1

and so on

If anyone has a tip or can point me to info related to this I will
appreciate it

best regards
Trond
 
Hi again, do you have some code that could help me understand your solution?
Best regards
Trond

Dmitriy Lapshin said:
Hi,

I'd build the class hierarchy (the MachineCollection class, the Machine
class, the DateFolderCollection class and the DateFolder class) upfront.
Then, I'd write some facade class capable of populating the root
MachineCollection with the data. Finally, I'd create a control inherited
from TreeView which would have a constructor accepting the
MachineCollection as a parameter and would then populate the treeview from
the given hierarchy.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

Trond Hoiberg said:
I have a lil problem i am struggling with.
I have a folder LOGFILES that contains subfolder. Like this:
MACHINE1
--DATE1
--DATE2
--DATE3

MACHINE2
--DATE1
--DATE2
--DATE3

Within the folders DATEx there are files. log files. Is there a way i can
create a class that builds up an array or hastable like this:

Machine1 Date1 log1
Machine1 Date2 log1
Machine1 Date3 log1
Machine1 Date3 log2
Machine1 Date3 log3
Machine2 Date1 log1
Machine2 Date1 log2
Machine2 Date1 log2
Machine2 Date2 log1
Machine2 Date3 log1

The reason why i want to do this is because i want to populate a TreeView
control with these data.
The optimal solution would be to generate an object pr file and store
that as a collection in a date object. And the date object as a
collection in a MACHINE object. That way i can populate the treeView
control with data from inside the file insted of the filename.

Like this:

MACHINE1
--DATE1
----log1
--DATE2
----log1
--DATE3
----log1
----log2
----log3
MACHINE2
--DATE1
----log1

and so on

If anyone has a tip or can point me to info related to this I will
appreciate it

best regards
Trond
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top