Group: Forum Members
Posts: 2K,
Visits: 6.6K
|
Well, a couple of things.
First, is the CurrentUserChanged supposed be raised if the SAME user logs back in (after a session is locked)? It seems to be. Which leads to the question, what is the difference then between the CurrentUserChanged and the AfterSessionLock events? They would seem to be fired every time a user logs back in after a session is locked.
Second, apparently I'm doing something to break session locking. It has to do with opening a form after the session is unlocked. This error occurs after the entire CurrentUserChanged event handler has run successfully. It breaks on the SessionLocking.LockSession line of code. I've isolated the issue to the opening of a form in the CurrentUserChanged event. If I let it run I get an error (shown below). If I continue on and view the SF error form, then close it, the form that is causing the problem is opened and functional. If I single step through it, there is no error. I tried Application.DoEvents(), but that didn't work (yep, that was a total shot in the dark).
Event chain (major steps that I know of):
-Click on Lock App toolstripbutton
-Click event calls the LockApp method
-LockApp method has single line of code: SessionLock.LockSession
-Forms are hidden, login form is shown
- Same user logs back in (stuff happens to login user)
- CurrentUserChanged event handler raised
- A switchboard form is shown (frm.Show)
- switchboard load event happens, loads treeview and user control into switchboard
- return from show, no errors
- return from event handler, no errors
- errors on SessionLock.LockSession
Variants:
- single step through Show method and load method, no errors
- after error and on line with error in VS, hit F5, SF error form shows, close it, form opens, no problems
- Comment out show line, no error
Here is the error I'm getting.
KeyNotFoundException
The given key was not present in the dictionary.
Source : mscorlib
Stack Trace:
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at MicroFour.StrataFrame.Security.SessionLock.LockSession()
at RAMS_MITA_2.ApplicationManager.LockApp() in D:\Projects\FoxSystems\RAMS.NET.StrataFrame\RAMS_2\RAMS_MITA_2\Modules\ApplicationManager.vb:line 240
at RAMS_MITA_2.MainForm.tsmiLockApp_Click(Object sender, EventArgs e) in D:\Projects\FoxSystems\RAMS.NET.StrataFrame\RAMS_2\RAMS_MITA_2\MainForm.vb:line 269
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
|