Search
Theme Editor

Introduction

The theme editor is a stand-alone application that comes with MindFusion.Scheduling, which enables you to create your own MindFusion.Scheduling themes without writing a single line of code. To learn more about how to create custom themes in general, see Custom Themes. For a practical example on how to use the theme editor, refer to Tutorial 8: Creating Custom Themes.

 Note

The Theme Editor is found in the folder where you have installed MindFusion.Scheduling (usually 'c:\Program Files\MindFusion\MindFusion.Scheduling for WinForms'). You can also access it from the Windows' start menu.

Adding themes

When the application is initially started, it contains an empty theme package. You can add new themes to the package and rename and delete existing themes from the Themes menu. Once a new theme is added, its name appears in the list on the left side. In order to edit existing themes, double-click on their names in the list, select them in the list and press F2 or select them and press Theme -> Edit menu item.

 Note

The names of the new themes must be unique within the package and also they must be valid identifiers. The reason for this is that the name of each theme is used as a name of its corresponding class.

Editing themes

When the theme is being edited, a new form appears in the right part of the application. You can modify the properties of the theme from the property grid on the left side of this new form the same way you would modify the properties of the Calendar control in the Visual Studio design environment. You can observe the results of your modifications in the preview window available in the right side of the theme form. Below the preview window there is a text box, containing the source code of the current theme. You can copy the source code at any given time and paste it in your application. The other way to use the theme(s) is to compile the package in a separate dll file.

Settings

The following options are available for each package:

  • CodeProviderType - specifies the programming language to use when generating the theme source code. The available options are C# and VB.NET.
  • Namespace - specifies the namespace containing the generated theme class.
  • OutputFile - contains the fully qualified path of the compiled dll file. This property is mandatory for successful compilation.
  • CommonReference - specifies the fully qualified path to the MindFusion.Common.dll. This property is mandatory for successful compilation.
  • PlannerReference - specifies the fully qualified path to the MindFusion.Scheduling.dll. This property is mandatory for successful compilation.

All settings can be accessed via Options -> Settings menu.

Compilation

To compile the theme package in an external dll file, select Options -> Compile menu. The result of the compilation is specified by the OutputFile property in the package settings (see Settings section above). The dll file contains a single class for each theme in the package. The name of each class is the same as the name of its corresponding theme. All classes are placed in a namespace as specified by the Namespace property in the package settings (see Settings section above).

 Note

In order to use the themes from the compiled dll file in your application, you have to copy this file in the directory containing the referenced MindFusion.Common.dll and MindFusion.Scheduling.dll files. Then you need to add a reference to the theme dll to your project, instantiate an object of a particular theme class and assign this object to the Calendar.CustomTheme property. You can alternatively add the custom themes to the Toolbox in the Visual Studio environment and assign them to the Calendar control at design-time. For more information on how to do this refer to Tutorial 8: Creating Custom Themes.

 Important note

It is required to recompile all theme libraries when the MindFusion.Scheduling.dll or MindFusion.Common.dll files change. This usually happens when you upgrade to a new version of MindFusion.Scheduling. For more information on how to automate the process of rebuilding your theme libraries, refer to the next point.

Compiling from Command Line

The theme editor supports compilation from command line. This feature is considered unofficial and should be used with caution. The command line utility does not produce any error messages nor does it display any information in the command line window. The only way to determine the success of the theme editor when invoked from a command line is the availability of the output library file. However, this utility can be useful if you want to automate the build of your custom theme libraries. Here is the syntax of the theme editor command line utility:

Command line syntax  Copy Code

ThemeEditor.exe t:themeFile [o:outputLibrary] [cr:commonRef] [pr:plannerRef] [t:themeFile [o:outputFile] ...]

The following table describes the input arguments:

Argument

Description

t:themeFile

Specifies the binary theme file, which should be comiled.

o:outputFile

Specifies the name of the output dll file.

Note: This argument is optional. If it is not specified, the output file name is obtained from the theme file settings. If there is neither output file name specified as argument nor in the theme file settings, the compilation will fail. However, if this argument is specified, it will override the one available in the theme file settings.

cr:commonRef

Specifies the path to the MindFusion.Common.dll file required to compile a custom theme.

Note: This argument is optional. If it is not specified, the reference file name is obtained from the theme file settings. If there is neither reference file name specified as argument nor in the theme file settings, the compilation will fail. However, if this argument is specified, it will override the one available in the theme file settings.

cr:plannerRef

Specifies the path of the MindFusion.Scheduling.dll file required to compile a custom theme.

Note: This argument is optional. If it is not specified, the reference file name is obtained from the theme file settings. If there is neither reference file name specified as argument nor in the theme file settings, the compilation will fail. However, if this argument is specified, it will override the one available in the theme file settings.

The following example demonstrates how to use the command line utility in order to compile a custom theme. All the paths given in this example are figurative.

Command line  Copy Code

ThemeEditor.exe "t:d:\projects\myapp\mythemes.theme"

The above sample assumes that all required settings (output and reference files) are available in the theme file being compiled. The following example specifies those settings explicitly. In this case the settings in the theme file are ignored, even if available.

Command line  Copy Code

ThemeEditor.exe "t:d:\projects\myapp\mythemes.theme" "o:d:\projects\myapp\mytheme.dll" "cr:d:\projects\myapp\MindFusion.Common.dll" "pr:d:\projects\myapp\MindFusion.Scheduling.dll"

Persistence

Since themes cannot be restored from the dll file or from their source code, you have to save the theme package in a file in order to be able to make future modifications to the themes contained within it. To save the package, simply select File -> Save from the application menu. To load a previously saved package, select File -> Load from the menu.