• 为Windows mobile编写设计友好的控件[Writing designer friendly controls for Windows Mobile]



      在 J2i.Net 上看到了这篇文章 Making Designer Friendly Controls 。 原文地址为Simon Hart 的 Writing designer friendly controls for Windows Mobile 。

     原文主要说: 当你为Windows mobile 设计友好控件时需要确定你的代码是否运行在正确的设计时,也就是说是否运行在桌面系统上。那么,如果你的Mobile程序运行在桌面系统上时,你就不能调用设备上的dll了。

    “One thing that you sometimes need when writing Visual Studio designer friendly controls for Windows Mobile, is knowing if your code is running in design time - which is essentially running on the desktop or not. You need to know this because if you are running on the desktop (design time) you don't want to call device specific dlls.”

    下面的代码可以获得当前模式:

    DesignMode
    public static class DesignMode
    {
        
    private static byte _mode = 255;

        
    public static bool IsTrue
        {
            
    get
            {
                
    if (_mode == 255)
                    _mode = AppDomain.CurrentDomain.FriendlyName.Contains("DefaultDomain"? (byte)1 : (byte)0;
                
    return _mode == 1;
            }
        }
    }

    可以这样调用

    if (DesignMode.IsTrue)
    {
        
    //don't call coredll.dll
    }
    else
    {
        
    //call coredll.dll
    }
     
  • 相关阅读:
    Spring三大器
    SpringBoot启动过程
    linux常用命令
    Controller当中的参数与返回值
    Spring加载context的几种方法
    Spring基础(imooc)
    SpringMVC框架学习
    Spring MVC(imooc)
    springAOP基础
    《别傻了,你的中年危机真不是因为穷》
  • 原文地址:https://www.cnblogs.com/Lisen/p/1625630.html
Copyright © 2020-2023  润新知