Page 1 of 1

Releasing SoftPro license programatically..

Posted: Fri Oct 30, 2020 5:56 pm
by merak.marey
There is a couple of questions I want to ask:

through the sdk and using the same user, every time I open an order a license is consumed?

if so, how can I programmatically release that license to ensure greater availability for other process?

if not, does that mean that a single user log on will only consume a single license?

how the SP UI does it?


----

Here's the code I have

Code: Select all

try
            {
                NetworkCredential creds = new NetworkCredential(username, password);
                using (SelectServer ss = new SelectServer(new Uri(spserver), creds))
                {
                    string reason;

                    ss.ChooseProfile += new EventHandler<ChooseProfileEventArgs>(chooseProfile);


                    if (!ss.TryAuthenticate(out reason))
                    {
                        lastError = "SoftPro Access was denied";
                        _log.Error(lastError +". " + reason);
                        // Write login failure reason to console and exit.
                        Console.WriteLine(reason);
                        return false;
                    }
                    IOrderStore os = ss.GetService<IOrderStore>();
                }
            }
catch () {}

Re: Releasing SoftPro license programatically..

Posted: Fri Oct 30, 2020 7:49 pm
by BobRichards
Through the sdk and using the same user, every time I open an order a license is consumed?
Creating a new instance of SelectServer (SelectServer ss = new SelectServer(new Uri(...)) will consume a license. Select doesn't care that the same user has created additional SelectServer instances and will treat each instance as reserving a license. Creating a second instance of SelectServer in the same application is wasteful and unnecessary.
if so, how can I programmatically release that license to ensure greater availability for other process?
When you close the SelectServer instance, the license will be made available to others. I would think that it is available for reuse quickly.
if not, does that mean that a single user log on will only consume a single license?
As above, Select will need a license for each SelectServer instance. It doesn't matter if it is the same user credentials or not.
how the SP UI does it?
No differently. When the user closes the application, the UI closes the SelectServer instance it created when the application was started.

** Also note, there is no need to cross-post multiple message boards. I see all the messages no-matter where they are posted. **

Re: Releasing SoftPro license programatically..

Posted: Sun Nov 01, 2020 7:27 pm
by merak.marey
H Bob!

Thanks for the prompt answer, and my apologies for the multiple posts...I was getting an error from the phpBB everytime I tried to post, that's why tried different places.

So, the solution would be to only use a single instance of the SelectServer which only consume a single license...correct?

Re: Releasing SoftPro license programatically..

Posted: Mon Nov 02, 2020 10:47 am
by BobRichards
Yes. You got it.

Re: Releasing SoftPro license programatically..

Posted: Mon Nov 02, 2020 2:17 pm
by merak.marey
Thanks Bob!