Editor application is written mainly in C#. The user interface is defined in XAML format and rendered by Windows Presentation Framework. The application structure follows Microsoft MVVM design pattern in order to separate views from the model. The access to model is handled by the command controller which allows implementations of undo/redo history.


Following drawing shows the core structure and basic flow of events in the application. Model is observed by view models, which in turn interact with user interface (views). User input triggers a command, the commands are executed through controller that maintains undo stack. Each command implements do/undo/redo verbs and encapsulates logic of some operation and its reversal. Changes are applied to model (document) when executing the command, and view models get notified about resulting changes.

Base structure

Note the clockwise flow of events in the above setup. The model is observed by various view models, which in turn expose properties that are bound to user interface in XAML. The view models trigger execution of commands via controller. Changes are applied to document when executing the command, and view models get notified about resulting changes, which closes the loop.

As a result, the implementation of the model is completely unaware of the user interface details. The deserialization module loads DOM state from file and any change to the elements and their properties triggers notifications. There can be various view models subscribing to certain areas of interest in document. The MVVM principle allows clear separation between various interface panels and makes it easy to add new components.


The main components of the application are:

  • Model which resides in Document.dll
  • Modifier commands reside in DocumentControl.dll
  • Viewmodels and XAML views in DocumentView.dll
  • The main application Editor.exe contains the top-level window layout and initialization code

The model implementation (Document.dll) can be used as SDK component for creating import and export modules. The model is independent from Windows Presentation framework and can be distributed as .NET Core class library. There is also separate C++ version of the document model along with XML serialization. This makes the runtime components independent from the desktop tools - even though they can be executed from UI code, there are no linking dependencies.

Integration example

In order to access a document in your application, add reference to the Document.dll to your project.

WS.Document.Document document;

// load the document from file
document = WS.Document.Library.Load(@"example.shape");

// print top level data items
foreach (WS.Document.DataElement item in document.Data.Children)
    Console.WriteLine( $"{item.Name} : {item.Content}" );

// save the document into file
WS.Document.Library.Save(document, @"modified.shape", false);