Table of Contents

GUI File Path Assignment

See the remarks of MakeXmlSource(string, string, bool) to know the design pattern of file path treatment.

if the assigned file path is descendent of the configuration directory, it is straight forward that set the baseDirectory to the configuration directory and apply relative path to relFile; if not, set baseDirectory to null and set relFile to absolute path.

GUI that needs to assign file generally requires a code-behind BaseDirectory property as assistent model. The property is assigned by the parent model from the parent GUI.

In most cases, the first BaseDirectory is the project directory if the project has assigned (created or loaded).

Portability

To maintain For the portability of project or the other folder-based unit, if the sub-item is loaded by absolute path outside the folder-based unit directory, redirect the saving path to the folder-based unit directory, i.e. the SubItemFile below.

Note

You have no need to do an additional action to create a duplicate in the folder-based unit directory. Since the file-writing pattern of MakeXmlSource(string, string, bool) create files when user call to save. In other perspective, if user does not call to save, the local duplicate should be created.

The design pattern is usually saw in the HiAPI program, a object contains the properties:

  • object SubItem;
  • string SubItemFile;

Then you should keep the Protability.

File Path of Load Button and Save Button

The genneral convention of the File Path of Load and Save is different by the single-user desktop application and server application.

Tip

Always preserve an empty filter ( * . * ) for the browser.

Single-User Desktop Application

The default directory of the Save/Load button are generally:

  • System Default Directory or Project Directory (default, if not explicitly indicated) The initial directory is the project directory.
  • Resource Directory The path always point to <application path>/Resource/<classification> directory. The button label has to explicitly show ‘Load Resource’.

The kinds of buttons are not exclusive, they can be existed on the same tool bar.

Server Application

The default directory of the Save/Load button are generally:

  • Admin Directory
  • Project Directory
  • Resource Directory

Typical Action if exhibitionOnly false

On IMakeXmlSource.MakeXmlSource(string, string, bool) with exhibitionOnly false, the argument (baseDirectory and relFile) should be the same from object's host (if exist) XML output function.