Re: Custom CodeDomSerializer issues



I think a local variable will be generated only if you create it through the
IDesignerHost.CreateComponent method.

---------
- G Himangi, Sky Software http://www.ssware.com
Shell MegaPack : GUI Controls For Drop-In Windows Explorer like Shell
Browsing Functionality For Your App (.Net & ActiveX Editions).
EZNamespaceExtensions.Net : Develop namespace extensions rapidly in .Net
EZShellExtensions.Net : Develop all shell extensions,explorer bars and BHOs
rapidly in .Net
---------



"Lionel" <lioneljlobo@xxxxxxxxx> wrote in message
news:1190649883.245521.135700@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi All,

I wrote a custom CodeDom serializer class that first invokes default
serialization for a class, after which it does some custom code
generation.

public override object Serialize(IDesignerSerializationManager
manager, object value)
{
CodeDomSerializer baseSerializer =
(CodeDomSerializer)manager.GetSerializer(myBaseType,
typeof(CodeDomSerializer));
object codeObject = baseSerializer.Serialize(manager, value);

//custom code gen here...
}

My class uses the following attributes to specify the above
serializer:

[DesignerSerializer(typeof(MyCustomSerializer),
typeof(CodeDomSerializer))]
public partial class MyClass : UserControl
{
.....
}

The custom code looks fine, but the MyClass instance variable is being
generated local to the InitializeComponent() method:

private void InitializeComponent()
{
MyControls.MyClass myClass1 = new MyControls.MyClass();
...
//
// MyClass code generator
// Updated on Monday, September 24, 2007 at 4:40:42 PM
//
myClass1.ShowImage = true;
myClass1.Location = new System.Drawing.Point(149, 3);
...
}

I want the instance to be defined as a class level variable, rather
than inside InitializeComponent(). I have read that an
InstanceDescriptor can help specify this, but am as yet unable to get
it working.

Would appreciate any insights you have on doing so.

Thanks,
Lionel



.



Relevant Pages

  • Re: Custom CodeDomSerializer issues
    ... IDesignerHost.CreateComponent in the serialization process? ... public partial class MyClass:UserControl ... InitializeComponent(), so I assume theres something I'm not specifying ... Shell MegaPack: GUI Controls For Drop-In Windows Explorer like Shell ...
    (microsoft.public.dotnet.framework.windowsforms.designtime)
  • Custom CodeDomSerializer issues
    ... I wrote a custom CodeDom serializer class that first invokes default ... public override object Serialize(IDesignerSerializationManager ... The custom code looks fine, but the MyClass instance variable is being ...
    (microsoft.public.dotnet.framework.windowsforms.designtime)
  • Re: Custom CodeDomSerializer issues
    ... I wrote a custom CodeDom serializer class that first invokes default ... The custom code looks fine, but the MyClass instance variable is being ...
    (microsoft.public.dotnet.framework.windowsforms.designtime)
  • Re: Custom CodeDomSerializer issues
    ... I wrote a custom CodeDom serializer class that first invokes default ... The custom code looks fine, but the MyClass instance variable is being ...
    (microsoft.public.dotnet.framework.windowsforms.designtime)
  • Re: Mouse does not work after resuming from Standby mode
    ... Seems to me you have a flaw in your custom code. ... perhaps because it was killed at suspension time. ... The system has also been configured to go into standby mode ... If I change my shell back to Explorer.exe I do not experience this ...
    (microsoft.public.win2000.general)

Loading