Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Diagram.RegisterItemClass (Read 3264 times)
Aziz ur Rahman
YaBB Newbies
*
Offline



Posts: 43
Joined: Feb 23rd, 2009
Diagram.RegisterItemClass
Mar 15th, 2009 at 3:05pm
Print Post  
1) How to check that a particular class is already registered or not?

2) How to un register it? (I donot want the class to get serialzed using saveto methods)
  

Syed Aziz ur Rahman
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram.RegisterItemClass
Reply #1 - Mar 16th, 2009 at 8:50am
Print Post  
1) You might do something like this:

if ((diagram as IItemFactory).TypeTable[typeof(IconNode)] == null)
     Diagram.RegisterItemClass(typeof(IconNode), "IconNode", 0);

2) If you don't want it serialized, you could simply not call the Register method. You can access ClsidTable and TypeTable as shown above - they are Hashtable objects - and remove the type from the first table and the id from the second table.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Aziz ur Rahman
YaBB Newbies
*
Offline



Posts: 43
Joined: Feb 23rd, 2009
Re: Diagram.RegisterItemClass
Reply #2 - Mar 16th, 2009 at 9:02am
Print Post  
My application is a tab based application means that i can have several instance of diagrams at the same time in different tabs.

So do i have to do this with each and every instance of diagram?

Is not there a share method for unRegistering and checking for registering as it is there for register.
  

Syed Aziz ur Rahman
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram.RegisterItemClass
Reply #3 - Mar 16th, 2009 at 9:03am
Print Post  
This is something you can do only once for the application lifetime, you do not have to register the custom types with each Diagram instance.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Aziz ur Rahman
YaBB Newbies
*
Offline



Posts: 43
Joined: Feb 23rd, 2009
Re: Diagram.RegisterItemClass
Reply #4 - Mar 16th, 2009 at 9:05am
Print Post  
First .. thanks for your quick replies.

I was just checking the Diagram.Register method using Reflector and came to know that you have shared/static Hashtable in diagram class. Why not provide a removal method from the same static hashTables?
  

Syed Aziz ur Rahman
Back to top
 
IP Logged
 
Aziz ur Rahman
YaBB Newbies
*
Offline



Posts: 43
Joined: Feb 23rd, 2009
Re: Diagram.RegisterItemClass
Reply #5 - Mar 16th, 2009 at 9:07am
Print Post  
This is something you can do only once for the application lifetime, you do not have to register the custom types with each Diagram instance.

I hope that helps, 
Stoyan


I know that Register is done once in the life time of an application. i was asking about UN register( removal from hash table). Do i have to do this with all instances of Diagram class?
  

Syed Aziz ur Rahman
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram.RegisterItemClass
Reply #6 - Mar 16th, 2009 at 9:23am
Print Post  
These hashtables are static/shared too.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint