C# need some direction
-
Hi All, I'm pretty new here so excuse my ignorance ;) I've just started learning C# and come from a long history of C/C++/PowerBASIC/Assembly, 20 years total. To learn C# I decided to jump in with both feet and recreate some past projects for fun. So here is what I want to do and where I am getting stuck. I have a Layout which consists of Tracks, each Track contains Layers. Think of this like an multi-track audio application and Photoshop combined. Each Track in a Layout should have a unique Name. Every Layer in a Track should also have a unique Name. This sounds to me like I need to use a Dictionary collection. I also need to iterate over these Tracks and Layers in order to draw them IN the correct order. The order should be user defined and should allow for user re-ordering (MoveUp MoveDown type of thing). So I'm left thinking I need a Dictionary + Sorted Array by Order collection? I'm sure this can be done but as I said I'm quite new to C#/.NET and would like some direction. Thanks!
-
Hi All, I'm pretty new here so excuse my ignorance ;) I've just started learning C# and come from a long history of C/C++/PowerBASIC/Assembly, 20 years total. To learn C# I decided to jump in with both feet and recreate some past projects for fun. So here is what I want to do and where I am getting stuck. I have a Layout which consists of Tracks, each Track contains Layers. Think of this like an multi-track audio application and Photoshop combined. Each Track in a Layout should have a unique Name. Every Layer in a Track should also have a unique Name. This sounds to me like I need to use a Dictionary collection. I also need to iterate over these Tracks and Layers in order to draw them IN the correct order. The order should be user defined and should allow for user re-ordering (MoveUp MoveDown type of thing). So I'm left thinking I need a Dictionary + Sorted Array by Order collection? I'm sure this can be done but as I said I'm quite new to C#/.NET and would like some direction. Thanks!
A Dictionary might be the way to go, but you will have to be very careful what you use for the key. If you use trackName it will complicate retrieving the display order. Even if you use displayIndex, implementing the move up/down functionality could get complicated. Without thinking about it for a while, I don't have a better suggestion, but I'm sure that somebody will.
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
Hi All, I'm pretty new here so excuse my ignorance ;) I've just started learning C# and come from a long history of C/C++/PowerBASIC/Assembly, 20 years total. To learn C# I decided to jump in with both feet and recreate some past projects for fun. So here is what I want to do and where I am getting stuck. I have a Layout which consists of Tracks, each Track contains Layers. Think of this like an multi-track audio application and Photoshop combined. Each Track in a Layout should have a unique Name. Every Layer in a Track should also have a unique Name. This sounds to me like I need to use a Dictionary collection. I also need to iterate over these Tracks and Layers in order to draw them IN the correct order. The order should be user defined and should allow for user re-ordering (MoveUp MoveDown type of thing). So I'm left thinking I need a Dictionary + Sorted Array by Order collection? I'm sure this can be done but as I said I'm quite new to C#/.NET and would like some direction. Thanks!
If by user defined, you just mean the user can reorder them manually, then just a dictionary works fine to create mappings of Tracks to Layers. I thought that the order of keys remains the order in which they were added, also, although I am not sure that the collection supports remove at index and add at index, I would have to hope that it did.
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
-
Hi All, I'm pretty new here so excuse my ignorance ;) I've just started learning C# and come from a long history of C/C++/PowerBASIC/Assembly, 20 years total. To learn C# I decided to jump in with both feet and recreate some past projects for fun. So here is what I want to do and where I am getting stuck. I have a Layout which consists of Tracks, each Track contains Layers. Think of this like an multi-track audio application and Photoshop combined. Each Track in a Layout should have a unique Name. Every Layer in a Track should also have a unique Name. This sounds to me like I need to use a Dictionary collection. I also need to iterate over these Tracks and Layers in order to draw them IN the correct order. The order should be user defined and should allow for user re-ordering (MoveUp MoveDown type of thing). So I'm left thinking I need a Dictionary + Sorted Array by Order collection? I'm sure this can be done but as I said I'm quite new to C#/.NET and would like some direction. Thanks!
-
Hi All, I'm pretty new here so excuse my ignorance ;) I've just started learning C# and come from a long history of C/C++/PowerBASIC/Assembly, 20 years total. To learn C# I decided to jump in with both feet and recreate some past projects for fun. So here is what I want to do and where I am getting stuck. I have a Layout which consists of Tracks, each Track contains Layers. Think of this like an multi-track audio application and Photoshop combined. Each Track in a Layout should have a unique Name. Every Layer in a Track should also have a unique Name. This sounds to me like I need to use a Dictionary collection. I also need to iterate over these Tracks and Layers in order to draw them IN the correct order. The order should be user defined and should allow for user re-ordering (MoveUp MoveDown type of thing). So I'm left thinking I need a Dictionary + Sorted Array by Order collection? I'm sure this can be done but as I said I'm quite new to C#/.NET and would like some direction. Thanks!
-
Hi All, I'm pretty new here so excuse my ignorance ;) I've just started learning C# and come from a long history of C/C++/PowerBASIC/Assembly, 20 years total. To learn C# I decided to jump in with both feet and recreate some past projects for fun. So here is what I want to do and where I am getting stuck. I have a Layout which consists of Tracks, each Track contains Layers. Think of this like an multi-track audio application and Photoshop combined. Each Track in a Layout should have a unique Name. Every Layer in a Track should also have a unique Name. This sounds to me like I need to use a Dictionary collection. I also need to iterate over these Tracks and Layers in order to draw them IN the correct order. The order should be user defined and should allow for user re-ordering (MoveUp MoveDown type of thing). So I'm left thinking I need a Dictionary + Sorted Array by Order collection? I'm sure this can be done but as I said I'm quite new to C#/.NET and would like some direction. Thanks!
Ok guys, Looks like I've gone a thoroughly confused myself here. Perhaps one of you kind folks can chime in and set me straight. Here are my requirements: 1. Collection of layers called layerCollection 2. Each Layer must have a Name property that is unique to the collection it resides in. 3. You can access each Layer in the collection by Name or Index[] foundLayer = layerCollection.getLayer("Background"); <-- returns Layer with layerName = "Border" foundLayer = layerCollection.getLayer("Border"); foundLayer = layerCollection [0]; foundLayer = layerCollection [1]; etc... Help :D Once I figure this part out I'm sure sorting the layerCollection to reorder them will be a simple task. Thanks again for your help and patience!