Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
swdev:dotnet:develop_a_noah_fitting_module_using_.net [2011/07/06 12:16] smayr [GUI] |
swdev:dotnet:develop_a_noah_fitting_module_using_.net [2017/01/20 11:56] (current) smayr [Noah Fitting Module Logo (assembly Noah3.FitMod.Logo.dll)] |
||
---|---|---|---|
Line 218: | Line 218: | ||
* Create C++ MFC (Microsoft Foundation Class) application project. | * Create C++ MFC (Microsoft Foundation Class) application project. | ||
* Build application. | * Build application. | ||
- | * Register COM server | + | * Register COM server |
+ | * By selecting checkbox " | ||
+ | * By executing the generated executable file. It generates an error "This server can only be run from a container application.", | ||
REGEDIT | REGEDIT | ||
; This .REG file may be used by your SETUP program. | ; This .REG file may be used by your SETUP program. | ||
Line 246: | Line 248: | ||
HKEY_CLASSES_ROOT\CLSID\{241255F6-0B94-4EBE-993A-030A8A4968FE}\InprocHandler32 = ole32.dll | HKEY_CLASSES_ROOT\CLSID\{241255F6-0B94-4EBE-993A-030A8A4968FE}\InprocHandler32 = ole32.dll | ||
</ | </ | ||
- | === GUI Wrapper === | + | |
+ | |||
+ | === GUI Wrapper | ||
* Create a C# WinForms project. | * Create a C# WinForms project. | ||
* Create a WinForms user control which will host the WPF GUI control. Eg: <code csharp> | * Create a WinForms user control which will host the WPF GUI control. Eg: <code csharp> | ||
Line 298: | Line 302: | ||
</ | </ | ||
* Structure code to deal with resources correctly when WPF is hosted in WinForms control (see [[http:// | * Structure code to deal with resources correctly when WPF is hosted in WinForms control (see [[http:// | ||
- | === GUI (Noah3.FitMod.GUI.dll) | + | |
+ | |||
+ | === GUI === | ||
* Create a C# WPF project. | * Create a C# WPF project. | ||
* Add references to project: | * Add references to project: | ||
Line 305: | Line 311: | ||
* Create a WPF user control with all the required functionality. | * Create a WPF user control with all the required functionality. | ||
* If using custom styles, load them from '' | * If using custom styles, load them from '' | ||
+ | * Register control or application with Noah Module Server. Typically the GUI control would call the AppViewModel to do so. Eg: The GUI code: <code csharp> | ||
+ | // Connect | ||
+ | TAppViewModel AppVM = new TAppViewModel(); | ||
+ | AppVM.ApplicationExecMode = TAppExecMode.Noah; | ||
+ | AppVM.cmdOpenNoahConnection(); | ||
+ | |||
+ | // Do work... | ||
+ | . . . | ||
+ | // Disconnect | ||
+ | AppVM.cmdCloseNoahConnection(); | ||
+ | </ | ||
+ | /// | ||
+ | /// < | ||
+ | /// Register with Noah. | ||
+ | /// </ | ||
+ | /// | ||
+ | private void cmdOpenNoahConnection() | ||
+ | { | ||
+ | if (m_ApplicationExecMode == TAppExecMode.Noah) | ||
+ | { | ||
+ | // Initialize the module server and register the module with module server. | ||
+ | TAppLog.LogMessage(" | ||
+ | TAppLog.LogMessage(" | ||
+ | m_NoahApp = new TNoahApp(); | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | TAppLog.LogMessage(" | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /// | ||
+ | /// < | ||
+ | /// Close the Noah connection before closing application. | ||
+ | /// </ | ||
+ | /// | ||
+ | public void cmdCloseNoahConnection() | ||
+ | { | ||
+ | TAppLog.LogMessage(" | ||
+ | |||
+ | if (m_ApplicationExecMode == TAppExecMode.Noah) | ||
+ | { | ||
+ | TAppLog.LogMessage(" | ||
+ | |||
+ | // Close the module server and unregister the module with module server. | ||
+ | if (m_NoahApp != null) | ||
+ | { | ||
+ | TAppLog.LogMessage(" | ||
+ | m_NoahApp.cmdClose(); | ||
+ | } | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | TAppLog.LogMessage(" | ||
+ | } | ||
+ | |||
+ | TAppLog.LogMessage(" | ||
+ | } | ||
+ | </ | ||
=== Noah Fitting Module Library (assembly AHI.App.Noah.dll) === | === Noah Fitting Module Library (assembly AHI.App.Noah.dll) === | ||
Line 323: | Line 388: | ||
* '' | * '' | ||
+ | === Noah Fitting Module Logo (assembly Noah3.FitMod.Logo.dll) === | ||
+ | * Create Class (assembly) project. | ||
+ | * Create '' | ||
+ | LOGO001 | ||
+ | LOGO002 | ||
+ | STRINGTABLE | ||
+ | { | ||
+ | 1001, " | ||
+ | } | ||
+ | </ | ||
+ | * Compile resource file '' | ||
+ | * Alternatively, | ||
+ | * Add res file to assembly. | ||
+ | * Build assembly. |