Managed ObjectArx 定制autocad的界面(包括menu.toolbar等...)-程序员宅基地

技术标签: ui  测试  runtime  

  //   Copyright 2005-2006 by Autodesk, Inc.
 
//  
 
//  Permission to use, copy, modify, and distribute this software in
 
//  object code form for any purpose and without fee is hereby granted, 
 
//  provided that the above copyright notice appears in all copies and 
 
//  that both that copyright notice and the limited warranty and
 
//  restricted rights notice below appear in all supporting 
 
//  documentation.
 
//  
 
//  AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 
 
//  AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
 
//  MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC. 
 
//  DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
 
//  UNINTERRUPTED OR ERROR FREE.
 
//  
 
//  Use, duplication, or disclosure by the U.S. Government is subject to 
 
//  restrictions set forth in FAR 52.227-19 (Commercial Computer
 
//  Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
 
//  (Rights in Technical Data and Computer Software), as applicable. 
  using   System;
 
using   System.IO;
 
using   Autodesk.AutoCAD.Runtime;
 
using   Autodesk.AutoCAD.ApplicationServices;
 
using   Autodesk.AutoCAD.EditorInput;
 
using   Autodesk.AutoCAD.DatabaseServices;

 
using   Autodesk.AutoCAD.Customization;

 
//   This application implements several commands that shows how to
 
//   manipulate some of the existing CUI User interface and components.
 
//   The commands implemented here allow you to:
 
//  
 
//   1) Create/Remove menu and its items (ADDMENU/REMMENU)
 
//   3) Create/Remove a workspace (ADDWS/REMWS)
 
//   2) Create/Remove a toolbar and its items (ADDTOOLBAR/REMTOOLBAR)
 
//   4) Create a keyboard shortcut (CUISHORTCUT)
 
//   5) Create a temporary override (TEMPKEY)
 
//   6) Change position and docking of "Info Palette" 
 
//      window (DOCKR, DOCKL, DOCKF)
 
//   7) Add a double-click action (DBLCLICK)
 
//   8) A command that performs the tasks of ADDMENU,ADDTOOLBAR,
 
//      DOCKL and CUISHORTCUT (CUIALL)
 
//   9) Save a CUI after its modifications and reload it (SAVECUI)

 
//   Apart from the above commands, lisp wrappers have also been 
 
//   implemented to make the commands callable from windows.

 
//   To use CuiSamp.dll:
 
//   1) Start AutoCAD and open a new drawing.
 
//   2) Type netload and select CuiSamp.dll.
 
//   3) Execute the CUIALL command, if you want the UI related 
 
//      modifications.

 
//   Please add the References acdbmgd.dll,acmgd.dll,
 
//   AcCui.dll and AcCustomize.dll before trying to 
 
//   build this project. 
 
 
namespace   CuiSamp
  {
     
/**/  ///     <summary>  
     
///   Summary description for Class1.
     
///     </summary> 
       public     class   CuiSamp
      {
         
//   All Cui files (main/partial/enterprise) have to be loaded into an object of class 
         
//   CustomizationSection
         
//   cs - main AutoCAD CUI file 
         CustomizationSection cs;
        CustomizationSection entCs;
        CustomizationSection[]partials ;
        
         
int   numPartialFiles;

        YesNoIgnoreToggle yes  
=   YesNoIgnoreToggle.yes;
        YesNoIgnoreToggle no   
=   YesNoIgnoreToggle.no;
        
         
//   True when enterprise CUI file is loaded successfully 
           bool   entCsLoaded;

         
//   ed - access to the AutoCAD Command Line
         
//   Allows us to write messages or Issue Commands in the interface 
         Editor ed   =   Application.DocumentManager.MdiActiveDocument.Editor;


         
//  Default Constructor 
           public   CuiSamp()
          {
             
//   retrieve the location of, and open the ACAD Main CUI File 
               string   mainCuiFile   =   (  string  )Application.GetSystemVariable(  "  MENUNAME  "  );
            mainCuiFile  
+=     "  .cui  "  ;
            cs  
=     new   CustomizationSection(mainCuiFile);
            
             
string   entCuiFile   =   (  string  )Application.GetSystemVariable(  "  ENTERPRISEMENU  "  );
             
if  ( entCuiFile.Equals(  "  .  "  ))
                entCsLoaded  
=     false  ;
             
else  
               {
                entCs  
=     new   CustomizationSection(entCuiFile);
                entCsLoaded  
=     true  ;
            } 
            
             
//   Code for loading all partial CUI's listed in the main CUI file 
             
            partials  
=     new   CustomizationSection[cs.PartialCuiFiles.Count];
             
int   i  =  0  ;
             
foreach  (  string   fileName   in   cs.PartialCuiFiles)
              {    
                 
if   (File.Exists(fileName))
                  {
                    partials[i]  
=     new   CustomizationSection(fileName);
                    i 
++  ;
                } 
            } 
            numPartialFiles  
=   i;    
        } 
 
 
         
//   Command: savecui
         
//   This Command saves all open CUI Files that have been modified 
         [CommandMethod(  "  savecui  "  )]
         
public     void   saveCui()
          {
             
//   Save all Changes made to the CUI file in this session. 
             
//   If changes were made to the Main CUI file - save it
             
//   If changes were made to teh Partial CUI files need to save them too 
     
             
if  (cs.IsModified)
                cs.Save();

             
for  (  int   i  =  0  ;i   <   numPartialFiles;i  ++  )
              {    
                 
if  (partials[i].IsModified)
                    partials[i].Save();
            } 
            
             
if  (entCsLoaded   &&   entCs.IsModified)
                entCs.Save();

             
//   Here we unload and reload the main CUI file so the changes to the CUI file could take effect immediately. 
               string   flName   =   cs.CUIFileBaseName;
            Application.SetSystemVariable( 
"  FILEDIA  "  ,  0  );
            Application.DocumentManager.MdiActiveDocument.SendStringToExecute( 
"  cuiunload   "     +   flName   +     "     "  ,  false  ,  false  ,  false  );
            Application.DocumentManager.MdiActiveDocument.SendStringToExecute( 
"  cuiload   "     +   flName   +     "   filedia 1   "  ,  false  ,  false  ,  false  );
        } 
 
         
//   Lisp callable function: savecui
         
//   Lisp wrapper for savecui command 
         [LispFunction(  "  savecui  "  )]
         
public     void   saveCui(ResultBuffer args)
          {
            saveCui();
        } 
 
         
//   Command: addmenu
         
//   This Command adds a new menu to all workspaces called Custom Menu, which contains 2 sub items
         
//   The Menu is first added to the Main CUI File and then added to all it's workspaces.  
         [CommandMethod(  "  addmenu  "  )]
         
public     void   addMenu()
          {
             
if   (cs.MenuGroup.PopMenus.IsNameFree(  "  Custom Menu  "  ))
              {
                
                System.Collections.Specialized.StringCollection pmAliases  
=     new   System.Collections.Specialized.StringCollection();
                pmAliases.Add( 
"  POP12  "  );
                
                PopMenu pm  
=     new   PopMenu(  "  Custom Menu  "  ,pmAliases,  "  Custom Menu  "  ,cs.MenuGroup);
                
                addItemsToPM(pm);
                addMenu2Workspaces(pm);
            } 
             
else  
                ed.WriteMessage( 
"  Custom Menu already Exists\n  "  );    
        } 
 
         
//   Lisp callable function: addmenu
         
//   Lisp wrapper for addmenu command 
         [LispFunction(  "  addmenu  "  )]
         
public     void   addMenu(ResultBuffer args)
          {
            addMenu();
        } 
 
         
//   Add new Items to a PopMenu 
           private     void   addItemsToPM(PopMenu pm)
          {
            PopMenuItem pmi  
=     new   PopMenuItem(pm,  -  1  );
            pmi.MacroID  
=     "  ID_AUGI  "  ;pmi.Name   =     "  Autodesk User Group International  "  ;
            
            pmi  
=     new   PopMenuItem(pm,  -  1  );

            pmi  
=     new   PopMenuItem(pm,  -  1  );
            pmi.MacroID  
=     "  ID_CustomSafe  "  ;pmi.Name   =     "  Online Developer Center  "  ;
        } 
 
         
//   Add the menu to all the workspaces 
           private     void   addMenu2Workspaces(PopMenu pm)
          {
             
foreach  (Workspace wk   in   cs.Workspaces)
              {
                WorkspacePopMenu wkpm  
=     new   WorkspacePopMenu(wk,pm);
                wkpm.Display  
=     1  ;
            } 
        
        } 
    
         
//   Command: remmenu
         
//   This Command deletes the menu added above from the Main CUI File and any
         
//    workspaces that it was added to.  
         [CommandMethod(  "  remmenu  "  )]
         
public     void   remMenu()
          {
             
//   Find Index of the desired MenuItem
             
//   Remove it from all Workspaces that it exists in
             
//   Omitting this step leaves nasty left-overs in the Workspace files
             
//   Remove it from the Cui files' Menu List 
             
            PopMenu    pm  
=   cs.MenuGroup.PopMenus.FindPopWithAlias(  "  POP12  "  );
             
if   (pm   !=     null   )
              {
                 
foreach  (Workspace wk   in   cs.Workspaces)
                  {
                    WorkspacePopMenu wkPm  
=   wk.WorkspacePopMenus.FindWorkspacePopMenu(pm.ElementID,pm.Parent.Name);
            
                     
if  (wkPm   !=     null  )
                        wk.WorkspacePopMenus.Remove(wkPm);
                } 
                cs.MenuGroup.PopMenus.Remove(pm);     
//   Deletes the Menu from ACAD Menu Group 
             } 
        } 
 
         
//   Lisp callable function: remmenu
         
//   Lisp wrapper for remmenu command 
         [LispFunction(  "  remmenu  "  )]
         
public     void   remMenu(ResultBuffer args)
          {
            remMenu();
        } 
 
         
//   Command: addws
         
//   This command adds a new workspace. The name of the workspace to create is
         
//   obtained from the command line. 
         [CommandMethod(  "  addws  "  )]
         
public     void   addws()
          {
            String wsName;
            PromptResult prs  
=   ed.GetString(  "  Enter name of workspace to create:   "  );
             
if  (PromptStatus.OK   ==   prs.Status )
              {
                wsName  
=   prs.StringResult;
                 
if  (  -  1     ==   cs.Workspaces.IndexOfWorkspaceName(wsName))   //   If the workspace doesnot exist 
                    {
                    Workspace nwWs  
=     new   Workspace (cs, wsName);   //   Create the workspace 
                     saveCui();   //   Save and reload the CUI file 
                 } 
                 
else  
                   {
                    ed.WriteMessage( 
"  A workspace with this name already exists  "  );
                } 
            } 
 
        } 
 
         
//   Lisp callable function: addws
         
//   Lisp wrapper for addws command 
         [LispFunction(  "  addws  "  )]
         
public     void   addws(ResultBuffer args)
          {
            addws();
        } 
 
         
//   Command: remws
         
//   This command removes a workspace. The name of the workspace to remove is
         
//   obtained from the command line. 
         [CommandMethod(  "  remws  "  )]
         
public     void   remws()
          {
            String wsName;
            PromptResult prs  
=   ed.GetString(  "  Enter name of workspace to remove:   "  );
             
if  (PromptStatus.OK   ==   prs.Status )
              {
                wsName  
=   prs.StringResult;
                 
if  (  -  1     !=   cs.Workspaces.IndexOfWorkspaceName(wsName))   //   If the workspace exist 
                    {
                    cs.deleteWorkspace(wsName);  
//   Remove the workspace 
                     saveCui();   //   Save and reload the CUI file 
                 } 
                 
else  
                   {
                    ed.WriteMessage( 
"  No workspace exists with this name  "  );
                } 
            } 
            
        } 
         
//   Lisp callable function: remws
         
//   Lisp wrapper for remws command 
         [LispFunction(  "  remws  "  )]
         
public     void   remws(ResultBuffer args)
          {
            remws();
        } 
 
 
         
//   Command: cuishortcut
         
//   This adds a Shortcut key to the CUI command.
         
//   Ctrl+B is used for Toggling SNAP. It gets reassigned 
         [CommandMethod(  "  cuishortcut  "  )]
         
public     void   shortCut()
          {
             
//   In here we will make a shortcut Key combination to the Customize.. command 
             MacroGroup mg   =   cs.MenuGroup.MacroGroups[  0  ];   //   Search the ACAD Macros 
               foreach   (MenuMacro mcr   in   mg.MenuMacros)
              {
                 
if  (mcr.ElementID.Equals(  "  MM_1570  "  ))
                  {
                    MenuAccelerator ma  
=     new   MenuAccelerator(mcr,cs.MenuGroup);
                    ma.AcceleratorShortcutKey  
=     "  CTRL+B  "  ;
                } 
            } 
        } 
         
//   Lisp callable function: cuishortcut
         
//   Lisp wrapper for cuishortcut command 
         [LispFunction(  "  cuishortcut  "  )]
         
public     void   shortCut(ResultBuffer args)
          {
            shortCut();
        } 
 
         
//   Command: dockr
         
//   Dock Info Palette to the right 
         [CommandMethod(  "  dockr  "  )]
         
public     void   dockInfoPalR()
          {
            dockInfoPalette(DockableWindowOrient.right);
        } 
         
//   Lisp callable function: dockr
         
//   Lisp wrapper for dockr command 
         [LispFunction(  "  dockr  "  )]
         
public     void   dockInfoPalR(ResultBuffer args)
          {
            dockInfoPalR();
        } 
 
         
//   Command: dockl
         
//   Dock Info Palette to the left 
         [CommandMethod(  "  dockl  "  )]
         
public     void   dockInfoPalL()
          {
            dockInfoPalette(DockableWindowOrient.left);
        } 
 
         
//   Lisp callable function: dockl
         
//   Lisp wrapper for dockl command 
         [LispFunction(  "  dockl  "  )]
         
public     void   dockInfoPalL(ResultBuffer args)
          {
            dockInfoPalL();
        } 
 
         
//   Command: dockf
         
//   Set Info Palette to float 
         [CommandMethod(  "  dockf  "  )]
         
public     void   dockInfoPalF()
          {
            dockInfoPalette(DockableWindowOrient.floating);
        } 
         
//   Lisp callable function: dockf
         
//   Lisp wrapper for dockf command 
         [LispFunction(  "  dockf  "  )]
         
public     void   dockInfoPalF(ResultBuffer args)
          {
            dockInfoPalF();
        } 
 
 
         
//   Method to implement the positiioning/docking of the "Info Palette" window 
           private     void   dockInfoPalette(DockableWindowOrient orientation)
          {
             
int   wkB   =   cs.Workspaces.IndexOfWorkspaceName(  "  AutoCAD Default  "  );
             
//   check to see if it exists 
               if   (wkB   ==     -  1  )
              {
                 
//   if not, then see if it is called simply AutoCAD 
                 wkB   =   cs.Workspaces.IndexOfWorkspaceName(  "  AutoCAD  "  );
                 
if   (wkB   ==     -  1  )
                  {
                     
//   if not, then ok - it's something else 
                     Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(  "  Workspace not found.  "  );
                     
return  ;
                } 
            } 
            Workspace wk  
=   cs.Workspaces[wkB];
            
             
foreach  (WorkspaceDockableWindow dockableWindow   in   wk.DockableWindows)
              {
                 
if  (dockableWindow.Name.Equals(  "  Info Palette  "  ))
                  {    
                     
if  (orientation.Equals(DockableWindowOrient.floating))
                        dockableWindow.DockFloat  
=   DockedFloatingIgnoreToggle.floating;
                     
else      
                        dockableWindow.DockFloat  
=   DockedFloatingIgnoreToggle.docked;

                    dockableWindow.Display  
=   yes;
                    dockableWindow.Orientation  
=   orientation;
                    dockableWindow.AutoHide  
=   OnOffIgnoreToggle.off;
                    dockableWindow.UseTransparency  
=   no;
                     
break  ;
                } 
            } 
        } 
 
         
//   Command: addtoolbar
         
//   Creates a new toolbar called "New Toolbar", and adds it to all workspaces. 
         
//   This toolbar contains a Toolbar control for named view, button for drawing 
         
//   a pline, and a flyout that uses the "Draw" tool bar. 
         [CommandMethod(  "  addtoolbar  "  )]
         
public     void   addToolbar()
          {
            Toolbar newTb  
=     new   Toolbar(  "  New Toolbar  "  ,cs.MenuGroup);
            newTb.ToolbarOrient  
=   ToolbarOrient.floating;
            newTb.ToolbarVisible  
=   ToolbarVisible.show;
            
            ToolbarControl tbCtrl  
=     new   ToolbarControl(ControlType.NamedViewControl,newTb,  -  1  );
                        
            ToolbarButton tbBtn  
=     new   ToolbarButton(newTb,  -  1  );
            tbBtn.Name  
=     "  PolyLine  "  ;
            tbBtn.MacroID  
=     "  ID_Pline  "  ;

            ToolbarFlyout tbFlyout  
=     new   ToolbarFlyout(newTb,  -  1  );
            tbFlyout.ToolbarReference  
=     "  DRAW  "  ;

             
foreach  ( Workspace wk   in   cs.Workspaces)
              {
                WorkspaceToolbar wkTb  
=     new   WorkspaceToolbar(wk,newTb);
                wk.WorkspaceToolbars.Add(wkTb);
                wkTb.Display  
=     1  ;
            } 
        } 
         
//   Lisp callable function: addtoolbar
         
//   Lisp wrapper for addtoolbar command 
         [LispFunction(  "  addtoolbar  "  )]
         
public     void   addToolbar(ResultBuffer args)
          {
            addToolbar();
        } 
 
         
//   Command: remtoolbar
         
//   This Command removes the toolbar added above from the Main CUI File and any
         
//   workspaces that it was added to.  
         [CommandMethod(  "  remtoolbar  "  )]
         
public     void   remToolbar()
          {
            Toolbar tbr  
=   cs.MenuGroup.Toolbars.FindToolbarWithName(  "  New Toolbar  "  );
             
if   (tbr   !=     null   )
              {
                 
foreach  (Workspace wk   in   cs.Workspaces)
                  {
                    WorkspaceToolbar wkTb  
=   wk.WorkspaceToolbars.FindWorkspaceToolbar(tbr.ElementID,tbr.Parent.Name);
            
                     
if  (wkTb   !=     null  )
                        wk.WorkspaceToolbars.Remove(wkTb);
                } 
                cs.MenuGroup.Toolbars.Remove(tbr);     
//   Deletes the toolbar from ACAD Menu Group 
             } 
        } 
 
         
//   Lisp callable function: remtoolbar
         
//   Lisp wrapper for remtoolbar command 
         [LispFunction(  "  remtoolbar  "  )]
         
public     void   remToolbar(ResultBuffer args)
          {
            remToolbar();
        } 
 
         
//   Command: tempkey
         
//   This command will install a temporary override key. Temporary override keys are keys that temporarily 
         
//   turn on or turn off one of the drawing aids that are set in the Drafting Settings dialog box 
         
//   (for example, Ortho mode, object snaps, or Polar mode). 
         [CommandMethod(  "  tempkey  "  )]
         
public     void   tempOverride()
          {
            TemporaryOverride newTempOverride  
=     new   TemporaryOverride(cs.MenuGroup);    
            newTempOverride.OverrideShortcutKey  
=     "  SHIFT+Y  "  ;   //   Scan code for Y 
             newTempOverride.Name   =     "  Customization Override  "  ;
            newTempOverride.Description  
=     "  Customization Override  "  ;
            newTempOverride.ElementID  
=  "  EID_CUITEMPOVERRIDE  "  ;
             
//   Creating a override for Shift+Y (Key down) that will behave as temporary override for OSnap to endpoint (MM_1629) 
             OverrideItem newOverrideItem   =     new   OverrideItem(  "  MM_1629  "  ,OverrideKeyState.Down,newTempOverride);
            newTempOverride.DownOverride  
=   newOverrideItem;            
        } 
         
//   Lisp callable function: tempkey
         
//   Lisp wrapper for tempkey command 
         [LispFunction(  "  tempkey  "  )]
         
public     void   tempOverride(ResultBuffer args)
          {
            tempOverride();
        } 
 
         
//   Command: dblclick
         
//   This command adds a double click action for polylines (Non-LWpolylines like 2D polylines).
         
//   After running this command, When we double click a polyline (i.e., a non-light weight polyline), 
         
//   the "Properties" window is launched. This replaces the original behaviour where "pedit" was launched. 
         [CommandMethod(  "  dblclick  "  )]
         
public     void   doubleClick()
          {
            DoubleClickAction dblClickAction  
=     new   DoubleClickAction(cs.MenuGroup,  "  My Double click  "  ,  -  1  );
            dblClickAction.Description  
=     "  Double Click Customization  "  ;
            dblClickAction.ElementID  
=     "  EID_mydblclick  "  ;
            dblClickAction.DxfName  
=     "  Polyline  "  ;
            DoubleClickCmd dblClickCmd  
=     new   DoubleClickCmd(dblClickAction);
            dblClickCmd.MacroID  
=     "  ID_Ai_propch  "  ;
            dblClickAction.DoubleClickCmd  
=   dblClickCmd;
        } 
         
//   Lisp callable function: dblclick
         
//   Lisp wrapper for dblclick command 
         [LispFunction(  "  dblclick  "  )]
         
public     void   doubleClick(ResultBuffer args)
          {
            doubleClick();
        } 
 
        
         
//   Command: cuiall
         
//   Issuing this command will run the methods to make all changes to the UI
         
//   This will add the custom menu, toolbar, and shortcut, as well as 
         
//   dock the info palette on the right side. 
         [CommandMethod(  "  cuiall  "  )]
         
public     void   callForAllChanges()
          {
            addMenu();
            shortCut();
            addToolbar();
            dockInfoPalR();
            saveCui();
        } 
         
//   Lisp callable function: cuiall
         
//   Lisp wrapper for cuiall command 
         [LispFunction(  "  cuiall  "  )]
         
public     void   callForAllChanges(ResultBuffer args)
          {
            callForAllChanges();
        } 
 
    } 
}
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_33819479/article/details/85441687

智能推荐

【史上最易懂】马尔科夫链-蒙特卡洛方法:基于马尔科夫链的采样方法,从概率分布中随机抽取样本,从而得到分布的近似_马尔科夫链期望怎么求-程序员宅基地

文章浏览阅读1.3k次,点赞40次,收藏19次。虽然你不能直接计算每个房间的人数,但通过马尔科夫链的蒙特卡洛方法,你可以从任意状态(房间)开始采样,并最终收敛到目标分布(人数分布)。然后,根据一个规则(假设转移概率是基于房间的人数,人数较多的房间具有较高的转移概率),你随机选择一个相邻的房间作为下一个状态。比如在巨大城堡,里面有很多房间,找到每个房间里的人数分布情况(每个房间被访问的次数),但是你不能一次进入所有的房间并计数。但是,当你重复这个过程很多次时,你会发现你更有可能停留在人数更多的房间,而在人数较少的房间停留的次数较少。_马尔科夫链期望怎么求

linux以root登陆命令,su命令和sudo命令,以及限制root用户登录-程序员宅基地

文章浏览阅读3.9k次。一、su命令su命令用于切换当前用户身份到其他用户身份,变更时须输入所要变更的用户帐号与密码。命令su的格式为:su [-] username1、后面可以跟 ‘-‘ 也可以不跟,普通用户su不加username时就是切换到root用户,当然root用户同样可以su到普通用户。 ‘-‘ 这个字符的作用是,加上后会初始化当前用户的各种环境变量。下面看下加‘-’和不加‘-’的区别:root用户切换到普通..._限制su root登陆

精通VC与Matlab联合编程(六)_精通vc和matlab联合编程 六-程序员宅基地

文章浏览阅读1.2k次。精通VC与Matlab联合编程(六)作者:邓科下载源代码浅析VC与MATLAB联合编程浅析VC与MATLAB联合编程浅析VC与MATLAB联合编程浅析VC与MATLAB联合编程浅析VC与MATLAB联合编程  Matlab C/C++函数库是Matlab扩展功能重要的组成部分,包含了大量的用C/C++语言重新编写的Matlab函数,主要包括初等数学函数、线形代数函数、矩阵操作函数、数值计算函数_精通vc和matlab联合编程 六

Asp.Net MVC2中扩展ModelMetadata的DescriptionAttribute。-程序员宅基地

文章浏览阅读128次。在MVC2中默认并没有实现DescriptionAttribute(虽然可以找到这个属性,通过阅读MVC源码,发现并没有实现方法),这很不方便,特别是我们使用EditorForModel的时候,我们需要对字段进行简要的介绍,下面来扩展这个属性。新建类 DescriptionMetadataProvider然后重写DataAnnotationsModelMetadataPro..._asp.net mvc 模型description

领域模型架构 eShopOnWeb项目分析 上-程序员宅基地

文章浏览阅读1.3k次。一.概述  本篇继续探讨web应用架构,讲基于DDD风格下最初的领域模型架构,不同于DDD风格下CQRS架构,二者架构主要区别是领域层的变化。 架构的演变是从领域模型到C..._eshoponweb

Springboot中使用kafka_springboot kafka-程序员宅基地

文章浏览阅读2.6w次,点赞23次,收藏85次。首先说明,本人之前没用过zookeeper、kafka等,尚硅谷十几个小时的教程实在没有耐心看,现在我也不知道分区、副本之类的概念。用kafka只是听说他比RabbitMQ快,我也是昨天晚上刚使用,下文中若有讲错的地方或者我的理解与它的本质有偏差的地方请包涵。此文背景的环境是windows,linux流程也差不多。 官网下载kafka,选择Binary downloads Apache Kafka 解压在D盘下或者什么地方,注意不要放在桌面等绝对路径太长的地方 打开conf_springboot kafka

随便推点

VS2008+水晶报表 发布后可能无法打印的解决办法_水晶报表 不能打印-程序员宅基地

文章浏览阅读1k次。编好水晶报表代码,用的是ActiveX模式,在本机运行,第一次运行提示安装ActiveX控件,安装后,一切正常,能正常打印,但发布到网站那边运行,可能是一闪而过,连提示安装ActiveX控件也没有,甚至相关的功能图标都不能正常显示,再点"打印图标"也是没反应解决方法是: 1.先下载"PrintControl.cab" http://support.businessobjects.c_水晶报表 不能打印

一. UC/OS-Ⅱ简介_ucos-程序员宅基地

文章浏览阅读1.3k次。绝大部分UC/OS-II的源码是用移植性很强的ANSI C写的。也就是说某产品可以只使用很少几个UC/OS-II调用,而另一个产品则使用了几乎所有UC/OS-II的功能,这样可以减少产品中的UC/OS-II所需的存储器空间(RAM和ROM)。UC/OS-II是为嵌入式应用而设计的,这就意味着,只要用户有固化手段(C编译、连接、下载和固化), UC/OS-II可以嵌入到用户的产品中成为产品的一部分。1998年uC/OS-II,目前的版本uC/OS -II V2.61,2.72。1.UC/OS-Ⅱ简介。_ucos

python自动化运维要学什么,python自动化运维项目_运维学python该学些什么-程序员宅基地

文章浏览阅读614次,点赞22次,收藏11次。大家好,本文将围绕python自动化运维需要掌握的技能展开说明,python自动化运维从入门到精通是一个很多人都想弄明白的事情,想搞清楚python自动化运维快速入门 pdf需要先了解以下几个事情。这篇文章主要介绍了一个有趣的事情,具有一定借鉴价值,需要的朋友可以参考下。希望大家阅读完这篇文章后大有收获,下面让小编带着大家一起了解一下。_运维学python该学些什么

解决IISASP调用XmlHTTP出现msxml3.dll (0x80070005) 拒绝访问的错误-程序员宅基地

文章浏览阅读524次。2019独角兽企业重金招聘Python工程师标准>>> ..._hotfix for msxml 4.0 service pack 2 - kb832414

python和易语言的脚本哪门更实用?_易语言还是python适合辅助-程序员宅基地

文章浏览阅读546次。python和易语言的脚本哪门更实用?_易语言还是python适合辅助

redis watch使用场景_详解redis中的锁以及使用场景-程序员宅基地

文章浏览阅读134次。详解redis中的锁以及使用场景,指令,事务,分布式,命令,时间详解redis中的锁以及使用场景易采站长站,站长之家为您整理了详解redis中的锁以及使用场景的相关内容。分布式锁什么是分布式锁?分布式锁是控制分布式系统之间同步访问共享资源的一种方式。为什么要使用分布式锁?​ 为了保证共享资源的数据一致性。什么场景下使用分布式锁?​ 数据重要且要保证一致性如何实现分布式锁?主要介绍使用redis来实..._redis setnx watch

推荐文章

热门文章

相关标签