Hi,
On my form there is a NumericUpDown set to 2 decimal places and when trying to enter a number the cursor will jump to the right so I have to backspace to get the cursor into the correct position. Sometimes the cursor will stay put, other times it will jump back to the right again. If I turn the timer off in my app then there is no problem. The timer object runs in a class checking if the user is still active.
This problem is similar to: https://wisej.com/support/question/active-timer-control-causes-cursor-to-jump-in-masked-text-box
I’m running Wisej ver 1.4.65
Hi Andrew,
Your question
would it be safe to assume that database classes that inherit IDisposable are also disposed in that same cleanup process?
Session documentation
If there other objects that are referenced but are not children, they will also be disposed when the GC and their finalizer kicks in.
Although it’s a safe bet, I would use the logger to get the evidence.
Back to your comments to Frank’s answer
When a user logs into my app, I store some basic info about who is logged in for that session and also create a database instance and a logging instance to capture basic user activity and any errors.
You can use the Session object like this sample
Snippet
internal static MyPrincipal AppPrincipal { get { return Application.Session.User; } set { Application.Session.User = value; } } internal static MyIdentity CurrentUser { get { return AppPrincipal.Identity.IsAuthenticated ? AppPrincipal.Identity as MyIdentity : null; } } internal static string CurrentUserName { get { return CurrentUser != null ? "User: " + CurrentUser.UserName : "No user"; } }
replacing MyPrincipal and MyIdentity with your own classes of course. You can also store the database connection object on a session object. That way, it will be forgotten (and disposed if IDisposable is implemented) when the session expires. The same goes for the logger object, unless you prefer to use s static object that lives accross all sessions.
Hi Andrew,
WJ-8784 is fixed in the latest Wisej release (1.4.79).
Best regards
Frank
Hi Andrew,
When you set
e.Handled = true;
in the SessionTimeout handler, you can close the browser whenever you want. The application will stay alive and “in memory” until it expires. As the Session Expiration section states:
An “abandoned” session expires after twice the sessionTimeout value (in seconds) specified in Default.json or the default 120 second value.
(…)
All the windows (pages, forms, …) in the application are closed and disposed. (…) All the child controls are also disposed firing the Disposed event.
In the attached sample, I also use the Form.Closed event and the Page.Disposed event to detected session expiration and application close/unload.
But the appropriate event is the Application.ApplicationExit.
Please have a look at the attached SampleSessionTimeout sample. The file LogFile.txt will store all the information you need. If I may suggest some steps:
Please notice the MainPage Disposed message shows after the ApplicationExit message.
I think Application.ApplicationExit event answers your requirements.
Hi Andrew,
As Frank said, there is a Wisej standard functionality. You can use the SessionTimeout event
Snippet
ApplicationBase.SessionTimeout += Application_SessionTimeout;
to setup a method that takes care of everything you mention
Snippet
private static void Application_SessionTimeout(object sender, System.ComponentModel.HandledEventArgs e) { }
You can read more about Session Expiration on
Hi Andrew,
I have logged WJ-8784 for the update problems in a NumericUpDown control while a timer is active.
We´ll check and inform you when it´s fixed.
Just curious though why you need to have a timer to detect user inactivity.
This should already be available through Wisej standard functionality.
Maybe you can shed some light on this ?
Thanks in advance.
Best regards
Frank
Please login first to submit.