|
That's not a design pattern... but it almost is.
|
|
|
|
|
|
You designed it. If you don't know what it is for throw it away and start over.
|
|
|
|
|
Instead telling this kind of comments let me know this thing..
My intention is to know 'all the advantages' of this kind of a design... I guess the following please add if you know anymore
1) the implementation of different file type class can be isolated to separate class
2) i can simply add a new file type into this system
3) There wont be any change in obj.ProcessFile() as it is a base pointer.
Pls add more to this
My small attempt...
|
|
|
|
|
True, except maybe for 2.
You may want to use plug-ins if you want a lot of flexibility.
|
|
|
|
|
A design should be evaluated based on how well it solves the problem. Without stating the exact problem you are trying to solve you can't know the advantages of one design over another. You also don't give an alternative design. Without an alternative to compare it against it has no advantage or disadvantage.
What is the advantage of an orange?
If the problem to solve is driving a nail and the alternative is a hammer there is no advantage. If the problem to solve is vitamin C intake and the alterntiave is a multi-vitamin, the advantages are taste and refreshment.
|
|
|
|
|
The main advantage is that you can treat XML and CSV files in the same way. By processing both types as BaseFileClass, you can use the same code for handling both subclasses.
This is a type of code reuse. It also makes the higher-level processing simpler, since it's independent of the details of your derived classes.
|
|
|
|
|
Like we use crystal report, design it and print the required data only.
Similar to this is it possible to print label from this software Zebra Designer pro.
If i create a label format from Zebra designer pro software and want to print.
Is it possible that we can print this from C# or any other way?
|
|
|
|
|
I was you I'd try and contact Zebra Technologies and ask them for help.
I mean, you need some information to do this, if they have any kind of API or some argument call to the exe file to do this.
Anyhow I'll be surprised if they give you any help with this. If I were you I'd place my hopes somewhere else, you can check this link:
- http://www.filesland.com/free/label-printing.html
Open source software can help you better.
Regards
|
|
|
|
|
Hi,
Few days back, I was asked how does GC checks for the references. Googled and found this great article http://msdn.microsoft.com/hi-in/magazine/bb985010(en-us).aspx which explains it in depth. Sill, the concept of Root is not clear to me.
Few questions I have.
- What is a root?
- Is it a memory or part of managed heap or something else?
- what does is contains, references/ pointers to objects initialized using new operator?
- Any link explaining it better?
Thanks in advance.
- Praveen
|
|
|
|
|
Re-read this paragraph from the article, it explains roots. And look at Figure2.
Every application has a set of roots. Roots identify storage locations, which refer to objects on the managed heap or to objects that are set to null. For example, all the global and static object pointers in an application are considered part of the application's roots. In addition, any local variable/parameter object pointers on a thread's stack are considered part of the application's roots. Finally, any CPU registers containing pointers to objects in the managed heap are also considered part of the application's roots.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
The only valid measurement of code quality: WTFs/minute.
|
|
|
|
|
Regarding this statement in the article:
"There are very few good uses of resurrection, and you really should avoid it if possible."
Is there ever a good reason to use resurrection? Nothing comes to mind for me.
|
|
|
|
|
Timothy CIAN wrote: Is there ever a good reason to use resurrection?
Nothing comes to mind for me. However, Lazarus and Jesus might disagree.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
The only valid measurement of code quality: WTFs/minute.
|
|
|
|
|
Hi dear friend
I want to create a model that destroyed the data to predict. But I do not know how many roles in the fuzzy algorithm is used .. Please help me.
Thank you very much.
modified on Saturday, July 3, 2010 2:32 AM
|
|
|
|
|
1) Your question is not clear; please give more details.
2) Never post your email address to any forum, unless you really like spam. If you get a reply, the forum will automatically send you an email - just like this one, in fact.
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
thank you dear..
What rule is appropriate in the Sugeno method ?
|
|
|
|
|
Does anybody know where is some information about how to play wav files from Pocket PC using C# 2.0?
|
|
|
|
|
I'm not sure you can on a Pocket PC - you can on Windows Mobile devices because they support .NET compact framework.
Since C# requires at least .NET CF, the device must support that first.
If your device does not support .NET CF, then you will have to use C/C++ instead.
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
Hello,
I want to create some custom groupboxes. What I did is created a new class called MyGroupBox that is derived from System.Windows.Forms.GroupBox .
Everything is going great but I have a problem. I want to overwrite the default OnEnabledChanged event and add a new feature.
What I did is this:
protected override void OnEnabledChanged(EventArgs e)
{
if (this.Enabled)
{
this.ColorScheme = EnmColorScheme.Purple;
}
else
{
this.ColorScheme = EnmColorScheme.Green;
}
}
Now what this will do is change the color of a disaled groupbox. The problem is that if I do this, the default functionality dissapers. When disabling a groupbox, all controls from the groupbox should be disabled. If I override the event, than his does not happen.
What can I do to make the event behave like in the past, but also hadd my functionality (to add colors).
I don't wan to implement this in every object that I created, that's why I am doing it in the main class "MyGroupBox".
Any help is greatly appreciated.
Thanks!
Vlad
|
|
|
|
|
I haven't looked but if the GroupBox default OnEnabledChanged is to loop through each child control and disable or enable them then that is your problem. Since you are overriding the default method you are not putting that code in there.
The code above is just changing the color. You need to add the code to disable/enable all the controls.
|
|
|
|
|
Hello,
Thanks for the suggestion but I already tried it in the past but it did not work. I used this:
for (int i = 0; i < this.Controls.Count; i++)
{
this.Controls[i].Enabled = this.Enabled;
}
The controls are getting activated, but they are not clickable. Can you give it a shot?
Vlad
|
|
|
|
|
I think you might have to force a refresh after changing it
try something like this:
protected override void OnEnabledChanged(EventArgs e)
{
if (this.Enabled)
{
EnableChildren();
base.Refresh();
}
else
{
DisableChildren();
base.Refresh();
}
}
private void DisableChildren()
{
foreach (Control c in this.Controls)
{
c.Enabled = false;
}
}
private void EnableChildren()
{
foreach (Control c in this.Controls)
{
c.Enabled = true;
}
}
|
|
|
|
|
I did try your example.. It does do what you want but it doesn't show up because it hasn't repainted the controls.
You will notice that once that runs and it disables all child controls that they appear to still be enabled (even though they are not). If you run your mouse over them they will redraw and will now show to be disabled.
After your for statement run a this.Refresh();
So when the groupbox gets called to disable/enable each time it will loop through each control and eitehr disable or enable them.
|
|
|
|
|
Hello,
First, your code could easily be written as:
foreach(Control c in this.Controls)
{
c.Enabled = this.Enabled;
}
base.Refresh();
*this is just a note
Now the problem is that it still does not work
I tried it with this.Refresh() also but still no luck...
|
|
|
|
|
I know that.
Here is what I created to mimic your problem:
public partial class CustomControl1 : System.Windows.Forms.GroupBox
{
public CustomControl1()
{
InitializeComponent();
}
protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);
}
protected override void OnEnabledChanged(EventArgs e)
{
if (this.Enabled)
{
}
else
{
}
foreach (Control c in this.Controls)
c.Enabled = this.Enabled;
base.Refresh();
}
}
After I created that I created a Windows Form with two group box. One groupbox was my custom one, and the other was an normal group box. Each groupbox had two regular checkboxes in them. I also placed two buttons out to the right (one for Enable and Disable)
private void button1_Click(object sender, EventArgs e)
{
customControl11.Enabled = true;
groupBox1.Enabled = true;
}
private void button2_Click(object sender, EventArgs e)
{
customControl11.Enabled = false;
groupBox1.Enabled = false;
}
Now on my form I click the Disable button and it disables both group boxes and all FOUR checkboxes. I click Enable and it enables them. This is what your problem was correct?
|
|
|
|