SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

problem compiling with compact framework

Last post 08-26-2008 11:46 PM by JossGP. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 08-25-2008 5:56 PM

    • JossGP
    • Top 100 Contributor
    • Joined on 10-14-2007
    • Italy
    • Posts 25

    problem compiling with compact framework

    Hi

    I start to port a control I have created from standard .net 20  to .net compact framework usinf SD 2.2.1 xxxxx using a new project with target of  NET compact framework 2.0. 

    This control compile fine whit .net 20, but when  I compile in compact framework 2.0 I got an error at this bolded line :

    using Microsoft.WindowsCE.Forms;
    using System;
    using System.ComponentModel;
    using System.ComponentModel.Design;
    using System.ComponentModel.Design.Serialization;
    using System.Collections;
    using System.Collections.Specialized;
    using System.Diagnostics;
    using System.Drawing;
    using System.Drawing.Design;
    using System.Drawing.Drawing2D;
    using System.Drawing.Imaging;
    using System.Globalization;
    using System.IO;
    using System.Reflection;
    using System.Threading;
    using System.Windows.Forms;
    using System.Windows.Forms.Design;

    ....

    ..... 

         public class ToggleColumnHeaderConverter: TypeConverter
        {
            public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext context, Type destinationType)
            {
                if (destinationType == typeof(InstanceDescriptor))
                {
                    return true;
                }
                return base.CanConvertTo(context, destinationType);
            }
                                            
            public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
            {
                if (destinationType == typeof(InstanceDescriptor) && value is ToggleColumnHeader)
                {
                    ToggleColumnHeader lvi = (ToggleColumnHeader)value;

                    ConstructorInfo ci = typeof(ToggleColumnHeader).GetConstructor(new Type[ {});
                    if (ci != null)
                    {
                        return new InstanceDescriptor(ci, null, false);
                    }
                }
                return base.ConvertTo(context, culture, value, destinationType);
            }
        }

     the error says :

    The type or namespace name 'ITypeDescriptorContext' does not exist in the namespace 'System.ComponentModel' (are you missing an assembly reference?) (CS0234) - D:\Progetti_C#\Controls\ExtendedListPPC\ContainerListView.cs:3257,59 

    Wath's wrong ? .  Is this class not supported in Compact framework ? or what other else ??

    Can you help me please ?

    JossGP 

     

     

     

  • 08-25-2008 8:31 PM In reply to

    Re: problem compiling with compact framework

    The interface ITypeDescriptorContext is indeed not supported by the Compact framework. You can find that information in the SDK documentation for that type where it says:

    .NET Framework
    Supported in: 2.0, 1.1, 1.0

    For classes that are supported there is also a seperate entry like this:

    .NET Compact Framework
    Supported in: 2.0, 1.0

    Christian

  • 08-25-2008 9:10 PM In reply to

    • JossGP
    • Top 100 Contributor
    • Joined on 10-14-2007
    • Italy
    • Posts 25

    Re: problem compiling with compact framework

    Thanks Christian,

    I Just seen that, but I am cunfused because I have searched  the class TypeConverter  , which is the one I override and than I looked for his methods.

    It seems stange that is present the main class and not his methods.

    Any way Do you Know some workaround for this class to run correctly ??

     

    JossGP 

  • 08-25-2008 9:40 PM In reply to

    Re: problem compiling with compact framework

    I am sorry, I cannot tell you how to make this code work on the Compact framework.

    However, it might be worth finding out whether it is needed at all. Somehow this code suggests to me that it could have to do with design-time-only functionality. If that is the case, you might as well not compile it at all for the target, by using #ifdef and a special symbol that is only defined in a configuration that compiles for the standard framework for designing.

    Christian

  • 08-25-2008 10:33 PM In reply to

    • JossGP
    • Top 100 Contributor
    • Joined on 10-14-2007
    • Italy
    • Posts 25

    Re: problem compiling with compact framework

     

    This is a good idea I didn't thought about, but let me Know ; if I compile the DLL without design time support I suppose that I CAN 'T edit objects like columns or items ( sorry , this big control is  composed of 2 controls  a listview and a treeListView ) , but I can set they up at run time by filling manually the right properties , isn't it ?.

    Stupidly  I was thinking  the two activities  was linked together. This way is a little bit more difficult but I would get the same result.

    On the othe hand I have spend a lot of time to code and adjust these controls on standard .net environment that would be a shame to buy something else.

     Thanks

    JossGP 

     

     

  • 08-26-2008 11:11 AM In reply to

    Re: problem compiling with compact framework

    Setting up the controls manually is certainly possible.

    But if you create a new configuration for the project which compiles for the standard framework and has a special preprocessor symbol defined which enables the design-time code, you should be able to use that configuration for designing. When you are finished with designing you can then switch to the previous configuration which compiles for the Compact framework.

    Christian

  • 08-26-2008 11:46 PM In reply to

    • JossGP
    • Top 100 Contributor
    • Joined on 10-14-2007
    • Italy
    • Posts 25

    Re: problem compiling with compact framework

    Thanks Christian , When you said that in the previous post I investigate and I found a preprocessor directive like #if NETCFDESIGNTIME that I have to add in project option , compilation Tab  -> Conditional compilation symbols   DEBUG;TRACE;NETCFDESIGNTIME   ( I think ).

    After that and compiling with and without option , I would get 2 dlls; one to use only at run time and the other at design time.

    Now I try to to all the job.

    Thanks for the help.

     JossGP 

     

Page 1 of 1 (7 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.