Page Index Toggle Pages: 1 [2] 3  Send TopicPrint
Very Hot Topic (More than 25 Replies) cut (Read 12413 times)
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: cut
Reply #15 - Sep 24th, 2008 at 7:30am
Print Post  
Look for IconNode.cs in the samples folder and copy the SaveTo and LoadFrom method implementations to your class. Replace the IconNode properties related lines with

writer.Write(comment);

and

comment = reader.ReadString();

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
balajigcs
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 32
Joined: Aug 18th, 2008
Re: cut
Reply #16 - Sep 24th, 2008 at 9:24am
Print Post  
Hi this is working..
    and there is any way to findout the which node we copied.
  

Thanks & Regards,&&&&Balaji
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: cut
Reply #17 - Sep 24th, 2008 at 12:21pm
Print Post  
You could handle the NodePasted event.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
balajigcs
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 32
Joined: Aug 18th, 2008
Re: cut
Reply #18 - Sep 25th, 2008 at 5:12am
Print Post  
Hi,

     yes,this is working.. the nodePasted event is raised after Paint operation is over..
but,when I copied the node after that I need to know which node I copied.. There is any possible way to do this..
  

Thanks & Regards,&&&&Balaji
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: cut
Reply #19 - Sep 25th, 2008 at 7:01am
Print Post  
Hi,

The copied nodes are the ones that are selected when you call the Copy / Cut methods. The selection changes when you paste items, so you should copy the contents of Diagram.Selection.Nodes into a new collection before calling Copy or Cut.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
balajigcs
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 32
Joined: Aug 18th, 2008
Re: cut
Reply #20 - Sep 25th, 2008 at 8:07am
Print Post  
Hi,

     How to implement serialization for your custom Collection properties?..  Acutually for string type properties are changing properly only when I am using cut and paste.. but when i am using collection properties it is not working..
can u give me sample code for.. how to serialize and deserialize custon collection properties..
  

Thanks & Regards,&&&&Balaji
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: cut
Reply #21 - Sep 25th, 2008 at 12:55pm
Print Post  
Have you defined your own collection class, or are using Flowchart.NET types such as DiagramNodeCollection?
  
Back to top
 
IP Logged
 
balajigcs
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 32
Joined: Aug 18th, 2008
Re: cut
Reply #22 - Sep 25th, 2008 at 2:57pm
Print Post  
Hi,

I am defining my own collection class.. like this way.

LimitCollection limit = new LimitCollection();[Data]
[Category("Limits")]
public LimitCollection Limit
{
get
{
return this.limit;
}
set
{
this.limit = value;
this.OnPropertyChanged();
}
}


the limitcollection class having the properties..  how can we serialize and deserialize the these collecion types..
  

Thanks & Regards,&&&&Balaji
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: cut
Reply #23 - Sep 25th, 2008 at 3:12pm
Print Post  
You could use the BinaryWriter methods to save the number of items in the collection, and then loop over its items and save each piece of data. When loading, read the number of items, resize the collection, and loop to load each piece of data.

Another way to do that is to make your class implement ISerializable, create BinaryFormatter, and use the formatter's Serialize method.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
balajigcs
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 32
Joined: Aug 18th, 2008
Re: cut
Reply #24 - Oct 20th, 2008 at 12:04pm
Print Post  
Hi,

   I am copying the two same nodes with different properties..

i am using the ,
methods like that for saving and loading the properties after copy paste operations..


protected override void LoadFrom(System.IO.BinaryReader reader, PersistContext context)
{
base.LoadFrom(reader, context);
FileStream flStream = new FileStream("Limits.dat",FileMode.Open, FileAccess.Read);
try
{
BinaryFormatter binFormatter = new BinaryFormatter();
this.Variables = (VariableCollection)binFormatter.Deserialize(flStream);
}
finally
{
flStream.Close();
}
}

protected override void SaveTo(System.IO.BinaryWriter writer, PersistContext context)
{
base.SaveTo(writer, context);
FileStream flStream = new FileStream("Limits.dat",FileMode.OpenOrCreate, FileAccess.Write);
try
{
BinaryFormatter binFormatter = new BinaryFormatter();
binFormatter.Serialize(flStream, this.Variables);
}
finally
{
flStream.Close();
}
}

but,after paste operation i am getting the two nodes with same properties.. means tha nodes with previously setted properties are not coming.. only for one node properties are coming for the both the nodes..

so,please rectify the problem..
  

Thanks & Regards,&&&&Balaji
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: cut
Reply #25 - Oct 20th, 2008 at 12:13pm
Print Post  
Hi,

If you use FileStreams, you will have to provide distinct file names, otherwise SaveTo overwrites the file created for the first node when called for the second one.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
balajigcs
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 32
Joined: Aug 18th, 2008
Re: cut
Reply #26 - Oct 20th, 2008 at 1:20pm
Print Post  
thanks its working when i am using distict files...
but can u help me with simple how can i maintain like with single file.. or any other method do like that..

  

Thanks & Regards,&&&&Balaji
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: cut
Reply #27 - Oct 20th, 2008 at 1:47pm
Print Post  
Try context.SaveObject(Variables) and Variables = context.ReadObject(). It should work as long as your VariableCollection class is [Serializable].

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
balajigcs
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 32
Joined: Aug 18th, 2008
Re: cut
Reply #28 - Oct 21st, 2008 at 5:04am
Print Post  
hi,

In PersistContext.cs class having only SaveObject() methos is there but the ReadObject() methos is not there.. the ReadObject method only in xmlpersistcontext..

so,can u please tell some other way?
  

Thanks & Regards,&&&&Balaji
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: cut
Reply #29 - Oct 21st, 2008 at 8:59am
Print Post  
Sorry, it's called LoadObject.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 3 
Send TopicPrint