Object Management Menu Button
The menu button represent the target object. The target object generally is IMakeXmlSource.
The target object has the following functions:
- File Save/Load
- Object Copy/Paste
- Editor Panel Mode Selection
- GUI (user-friendly)
- XML
- Get XML by IMakeXmlSource with
exhibitionOnly
true. - Set XML by XFactory.
- Get XML by IMakeXmlSource with
If the target object is not IMakeXmlSource, then the XML Editor Panel Mode should not appear. The other functions are still buildable.
Don't use GenMode.Default on XFactory functions. Use GenMode.Rebase. Since GenMode.Default pass the inner exception silently.
Layout
- Object Management Menu Button
- Load Button
- Load Resource Button
- Save As Button
- (splitter)
- Copy Button (with hotkey support if the Object Management Menu Button is focused)
- Paste Button (with hotkey support if the Object Management Menu Button is focused)
- (splitter)
- GUI Ratio Button
- XML Ratio Button
Tip
- Since the Object Management Menu Button has special meaning, use icon instead of text label.
- Do not use icon on the other child buttons. The icons gains nothing but hard to keep style to the full application.
- If the model is selected, show a different style (may be color) on the menu button.
- The model should contain a ResourceDirectory property.
- Do not show Load Resource Button if Resource directory not explicitly gave.
Copy & Paste
- Object Copy/Paste (i.e. Select/Set or Duplicated-Set)
- Copy (i.e. Select) Set the model to UserEnv.SelectedItem.
- Paste Set UserEnv.SelectedItem to the model. Set by reference is default. Apply Duplicated-Set if explicitly required.
While a object is copied (selected) here, it can also be paste (drag) to:
- Text editor
Use IMakeXmlSource.MakeXmlSource(string, string, bool) with
exhibitionOnly
false and the argument (baseDirectory
andrelFile
) from object's host to paste the text, it should be the same text content by the host XML output. - File browser
Use IMakeXmlSource.MakeXmlSource(string, string, bool) with
exhibitionOnly
true,baseDirectory
destination folder,relFile
destination file name (maybe xxx.class-name) to paste the file.
Show message when paste action success or failed. See Handle Message and Exception.
If the data type is not matched, show the un-matched message.
Editor Panel Mode Ratio Button
The Editor Panel switched by the Editor Panel Mode Ratio Button.
The BaseDirectory and RelFile properties should exist. Use the RelFile property if the object's host has the corresponding property like XXXFile.
The Apply action should be well-set. Include SetFileDelegate from XFactory.Gen<T>(XElement, string, SetFileDelegate, GenMode, params object[]) function. The last argument should also be delivered by the host. So there must exist an property to pass the argument.
XML Editor Panel Layout
- XML Editor Panel
- Cancel Button
- Apply Button
- XML TextArea
Shows error message if the xml-parsing or object creation failed on XML Editor Panel Apply Button applied.
Single-User WPF Application Source Code Path
- Common/ObjectManagementMenuButton
see this page for git repository.