So I really need to prevent users from opening one of our custom NAV2016 pages more than once.
The page is in direct communications with a PLC controller and if it's opened (by accident) more than once causes issues.
If you open (for example) the General Journal multiple times it looks like this in the Task Manager:
Using the DotNet variables I am able to detect the Microsoft.Dynamics.Nav.Client, but I am unable to see each of the 7 processes to detect that the General Journal - CORR-Correction is opened 6 times.
Code:
Process := Process.GetCurrentProcess;
MySession := Process.SessionId;
MyProcessList := process.GetProcessesByName('Microsoft.Dynamics.Nav.Client');
lfile.TEXTMODE := TRUE;
lFile.WRITEMODE := TRUE;
lFile.CREATE('TestOutput.txt');
FOR I:=0 TO (MyProcessList.Length()-1) DO
BEGIN
Process := MyProcessList.GetValue(I);
IF MySession = Process.SessionId THEN
lFile.write('Process ID: ' + FORMAT(Process.Id) + ' MainWindowTitle: ' + Process.MainWindowTitle + ' Process: ' + Process.ToString);
END;
lFile.CLOSE;
Output File:
Process ID: 6764 MainWindowTitle: Edit - General Journal - CORR-Correction Process: System.Diagnostics.Process (Microsoft.Dynamics.Nav.Client)
Now it appears as though it has returned the correct result, but all it has done is returned the first page.. If I opened the Item Card and ran my routine I'd see the Item Card and not the other 7 pages running the General Journal.
Anyone have any luck returning the grouped processes?
Thanks in advance,
John
The page is in direct communications with a PLC controller and if it's opened (by accident) more than once causes issues.
If you open (for example) the General Journal multiple times it looks like this in the Task Manager:
Using the DotNet variables I am able to detect the Microsoft.Dynamics.Nav.Client, but I am unable to see each of the 7 processes to detect that the General Journal - CORR-Correction is opened 6 times.
Code:
Process := Process.GetCurrentProcess;
MySession := Process.SessionId;
MyProcessList := process.GetProcessesByName('Microsoft.Dynamics.Nav.Client');
lfile.TEXTMODE := TRUE;
lFile.WRITEMODE := TRUE;
lFile.CREATE('TestOutput.txt');
FOR I:=0 TO (MyProcessList.Length()-1) DO
BEGIN
Process := MyProcessList.GetValue(I);
IF MySession = Process.SessionId THEN
lFile.write('Process ID: ' + FORMAT(Process.Id) + ' MainWindowTitle: ' + Process.MainWindowTitle + ' Process: ' + Process.ToString);
END;
lFile.CLOSE;
Output File:
Process ID: 6764 MainWindowTitle: Edit - General Journal - CORR-Correction Process: System.Diagnostics.Process (Microsoft.Dynamics.Nav.Client)
Now it appears as though it has returned the correct result, but all it has done is returned the first page.. If I opened the Item Card and ran my routine I'd see the Item Card and not the other 7 pages running the General Journal.
Anyone have any luck returning the grouped processes?
Thanks in advance,
John