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:29] 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 (assembly Noah3.FitMod.GUI.dll) === | === GUI Wrapper (assembly Noah3.FitMod.GUI.dll) === | ||
* Create a C# WinForms project. | * Create a C# WinForms project. | ||
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 === | === GUI === | ||
* Create a C# WPF project. | * Create a C# WPF 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 method: <code csharp> | + | * 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(); |
- | /// Constructor | + | AppVM.ApplicationExecMode = TAppExecMode.Noah; |
- | /// </ | + | AppVM.cmdOpenNoahConnection(); |
- | /// | + | |
- | public TAppViewModel() | + | |
- | { | + | |
- | TAppLog.LogMessage(" | + | |
- | | + | |
- | TAppLog.LogMessage(" | + | |
- | } | + | |
+ | // Do work... | ||
+ | . . . | ||
+ | // Disconnect | ||
+ | AppVM.cmdCloseNoahConnection(); | ||
+ | </ | ||
/// | /// | ||
/// < | /// < | ||
- | /// Initialize the view model, and register | + | /// Register |
/// </ | /// </ | ||
/// | /// | ||
- | private void InitializeViewModel() | + | private void cmdOpenNoahConnection() |
{ | { | ||
if (m_ApplicationExecMode == TAppExecMode.Noah) | if (m_ApplicationExecMode == TAppExecMode.Noah) | ||
{ | { | ||
// Initialize the module server and register the module with module server. | // Initialize the module server and register the module with module server. | ||
- | TAppLog.LogMessage(" | + | TAppLog.LogMessage(" |
- | TAppLog.LogMessage(" | + | TAppLog.LogMessage(" |
m_NoahApp = new TNoahApp(); | m_NoahApp = new TNoahApp(); | ||
} | } | ||
else | else | ||
{ | { | ||
- | TAppLog.LogMessage(" | + | TAppLog.LogMessage(" |
} | } | ||
} | } | ||
Line 340: | Line 344: | ||
/// | /// | ||
/// < | /// < | ||
- | /// Close the current view model with the purpose of closing application. | + | /// Close the Noah connection before |
/// </ | /// </ | ||
/// | /// | ||
- | public void cmdClose() | + | public void cmdCloseNoahConnection() |
{ | { | ||
TAppLog.LogMessage(" | TAppLog.LogMessage(" | ||
Line 349: | Line 353: | ||
if (m_ApplicationExecMode == TAppExecMode.Noah) | if (m_ApplicationExecMode == TAppExecMode.Noah) | ||
{ | { | ||
- | TAppLog.LogMessage(" | + | TAppLog.LogMessage(" |
// Close the module server and unregister the module with module server. | // Close the module server and unregister the module with module server. | ||
if (m_NoahApp != null) | if (m_NoahApp != null) | ||
{ | { | ||
- | TAppLog.LogMessage(" | + | TAppLog.LogMessage(" |
m_NoahApp.cmdClose(); | m_NoahApp.cmdClose(); | ||
} | } | ||
Line 360: | Line 364: | ||
else | else | ||
{ | { | ||
- | TAppLog.LogMessage(" | + | TAppLog.LogMessage(" |
} | } | ||
- | TAppLog.LogMessage(" | + | TAppLog.LogMessage(" |
} | } | ||
</ | </ | ||
Line 384: | 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. |