Diagram / Commanding / File Dialogs Customization
In This Topic
    File Dialogs Customization
    In This Topic

    NOV Diagram makes it easy to customize the file formats shown in its "Open" and "Save As" dialogs. To do that, you should:

     1. Create Custom Open and Save As Command Actions

    Create custom classes that inherit from NOpenCommandAction and NSaveAsCommandAction and override the GetFormats method to return only the drawing file formats you want to show in the "Open" and "Save As" file dialogs.

    For example, the following custom commands will show only the Visio Drawing (VSDX) and AutoCAD Drawing Interchange (DXF) file formats:

    Custom Diagram "Open" command action
    Copy Code
    private class CustomOpenCommandAction : NOpenCommandAction
    {
        public CustomOpenCommandAction()
        {
        }
        static CustomOpenCommandAction()
        {
            CustomOpenCommandActionSchema = NSchema.Create(typeof(CustomOpenCommandAction), NOpenCommandActionSchema);
        }
    
        protected override NDrawingFormat[] GetFormats()
        {
            return new NDrawingFormat[]
            {
                NDrawingFormat.Visio,
                NDrawingFormat.VectorAutoCadDxf
            };
        }
    
        public static readonly NSchema CustomOpenCommandActionSchema;
    }
    

     

    Custom Diagram "Save As" command action
    Copy Code
    public class CustomSaveAsCommandAction : NSaveAsCommandAction
    {
        public CustomSaveAsCommandAction()
        {
        }
        static CustomSaveAsCommandAction()
        {
            CustomSaveAsCommandActionSchema = NSchema.Create(typeof(CustomSaveAsCommandAction), NSaveAsCommandActionSchema);
        }
    
        protected override NDrawingFormat[] GetFormats()
        {
            return new NDrawingFormat[]
            {
                NDrawingFormat.Visio,
                NDrawingFormat.VectorAutoCadDxf
            };
        }
    
        public static readonly NSchema CustomSaveAsCommandActionSchema;
    }
    
     2. Replace the Old "Open" and "Save As" Command Actions

    Use the following code to replace the old "Open" and "Save As" command actions of the drawing view with the new custom ones:

    Replacing the "Open" and "Save As" command actions
    Copy Code
    drawingView.Commander.ReplaceCommandAction(new CustomOpenCommandAction());
    drawingView.Commander.ReplaceCommandAction(new CustomSaveAsCommandAction());