[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

#if design time for swf

Posted on 2005-04-09
8
Medium Priority
?
860 Views
Last Modified: 2008-01-09
Is there a preprocessor define to know if the code is running in design time like  #if NETCFDESIGNTIME in the compact framework??

Thanks
0
Comment
Question by:razziel
  • 5
  • 3
8 Comments
 
LVL 8

Expert Comment

by:RomanPetrenko
ID: 13768027
I don't think so.
Look here:
http://winfx.msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_fxnetcf/html/23a10364-ea60-4ad6-804b-1afd259bb3d4.asp

===citation===
Adding Controls to the Toolbox
The .NET Compact Framework does not currently provide the capability to add a custom control for design-time access.

Microsoft Visual Studio 2005 does not support adding controls developed with the .NET Compact Framework or customizing the Toolbox with your own controls developed with the .NET Compact Framework. The reason is that the .NET Compact Framework does not currently support designer attributes for its base Windows.Forms.Control class. To have a design-time experience with a custom or derived control, you must compile an alternate design-time version of your assembly using the Windows Control Library project template the full .NET Framework. Then you can add that control to the ToolBox in a smart device application project for your run-time application.

When you compile or deploy your run-time application, the .NET Compact Framework uses the run-time version of your assembly by having determined the value of the RuntimeAssemblyAttribute attribute.

This attribute, exclusive to the .NET Compact Framework, takes the fully qualified name of the run-time assembly as its only argument. The following example specifies an assembly using the RuntimeAssemblyAttribute.

  Copy Code
[assembly: System.CF.Design.RuntimeAssemblyAttribute("SimpleChart, Version=1.0.1.5, Culture=neutral, PublicKeyToken=null")]
 

For more information, see Walkthrough: Authoring a Custom Control for Smart Device Applications.
===end of citation===
0
 

Author Comment

by:razziel
ID: 13795974
Im sorry maybe i didnt explain myself correctly, #if NETCFDESIGNTIME is for the .net compact framework and does work, i want a preprocessor directive like that one but for windows from, the full .net framework

thanks for your reply
0
 
LVL 8

Expert Comment

by:RomanPetrenko
ID: 13796403
What problem you want to solve?

If you writing custom designer you can hadle a lot of things.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:razziel
ID: 13808877
I have a control in wich i connect to a remote server to get some collection of objects, the connection to the remote server is done in the constructor of the control, i just want a way to know if the control is beng created for design time so the designer doesnt throw an error every time i open a form containing it. But the connection to the remote server must stay in the constructor.
0
 
LVL 8

Expert Comment

by:RomanPetrenko
ID: 13808988
There is a way to do what you need:
1. There is DesignMode property for all Component derived classes
class MyClass: Component
{
    public MyClass()
    {
        if (this.DesignMode)
        {
            //Call Design Time code
        }
        else
        {
            // Call Runtime code
        }
    }
}
2.
0
 
LVL 8

Accepted Solution

by:
RomanPetrenko earned 1500 total points
ID: 13808997
Another and may be a little bit tricky way:
///
///  Indicates if the current view is being utilized in the VS.NET IDE or not. The similarly-named .Net framework property for a UserControl will only show that its related object in is DesignMode only if the immediate parent is viewed in the IDE. For instance, if UserControl A has UserControlB placed on it, and UserControl B has UserControlC placed on it, and UserControl A is being viewed in the IDE, UserControl C will normally register its DesignMode flag as false. This overridden implmentation of DesignMode will utilized a different method in determining this.
///
///
///
public new bool DesignMode
{
   get
      {
         return (System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv");
      }
}

0
 

Author Comment

by:razziel
ID: 13904839
Sorry for the late reply.
Heres your points roman, thanks.
0
 
LVL 8

Expert Comment

by:RomanPetrenko
ID: 13905289
May I ask why grade B? The answer wasn't full?
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question