Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, May 18, 2024 
 
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: cannot open .Net form in Sales Logix
Sam
Posts: 16
 
cannot open .Net form in Sales LogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 01 Aug 07 5:14 AM
Hi Friends,
I am not able see the results when i include the .Net assembly(dll) or Form(exe) in the Sales Logix Architect. Basically i want to popup the .Net Windows form in the Sales Logix. For that i have written the code in .Net as,
Imports System
Imports System.Windows.Forms
Imports Sage.SalesLogix.NetExtensions

Public Class Form1

Implements Sage.SalesLogix.NetExtensions.IRunnable

Private SlxApplication As 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

End Sub

Public Function Run(ByVal Args() As Object) As Object Implements Sage.SalesLogix.NetExtensions.IRunnable.Run
Dim msg As String = "Hello .NET-SalesLogix World!" & vbCrLf & vbCrLf & _
"Argument passed: " & IIf(Args.Length = 0, "None", Args(0)) & vbCrLf & _
"Current userid: " & SlxApplication.BasicFunctions.CurrentUserID() & vbCrLf & _
"Connection String: " & SlxApplication.ConnectionString

MessageBox.Show(msg, ".NET MessageBox")
Return Nothing
End Function
End Class

And i have added the generated WindowsApplication1.exe to the .Net Extensions Manager,
and in the Sales Logix Architect, i have written the code as,

Sub Button1Click(Sender)

Dim Ext

Ext = Application.Managed.Create ("WindowsApplication1","WindowsApplication1.Form1")

Application.Managed.Run Ext,"Hi"

Application.Managed.Destroy Ext

End Sub

When i run the Sales Logix Client and click the Button1, i didn't get any output, neither the messagebox nor the Form1 opened.

Please help me to solve this problem.
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: cannot open .Net form in Sales LogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 01 Aug 07 12:22 PM
After this line:
Ext = Application.Managed.Create ("WindowsApplication1","WindowsApplication1.Form1")

Display the contents of "Ext" in a msgbox. Is it blank? If so, then the .NET Extentions probably didn't get installed correctly on that machine. You can do this manually be running the batch file in the SLX directory named something like InstallDotNetExtensions.bat.

-Ryan
[Reply][Quote]
Mark Dykun
Posts: 297
 
Re: cannot open .Net form in Sales LogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 01 Aug 07 4:37 PM

Do not know if this matters but the second parameter in the run is an array, could there be a marshalling issue there.

AFAIK, the Ext value would be blank if it could not find the extension in the catalog as well. It would be good to see an image of the .net extension manager with the .dll registered to see #1 the Name. I assume it is correct but always good to see.

Ryan,

do you know if there are any exceptions thrown with the extension manager stuff is not registered correctly in SLX?

Mark
[Reply][Quote]
Mark Dykun
Posts: 297
 
Re: cannot open .Net form in Sales LogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 01 Aug 07 4:44 PM
Does not matter with the string being passed in. It is marshalled as an object array fine.

Mark
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: cannot open .Net form in Sales LogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 01 Aug 07 4:59 PM
Quote:
Originally posted by Mark Dykun

do you know if there are any exceptions thrown with the extension manager stuff is not registered correctly in SLX?


Unfortunately there are not. The result you'll see is the guid returned by the create method comes back empty/blank. That is lame, since your stuff just won't load and it doesn't say why.
[Reply][Quote]
Sam
Posts: 16
 
Re: cannot open .Net form in Sales LogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Aug 07 12:25 AM
Ryan,
Thanks for your reply.
I have displayed the contents of "Ext" in the msgbox and it is NOT blank, it displays some GUID value. So i think there is no problem with .Net Extensions installation. But still i am not able to show the .Net form in Sales Logix.
Any help would be highly appreciated.
Thanks,
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: cannot open .Net form in Sales LogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Aug 07 1:22 AM
OK. Seems we have this conversation going in about 3 different threads. Let's consolidate and just continue here

If you're getting a guid back then extensions are installed right. Also, we can assume that you're using the right title & namespace.classname for the call to create.

In your code, no where is the form being shown. Your extension get loaded, that is, the form class is loaded and it's run method is invoked, but you're not actually "Showing" the form (ie: just because the class is instanciated won't show the form). You mentioned that the MessageBox in the .NET class isn't showing either, right?

-Ryan
[Reply][Quote]
Sam
Posts: 16
 
Re: cannot open .Net form in Sales LogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Aug 07 5:12 AM
yes, the MessageBox in the .Net class is also not showing.
As per your reply, you said that the run method is invoked, but the form is not "showing" as per the code. That means, do i need to include additional code to show the form? If yes, what could be that code? because i didn't find such code in this entire threads or articles. I tried in different ways, but didn't succeeded. Any inputs in this regard could be helpful.

One more interesting thing that i have noticed justnow and thought to share so that it may helps to solve the actual issue.
When i inherit the BaseRunnable Class, then it works fine and also getting the messagebox in .Net class .
But when i implement the IRunnable interface, then i am not getting anything, NO messagebox showing .
Here is the code using both BaseRunnable class and IRunnable interface respectively.

'Using BaseRunnable class,

Imports Sage.SalesLogix.NetExtensions
Imports System.Windows.Forms
Public Class Class1
Inherits Sage.SalesLogix.NetExtensions.BaseRunnable

Public Overrides Function Run(ByVal Args() As Object) As Object
Dim msg As String = "Hello .NET-SalesLogix World!" & vbCrLf & vbCrLf & _
"Argument passed: " & IIf(Args.Length = 0, "None", Args(0)) & vbCrLf & _
"Current userid: " & SlxApplication.BasicFunctions.CurrentUserID() & vbCrLf & _
"Connection String: " & SlxApplication.ConnectionString

MessageBox.Show(msg, ".NET MessageBox")
Return Nothing
End Function

End Class

'Using IRunnable Interface,

Imports Sage.SalesLogix.NetExtensions
Imports System.Windows.Forms
Public Class Class1

Implements Sage.SalesLogix.NetExtensions.IRunnable

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

End Sub
Public Function Run(ByVal Args() As Object) As Object Implements Sage.SalesLogix.NetExtensions.IRunnable.Run
Dim msg As String = "Hello .NET-SalesLogix World!" & vbCrLf & vbCrLf & _
"Argument passed: " & IIf(Args.Length = 0, "None", Args(0)) & vbCrLf & _
"Current userid: " & SlxApplication.BasicFunctions.CurrentUserID() & vbCrLf & _
"Connection String: " & SlxApplication.ConnectionString

MessageBox.Show(msg, ".NET MessageBox")
Return Nothing
End Function
End Class

Inheriting the BaseRunnable class works fine and Implementing the IRunnable interface fails.
But i need to use IRunnable Interface to show the .Net windows form in sales logix.

Thanks,

[Reply][Quote]
Mark Dykun
Posts: 297
 
Re: cannot open .Net form in Sales LogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Aug 07 8:25 AM
Looking at the code that implements the IRunnable interface. First in the Initialize it does not seem that you arew assigning your ISLXApplication passed in as a parameter as a member variable. In the run method what is the SLXApplication pointing to ? I would think that the following should be done. Such as follows

public class Loader : IRunnable
{

ISlxApplication _application = null;

#region IRunnable Members

void IRunnable.Initialize(ISlxApplication SlxApplication, ILicenseKeyManager LicenseKeyManager)
{
_application = SlxApplication;
}

object IRunnable.Run(object[] Args)
{

string helloWorld = string.Format("Hello User {0} ", _application.BasicFunctions.CurrentUserID());

return null;
}

#endregion
}
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: cannot open .Net form in Sales LogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Aug 07 3:55 PM
If you inherit from from IRunnable, then you're responsible for getting the reference to the SlxApplication object in the initialize method. You're not doing that and then attempting to use it in the run method.

You'll need to create a variable, class level scope, like this:

Dim SlxApplication As Sage.SalesLogix.NetExtensions.SalesLogix.ISlxApplication


Then, in the Initialize method you need to set the passed in SlxApplication object in your variable, then it will be good to use in the Run method. Does that make sense?

However, one thing to keep in mind as well, as I mentioned before, simply instanciating the Form1 class won't cause the form to show. The form won't show until either Show or ShowDialog is called on it.

You might be able to just call Me.ShowDialog in the Run method. What I would do is create a class in my project that get's invoked from SLX, and it loads a form, in a different class, in it's Run method. That's what I do.

Does that make sense?
[Reply][Quote]
Sam
Posts: 16
 
Re: cannot open .Net form in Sales LogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Aug 07 2:28 AM
Ryan,
its amazing..... i got the results as per the expectations when i follow your instruction.. thank you very much.
But am curious to know one more thing, when IRunnable interface is implemented, then we creating a class lever variable SlxApplication and setting the passed SlxApplication object in the Initialize method and then using that variable in Run method for userid and connectionstring.
But when BaseRunnable class is inherited, we dont have Initialize method and there is no SlxAppliation object passed as an argument in Run method, then how the SlxApplication object referenced and how the userid and connectionstring values are populating?
Since in both the cases, Run method is same which doesn't take SlxAppliation object as a parameter.
Then how the SlxApplication object is referenced to get the userid and connectionstring values when BaseRunnable class is inherited?

Is my analysis going in a wrong direction?
Thanks a lot for your support.
[Reply][Quote]
Ch.V.S Praveen
Posts: 2
 
Re: cannot open .Net form in Sales LogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Aug 07 3:01 AM
Iam getting the returned value from Application.Managed.Create as blank that would most likely mean one of two things as you said:

1) The "Namespace.Classname" for the assembly or the "Title" as defined in the .NET Extentions manager do not match with the code iam using to invoke it.

2) The .NET Extention files did not get properly registered on the machine iam testing on. If this is the case, i can fix this by manually running the batch file named "RegisterSLXNetExtentions.bat" found in the SalesLogix directory.

As my code is correct as per 1st point , i checked the 2nd point . When i manully ran the batch file named "RegisterSLXNetExtentions.bat" found in the SalesLogix directory , i got the following error while running the bat file:


E:\Program Files\SalesLogix>C:\WINNT\Microsoft.NET\Framework\v2.0.50727\RegAsm.e
xe Sage.SalesLogix.NetExtensions.Core.dll /codebase
Microsoft (R) .NET Framework Assembly Registration Utility 2.0.50727.42
Copyright (C) Microsoft Corporation 1998-2004. All rights reserved.

RegAsm : error RA0000 : An error occurred while writing the registration information to the registry. You must have administrative credentials to perform this task. Contact your system administrator for assistance

E:\Program Files\SalesLogix>SLXNetExtensionsInstall.exe Sage.SalesLogix.NetExten
sions.Core.dll

E:\Program Files\SalesLogix>SLXNetExtensionsInstall.exe Sage.SalesLogix.NetExten
sions.Framework.dll

E:\Program Files\SalesLogix>SLXNetExtensionsInstall.exe policy.7.0.Sage.SalesLog
ix.NetExtensions.Framework.dll

E:\Program Files\SalesLogix>pause
Press any key to continue . . .

****************************************************************************************
Do i require administrative credentials to perform this task

Could you please suggest me regarding this.

[Reply][Quote]
Mark Dykun
Posts: 297
 
Re: cannot open .Net form in Sales LogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Aug 07 8:15 AM
So, Lets talk Interfaces first. When an interface is implemented your componentis are saying I implement a contract and you can call the contracts known methods. An interface cannot have any code in it and is only signatures (method, properties ...) whereas inheriting a class means that the deriving class gets all of the inheritied functionality . In the instance of the BaseRunnable, the functionality and even the property SlxApplication is assigned for you and available. Basically the BaseRunnable has implemented the IRunnable interface and takes care of the initialize call for you. Since .net does not have multiple inheritance and you wanted to augment your form directly to be shown you needed the IRunnable interface, and as such you needed to manage the initialization functionality your self.

I might recommend that you lookup .net programming (VB.net or C#) and read about classes vs. interfaces. Once you get this concept under you belt things will be much better.


Make Sense?
[Reply][Quote]
Mark Dykun
Posts: 297
 
Re: cannot open .Net form in Sales LogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Aug 07 8:18 AM
You would,

I believe the registry is updated in this case. Possibly the GAC as well.

Mark
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: cannot open .Net form in Sales LogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Aug 07 8:58 AM
As Mark mentioned, the differences between an interface, such as IRunnable, and a class, such as BaseRunnable, is that the class can (and will) contain implementation code. An interface does not. So, in the case of BaseRunnable, it already has the Initialize method internally and has a class level variable called SlxApplication. Those are already built-in. When you inherit from BaseRunnable then those built in things become a part of your class as well. Does that make sense?

-Ryan
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: cannot open .Net form in Sales LogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Aug 07 9:01 AM
As Mark already mentioned, yes, you do need to have rights to the write to the registry. When that batch file is run it is registering the DLL for COM interop. This requires access to the registry.
[Reply][Quote]
Sam
Posts: 16
 
Re: cannot open .Net form in Sales LogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Aug 07 11:07 PM
Thanks....i got it now.
It was mentioned in this site that, IRunnable interface and BaseRunnable class are the entry points, but it was not mentioned that BaseRunnable class inturn implements IRunnable interface, hence its confused.
I have clear idea now about what happens when interface is implemented and what happens when class is inherited.
These forms are very useful to get the solutions for the problems and also to improve the skills.
Thanks for your support.
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: cannot open .Net form in Sales LogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Aug 07 11:13 PM
Glad we could help you get it working Sam.

-Ryan
[Reply][Quote]
Ch.V.S Praveen
Posts: 2
 
Re: cannot open .Net form in Sales LogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Aug 07 11:20 PM
Thank you very much for immediate response . Yes i will try to get admin rights for my login.



Regards,
Praveen.
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: cannot open .Net form in Sales LogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Aug 07 11:28 PM
Quote:
Originally posted by Ch.V.S Praveen

Thank you very much for immediate response . Yes i will try to get admin rights for my login.


Keep in mind, you'll only need rights to the registry to install the .NET extensions. After they are installed you won't need the elevated rights any longer. You could even get one of your IT guys to right-click the BAT file and do a "Run As" to install and be done with it.

-Ryan
[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 © 2024 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): 5/18/2024 12:33:02 AM