|
checking in foo() is ok. i just tried and it seems to work.
to get things clear: when a class consists of a static member, this member is stored somewhere else than the objects of that class (which are destroyed by the GC when references go to zero) and are freed/destroyed when? at the end of the program-run? i just want to understand that...
:wq
|
|
|
|
|
The best solution to this is to use a static member and static constructor. Create some class which has the static member of the type you are referring to. Then put hte build datastructure code in the static COnstructor. This way the table will only be built ont time and you odn't have to worry about when to build it. The static constructor will be called before anything in the class is accessed.
|
|
|
|
|
|
Hi all
Im painting alot of lines to a part of the screen at a very fast rate (100fps). Now I note in taskmanager that the PF (pagefault?) delta goes up to 10000 - 15000 when these drawing operations take place. Is this normal and what i also find is huge memory usage (normal 20mb ranging to 120mb). Is this just the GC taking its time to "kick" in?
Thanx in advance
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
hmm. i have a program which runs all day long and does some minor painting/threading/network-things every 5 minutes. i had very neat effects with it running in the background (top was a complete reboot of my win2k-machine) - from weird/interchanged icons over wrong repainting to ... well this reboot once.
i don't trust gdi+
(yes i released every resource)
:wq
|
|
|
|
|
OK problem solved , a Bitmap object was created every frame, i decided get graphics object from handle instead of getting it from a bitmap. Damn that doesnt work either, different problem.
OK, then I created Bitmap at constructor. Helps with memory issue, but still seeing about 5000 - 10000 PF (page file, not fault ) delta. Is this at all bad in anyway?
Maybe its time to look at DirectDraw...
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
Hi!
Do you call Dispose() on the graphic objects when you don't need them anymore (end of function or end of loop)?? Because the garbage collector doesn't handle unmanaged resources (like GDI or file handles) and therefore only collects your classes (and with them the unmanaged resources) during idle time.
Cheers
HTH
Martin
"Situation normal - all fu***d up"
Illuminatus!
|
|
|
|
|
H i Martin
I have tried calling Dispose and without , same effect, seems there are a lot of useless funtions lying around. The PF delta is caused as a bitmap is written to every 20ms or so. The high memory issue was cause by creating a new Bitmap every time instead of just reusing one. Unfortunately, ya cant seem to write directly to the screen without flashing problems (every draw/clear operation is reflected immediately to screen. So i guess im stuck with the PF delta problem although I dont think its so serious.
Thanx for the help
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
Dim UIH As UIHierarchy = DTE.Windows.Item onstants.vsWindowKindMacroExplorer).Object
Dim samples As UIHierarchyItem = UIH.GetItem("Macros\Samples")
How to convert these two lines to c#.I am just starting c# on doing some simple project.UIHiearchy is a interface.
Thanks in advance
|
|
|
|
|
<br />
UIHierarchyItem samples = UIH.GetItem("Macros\Samples");<br />
thats the second line but i will will need to know more about the first line before i can convert it.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
suresh_sathya wrote:
Dim UIH As UIHierarchy = DTE.Windows.Item onstants.vsWindowKindMacroExplorer).Object
Thre ar som mising chratrs
Please repost line
maybe
UIHierarchy UIH = (UIHierarchy) DTE.Windows.Item[Constants.vsWindowKindMacroExplorer];
Try it
UPDATE: Dont try it, it wont work. That constant is not defined in any enum from the envdte assembly. Could you please repost complete VB.Net line?
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
leppie wrote:
maybe
UIHierarchy UIH = (UIHierarchy) DTE.Windows.Item[Constants.vsWindowKindMacroExplorer];
I don't use VB.NET but the assembliey attributes are placed between < and >.
Ñ There is only one MP Ð
|
|
|
|
|
Maciej Pirog wrote:
I don't use VB.NET but the assembliey attributes are placed between < and >.
1st - In VB.NET of course
2nd - Maybe it should be:
Dim UIH As UIHierarchy = DTE.Windows.Item(constants.vsWindowKindMacroExplorer).Object
In C#:
UIHierarchy UIH = (UIHierarchy)DTE.Windows.Item(Constants.vsWindowKindMacroExplorer).Object;
or
UIHierarchy UIH = (UIHierarchy)DTE.Windows.Item(Constants.vsWindowKindMacroExplorer).Object();
I havn't wrote any Add-In so far, and I'm not sure:
.Object; or .Object();
Ñ There is only one MP Ð
|
|
|
|
|
I'll help you solve this problem because my fellow CPians who have not had the pain of learning VB.NET can't seem to figure this out. This should work.
UIHierarchy UIH = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindMacroExplorer).Object;
UIHierarchyItem samples = UIH.GetItem("Macros\Samples");
David Stone
But Clinton wasn't a predictable, boring, aging, lying, eloquent, maintainer-of-the-status-quo. He was a predictable, boring-but-trying-to-look-hip, aging-and-fat-but-seemingly-oblivious-to-it, lying-but-in-sadly-blatant-ways, not-eloquent-but-trying-to-make-up-for-it-by-talking-even-more, bringer-in-of-scary-and-potentially-dangerous-new-policies. And there was also Al Gore. It just wasn't *right*.
Shog9
|
|
|
|
|
Btw just in case you are converting a Macro don't bother only VB.Net is supported for scripting.
May the Source be with you
Sonork ID 100.9997 sijinjoseph
|
|
|
|
|
This code is found in InitializeComponent() on my form, busFormManager1 is my class.
this.busFormManager1.ActiveDockControl = null;<br />
this.busFormManager1.ActiveMdiChild = null;<br />
this.busFormManager1.BarManager = null;<br />
this.busFormManager1.DefaultRegion = Medea.GfxLib.Windows.Forms.BusFormManager.ClientRegion.ToolLeft;<br />
this.busFormManager1.DockManager = null;<br />
this.busFormManager1.EnableMaximizedMode = false;<br />
this.busFormManager1.Parent = null;
now in design mode the form will not appear, only a blank white page with exception message Object reference not set to an instance of an object.. At runtime everything works fine, just the desinger kicks my form out.
I guess that my FormManager will execute code at this time, that is not valid or some object required for him are null at this time.
Now i've tried to use the DesignMode Flag, to test in which state the class is. Now it seem's that this flag is always false until InitializeComponent() is executed.
how to code this propertys the right way, that you can still watch the form in Designer ?
if you got a property like this
public Form Parent<br />
{<br />
set<br />
{<br />
this.parent = value;<br />
if (parent != null)<br />
{<br />
parent.Load += new EventHandler(....../<br />
parent.IsMdiParent = true;<br />
}<br />
}<br />
get<br />
{<br />
return this.parent;<br />
}<br />
}
now this property let crash the desinger, cause there's to much code in it to execute at InitializeComponent() .
Any hint ? how did microsoft code all the components in dotnet ? they work always, not like mine ;(
.:Greets from Jerry Maguire:.
|
|
|
|
|
Does your class have a default contructor ie one that does not take any arguements? If not, that should solve it, else I cant help you
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
|
object is the mother of all classes.
Nnamdi Onyeyiri wrote:
what type is System.Object?
it's an object type
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
|
When u write:
class MyClass {<br />
}
it's really:
class MyClass : object {<br />
}
Thats understood.
now for example:
MyClass myclass = new MyClass();
now
(myclass.GetType() == typeof(MyClass)) = true
Similarly:
object myobject = new object;
now
(myobject.GetType() == typeof(object)) = true
Hope u understand...I wouldnt have sleepless nites though
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
|
That will throw an compiler error as it is a duplicate definition.
You can however do this:
class MyClass : SomeOtherNamespace.MyClass {<br />
}
as the context for each MyClass is different
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
|
OK I think I know what u are getting to, the answer lies in inheritance.
class Base : object //this is not necessary as u know
{
public string Name {get;set}
}
Now Base class will inherit (iow have) all of it's base class's (object or System.Object, same thing) public and protected members.
class MyClass : Base
{
public int Value {get;set;}
public void DoStuff();
}
Now MyClass will get all of Base's public and protected methods, but remember Base has inherited some members from object as well, so it gets those as well.
It can get very confusing, I know. Designing a good class hierarchy takes time, only certain aspects might be affected at each level, but in the end all the inherited properties will be "visible" from top (most specialized class) to bottom (object). Look at the Form class and see how many members are actually inherited.
So in the end there can be only one! The same object class is used everywhere in .NET.
Hope this helps
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|