Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, February 21, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix .NET Extensions
Forum to discuss the use of .NET Extensions in SalesLogix version 7 and higher. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix .NET Extensions | New ThreadView:  Search:  
 Author  Thread: Converting from embedded .net user control to .NET Extension woes...
john
Posts: 34
 
Converting from embedded .net user control to .NET Extension woes...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Aug 08 5:47 AM
I have a c# .NET user control which I can host within Saleslogix 7.2 using the examples on this site (ie creating a COM visible Loader class and using SetParent API).

I have now starting looking at converting the project in order to host it as a .NET Extension, as that should make it easier to deploy to our users.

To keep things simple(!) I have created a new project which just wraps the Loader class in order to be able to call it from a .NET extension:

Public Class TestWrapper
Inherits System.ComponentModel.Component

Implements Sage.SalesLogix.NetExtensions.IRunnable

Private loader As Test.Loader

Public Sub Initialize(ByVal SlxApplication As Sage.SalesLogix.NetExtensions.SalesLogix.ISlxApplication, ByVal LicenseKeyManager As Sage.SalesLogix.NetExtensions.Licensing.ILicenseKeyManager) Implements Sage.SalesLogix.NetExtensions.IRunnable.Initialize
loader = New Test.Loader
End Sub

Public Function Run(ByVal Args() As Object) As Object Implements Sage.SalesLogix.NetExtensions.IRunnable.Run
Return Me
End Function

Public Sub Init(ByVal Handle As IntPtr)
loader.Init(Handle)
End Sub

Public Sub InitializeScreen()
loader.InitializeScreen()
End Sub
End Class

I have amended the SLX code from creating the Loader class as a COM object to creating an instance of the .NET extension:
option explicit

Sub Initialize()
Dim loader, guid
stop
If Application.GlobalInfo.IndexOf("TestObject") = -1 Then
guid = Application.Managed.Create("TestWrapper", "TestWrapper.TestWrapper")
set loader = Application.Managed.Run(guid)
loader.Init Form.HWND
Application.GlobalInfo.Add "TestObject", loader
Else
Set loader = Application.GlobalInfo("TestObject")
End If
loader.InitializeScreen()
Set loader = Nothing
End Sub

Sub AXFormShow(Sender)
Call Initialize()
End Sub

When running the SLX code, the call to Application.Managed.Create returns a GUID, but the call to Application.Managed.Run results in the following error:
Microsoft VBScript runtime error: Object required: 'Application.Managed.Run(...)'

Creating the loader class via COM and embedding it via the SetParent API works fine, I just cannot seem to get it run via the IRunnable interface...

So the million pound question is : what am I doing wrong!
[Reply][Quote]
john
Posts: 34
 
Re: Converting from embedded .net user control to .NET Extension woes...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Aug 08 9:27 AM
If it helps:

I have just created a simple VB.NET Extension which does nothing apart from:
Public Class SLXExt
Inherits System.MarshalByRefObject
Implements Sage.SalesLogix.NetExtensions.IRunnable

Private mySlxApplication As Sage.SalesLogix.NetExtensions.SalesLogix.ISlxApplication

Public Sub Initialize(ByVal SlxApplication As Sage.SalesLogix.NetExtensions.SalesLogix.ISlxApplication, ByVal LicenseKeyManager As Sage.SalesLogix.NetExtensions.Licensing.ILicenseKeyManager) Implements Sage.SalesLogix.NetExtensions.IRunnable.Initialize
mySlxApplication = SlxApplication
End Sub

Public Function Run(ByVal Args() As Object) As Object Implements Sage.SalesLogix.NetExtensions.IRunnable.Run
MsgBox(String.Format("Hello World from {0}", mySlxApplication.Users("mySlxApplication.BasicFunctions.CurrentUserID").Name))
Return Nothing
End Function
End Class

and called it via SLX by:
Dim guid
guid = Application.Managed.Create("SLXExtTest", "SLXExtTest.SLXExt")
Application.Managed.Run guid
Application.Managed.Destroy(guid)

And I get the same problem - I get a guid created, but the Run does nothing - so I suspect there are other things afoot than just the code...
[Reply][Quote]
Martin Rudnick
Posts: 52
 
Re: Converting from embedded .net user control to .NET Extension woes...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Aug 08 9:35 AM
maybe try something like

Dim rVal
rVal = Application.Managed.Run (guid)
[Reply][Quote]
Mark Dykun
Posts: 297
 
Re: Converting from embedded .net user control to .NET Extension woes...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Aug 08 9:09 AM
Run requires an args parameter to be passed in. If you have no arguments pass in Nothing like

Application.Managed.Run (guid, nothing)

Mark
[Reply][Quote]
john
Posts: 34
 
Re: Converting from embedded .net user control to .NET Extension woes...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Sep 08 11:15 AM
Right - I finally have the time to look at this again, and now have it working (in a fashion)!

I did have to supply the args parameter so my code changed to:
set loader = Application.Managed.Run(guid, nothing)

Some other quirks I keep experiencing are:
I have to keep running the RegisterSLXNetExtentions.bat on my development machine every time I wish to test the integration with SLX, otherwise the SLX script will generate a guid but will fail on the call to Run.

Updating existing binaries using the Saleslogix .NET Extensions Manager seems to be a bit of a hit and miss affair. I find I am actually deleting the Extension altogether and then readding it rather than just updating/releasing the existing Extension. (and Im sure the Last Updated column is pure rubbish...), otherwise the binary is not always being updated when invoked.

The final issue I am finding is that I have implemented a DataGridView with a "jump to" feature so that for example pressing the letter "c" will jump to the first item in the list beginning with that letter. This works fine when called from outside SLX (ie through a .Net test harness) but fails to work from SLX - I think the control is not receiving the on key preview event I am handling (maybe they are getting handled by the SLX form instead?!) - I will have to add some debugging in to determine if the event is firing or not...

[Reply][Quote]
john
Posts: 34
 
Re: Converting from embedded .net user control to .NET Extension woes...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Sep 08 5:33 AM
The problem I have been having with updating existing binaries is that the .NET Extensions Manager does not seem to update only dependencies. As I have created a wrapper component around my .NET user control, changing just the user control would not result in the binary being updated.

I have resolved this by removing the wrapper component and instead have implemented a com visible class within my .NET user control.

I have had to amend the "jumpto" feature to use KeyDown rather than PreviewKeyDown as the PreviewKeyDown event does not get raised when emdedding the .NET user control within an SLX Form.
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 2/21/2025 11:47:28 PM