We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Symbol Designer and Diagram Editor

Thread ID:

Created:

Updated:

Platform:

Replies:

79037 Jan 17,2009 12:08 PM Sep 23,2010 08:42 AM Windows Forms 6
loading
Tags: Diagram
Glenn Miller
Asked On January 17, 2009 12:08 PM

Has anyone been able to create a palette of custom Symbols in the Symbol Designer, and then been able to successfuly load that Palette by compiling the VB version of the Diagram Builder?

I keep getting the same message:
Unable to cast object of type 'Syncfusion.Windows.Forms.Diagram.SymbolPalette' to type 'Syncfusion.Windows.Forms.Diagram.SymbolPalette'.

The error is inside biAddPalette, the offending line of code is:
curSymbolPalette = CType(formatter.Deserialize(iStream), SymbolPalette)

Any help in this would be greatly appreciated.
If anyone has been successful, can you post what build # you are using?

I've tried v4 of 2008 as well as the lastest version 2009, VS Studio 2008 Pro.

Thanks in advance,
Glenn


Glenn Miller
Replied On January 19, 2009 08:36 PM

Decided to look at several versions of the code.

Found that after defining the formatter as BinaryFormatter, the following line of code is required:

formatter.Binder = Syncfusion.Runtime.Serialization.AppStateSerializer.CustomBinder

Now I can load custom Palettes in the sample application (my assumption is that a similar line will be required in C# as well.

Issue closed for me.

Glenn

>Has anyone been able to create a palette of custom Symbols in the Symbol Designer, and then been able to successfuly load that Palette by compiling the VB version of the Diagram Builder?

I keep getting the same message:
Unable to cast object of type 'Syncfusion.Windows.Forms.Diagram.SymbolPalette' to type 'Syncfusion.Windows.Forms.Diagram.SymbolPalette'.

The error is inside biAddPalette, the offending line of code is:
curSymbolPalette = CType(formatter.Deserialize(iStream), SymbolPalette)

Any help in this would be greatly appreciated.
If anyone has been successful, can you post what build # you are using?

I've tried v4 of 2008 as well as the lastest version 2009, VS Studio 2008 Pro.

Thanks in advance,
Glenn




Ajeet M [Syncfusion]
Replied On January 19, 2009 11:48 PM

Hi Glenn,

Yes, you are absolutely correct with your code snippet.

The problem why you were not able to open the palette created in Symbol designer application into the Diagram Builder sample was that, both of these applications were compiled seperately in different framework assemblies.

Symbol Designer was pre-compiled with framework 2.0 and Diagram Builder with framework assemblies in the GAC or public assembly folder; in your case with v3.5 framework.

To test this, you may open the created palette, in the diagram builder sample with framework 2.0 assemblies version perfectly.

However, I assure you that the code snippet will be included in the upcoming build releases and this shall be fixed very soon.

Thanks for your time,

Warm Regards,
Ajeet



Ljubo Zizic
Replied On April 20, 2009 06:30 AM

I am having this problem with my project and adding line:
formatter.Binder = Syncfusion.Runtime.Serialization.AppStateSerializer.CustomBinder

didnt solve the problem i still get the same exception.
I tried to change framework version to 2.0 in my project but that didnt help either..

Any other suggestions?


>Hi Glenn,

Yes, you are absolutely correct with your code snippet.

The problem why you were not able to open the palette created in Symbol designer application into the Diagram Builder sample was that, both of these applications were compiled seperately in different framework assemblies.

Symbol Designer was pre-compiled with framework 2.0 and Diagram Builder with framework assemblies in the GAC or public assembly folder; in your case with v3.5 framework.

To test this, you may open the created palette, in the diagram builder sample with framework 2.0 assemblies version perfectly.

However, I assure you that the code snippet will be included in the upcoming build releases and this shall be fixed very soon.

Thanks for your time,

Warm Regards,
Ajeet





Administrator [Syncfusion]
Replied On April 21, 2009 09:28 AM

Hi,

The problem that you are facing can be solved by pasting the one line of code given below.

formatter.Binder = Syncfusion.Runtime.Serialization.AppStateSerializer.CustomBinder;

Place the above code inside the fuction of MainForm.cs file of Symbol Desingner

private SymbolPalette OpenPaletteFile( string strFileName )

and just between the following codes

IFormatter formatter = new BinaryFormatter();
----Place the code here ----
try



Now open the palette file and you can see the problem getting solved.

Regards,
Gowri


Ljubo Zizic
Replied On November 4, 2009 08:15 AM

Hi, this is my code snippet below. I get that same error message even though I inserted that line:
formatter.Binder = Syncfusion.Runtime.Serialization.AppStateSerializer.CustomBinder

Please help.


Code snippet:

Dim palettepath As String = "C:\Lolic\projekti\Diplomski aplikacija NIS\Diplomski aplikacija NIS 20091027\palete\svjetlovodi.edp"

Dim palette As Syncfusion.Windows.Forms.Diagram.SymbolPalette = LoadPalette(palettepath)

For Each node As Node In palette.Nodes
Dim nodeToInsert As Syncfusion.Windows.Forms.Diagram.Node = DirectCast(node.Clone(), Syncfusion.Windows.Forms.Diagram.Node)
DiagramNIS.Model.AppendChild(nodeToInsert)
Next


Public Function LoadPalette(ByVal filename As String) As Syncfusion.Windows.Forms.Diagram.SymbolPalette

Dim curSymbolPalette As Syncfusion.Windows.Forms.Diagram.SymbolPalette = Nothing
Dim iStream As New IO.FileStream(filename, FileMode.Open, FileAccess.Read)
If iStream IsNot Nothing Then
Dim formatter As Runtime.Serialization.IFormatter = New Runtime.Serialization.Formatters.Binary.BinaryFormatter()
formatter.Binder = Syncfusion.Runtime.Serialization.AppStateSerializer.CustomBinder
Try
curSymbolPalette = DirectCast(formatter.Deserialize(iStream), Syncfusion.Windows.Forms.Diagram.SymbolPalette)
AddHandler AppDomain.CurrentDomain.AssemblyResolve, AddressOf Syncfusion.DiagramBaseAssembly.AssemblyResolver
Catch generatedExceptionName As Runtime.Serialization.SerializationException
Try
formatter = New Runtime.Serialization.Formatters.Soap.SoapFormatter()
formatter.Binder = Syncfusion.Runtime.Serialization.AppStateSerializer.CustomBinder
iStream.Position = 0
curSymbolPalette = DirectCast(formatter.Deserialize(iStream), Syncfusion.Windows.Forms.Diagram.SymbolPalette)
Catch e As Exception
System.Diagnostics.Trace.WriteLine("Error reading SymbolPalette", e.Message)
End Try
Finally
iStream.Close()
End Try
End If
Return curSymbolPalette
End Function

Daniel Santos de Carvalho
Replied On September 23, 2010 08:42 AM

I have the same problem, using VS2008 and C#. It works fine with the "Text Symbols.edp" of the example, but don't work with my .edp


IFormatter formatter = new BinaryFormatter();
formatter.Binder = Syncfusion.Runtime.Serialization.AppStateSerializer.CustomBinder;

try
{
AppDomain.CurrentDomain.AssemblyResolve +=
new ResolveEventHandler Syncfusion.DiagramBaseAssembly.AssemblyResolver);
curSymbolPalette = (SymbolPalette)formatter.Deserialize(iStream);
}


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;