Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Wednesday, February 19, 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: .Net Extension running in background

Posts: 2
 
.Net Extension running in backgroundYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Nov 08 12:22 PM
Is it possible to have a SalesLogix .Net extension running in the background? I do not want my Run() method to exit since it will be logging during the duration of use but if it does not exit it locks up the entire SalesLogix application. So is there a way to do this so it doesn't lock everything up? Thanks
[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: .Net Extension running in backgroundYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Nov 08 2:55 PM
Mr Anonymous!

I believe so ... this sounds like a question for Ryan to me...

Phil
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: .Net Extension running in backgroundYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Nov 08 4:38 PM
Quote:
Originally posted by

Is it possible to have a SalesLogix .Net extension running in the background? I do not want my Run() method to exit since it will be logging during the duration of use but if it does not exit it locks up the entire SalesLogix application. So is there a way to do this so it doesn't lock everything up? Thanks


Absolutely. Basically, what you need to do is the following:

1) Ensure that your Run method does not block. That is, whatever work you do there should not be a blocking operation that doesn't return control until it is done. What I do for this type of thing is have the Run method kick off another thread that does whatever it needs to do. This way, all the Run method does is spawn the thread and that is it.

2) In SLX, you'll call Create, then Run for the extension. Save the returned guid from the create method in a global in SLX. This way, when you do eventually want to dispose of the extension, you will be able to grab it from the global and dispose of the extension. For example, you create and run your extension when SLX opens. Then you use the saved guid to dispose of it when SLX closes.

3) Make sure your extension can respond to the disposing of it so you can gracefully exit the thread.

That is about it.
-Ryan
[Reply][Quote]

Posts: 2
 
Re: .Net Extension running in backgroundYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Nov 08 7:15 PM
Ryan,

Thank you, that's exactly what I needed to know. One more question: which plugin can I put the VB code to instantiate the extension so that it is loaded after a successful login?
Thanks again
[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: .Net Extension running in backgroundYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Nov 08 10:15 PM
A global script sounds ideal for that. Create a new one and then choose a suitable event: Application_LogonComplete sounds promising.

Phil
[Reply][Quote]
Erdem
Posts: 9
 
Re: .Net Extension running in backgroundYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Dec 08 10:20 AM
Has anyone expreienced some blocking when destroy is called? When I dispose of the extension there is about a 5 second delay that is freezing up SLX . Is there a way to speed this up?
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: .Net Extension running in backgroundYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Dec 08 10:28 AM
Quote:
Originally posted by Erdem

Has anyone expreienced some blocking when destroy is called? When I dispose of the extension there is about a 5 second delay that is freezing up SLX . Is there a way to speed this up?


I've not seen that with my extensions. Could it be something your extension might be doing? Is there some process running at the time in your extension?
[Reply][Quote]
Erdem
Posts: 9
 
Re: .Net Extension running in backgroundYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Dec 08 11:18 AM
IN .NET
The following event handler is called in the .net extension

Private Sub MakeDataEntry(ByVal query As String)
If Established <> Nothing Then
Dim conn As New SqlConnection()
conn.ConnectionString = ""
conn.Open()

Dim myCommand As New SqlCommand(query, conn)
Try
myCommand.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex)
End Try

myCommand.Connection.Close()
conn.Dispose()
conn = Nothing
End If
myConnection = Nothing
MyToolkit.Disconnect()
MyToolkit = Nothing
'set the id of the net extension that was fired to a global slx variable
SlxApplication.BasicFunctions.GlobalInfoSet("DialedNetExtension", NetExtID)
'fire function to dispose of .net extension since call is complete
SlxApplication.BasicFunctions.DoInvoke("ActiveScript", "System:DisposeCall")
End Sub


IN SLX
OPTION EXPLICIT
SUB Main
' destroy the loaded .NET Extension
Dim NetExt
NetExt = Application.BasicFunctions.GlobalInfoFor("DialedNetExtension")
Application.Managed.Destroy(NetExt)
END SUB

If i throw in some message boxes the call to destry fires properly and returns a 0 (successful). Ity just takes like 5 seconds to fire.
[Reply][Quote]
Mike Groth
Posts: 2
 
Re: .Net Extension running in backgroundYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Sep 09 5:10 PM
Can this be done with a windows Form extension?

It seems like even though I put the extension on a new thread I suspect the call to this.ShowDialog(); to show the form is a blocking action and won't let focus return to SalesLogix. It runs exactly like it did when I didn't start a new thread.

Maybe I'm starting the new thread in the wrong place as I'm initiating the new thread from within the RUN method of my form class like this... Any ideas?



public partial class frmCustomDialer : Form, Sage.SalesLogix.NetExtensions.IRunnable
{
public object Run(object[] Args)
{
object ReturnValues = null;

// Create the thread object.
frmCustomDialer workerObject = new frmCustomDialer();
Thread workerThread = new Thread(workerObject.RunFree);

// Start the worker thread.
workerThread.Start();
workerObject.RunFree(Args);
...
}

public object RunFree(object[] Args)
{
object ReturnValues = null;

try
{
StartSession();

//Do all SetUp actions BEFORE calling ShowDialog.
this.ShowDialog();

//TODO: What are the return values?
ReturnValues = null;
return ReturnValues;
}
catch (Exception exc)
{
HandleExceptions(exc, "Custom SLX Dialer RUN Exception. Check Log");
return ReturnValues;
}
}
...
}
[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/19/2025 4:39:05 PM