zoukankan      html  css  js  c++  java
  • 中型WPF客户端开发项目总结(3.2)

    3.1中提到我定义了一些公共配置项,现在我来说一说配置项的用法:

    1. 提供软件标识符

     1 public static class CfgIndentifiers
     2     {
     3         public static readonly string Identifier =
     4 #if DEBUG
     5             "DEBUG"
     6 #elif AI_USER
     7             string.Empty
     8 #elif IDUU_USER
     9             "IDUU"
    10 #elif Business_USER
    11             "SQL"
    12 #elif RELEASE
    13             "ADV"
    14 #else
    15             "UNKNOWN"
    16 #endif
    17             ;
    18     }

    项目编译后,Identifier是一个静态只读变量。即可以在UI上显示给用户看,告知版本,也可以在访问后端API时,当作header传过去。

    2. 提供运行逻辑 布尔参考

     1 public static class Configurations
     2     {
     3         public static bool IsUserVersion =>
     4 #if !USER
     5                 false;
     6 #else
     7                 true;
     8 #endif
     9 
    10         public static bool IsDevVersion => !IsUserVersion;
    11 
    12         public static bool IsNotIDUU =>
    13 #if IDUU_USER
    14             false;
    15 #else
    16             true;
    17 #endif
    18 
    19         public static bool IsDebug =>
    20 #if DEBUG
    21                 true;
    22 #else
    23                 false;
    24 #endif
    25     }

    上面的两个类供其它所有项目引用(当然其它一些涉及具体业务,就不展示了)。

  • 相关阅读:
    php No input file specified 错误提示
    yii 隐藏index.php
    phpstudy 配置 sqlserver
    xdebug3 配置信息
    composer 更新
    mysql 命令行 导入大型文件
    使用 DBExportDoc V1.0 For MySQL 导出数据库表结构说明文档
    聚合数据接口调用实例
    servlet
    JDBC
  • 原文地址:https://www.cnblogs.com/godlessspirit/p/12694316.html
Copyright © 2011-2022 走看看