Reputation: 1
INFORMATION: I created a WPF application (.net 3.1) for some of our business locations to launch the ERP system we use as well as other tools on a kiosk computer. The ERP system runs through Microsoft Remote Desktop Client and authenticates using an account assigned to the locations. So, the user clicks the ERP button, and the MSRDC sign in window comes up to allow the user to sign in. I am using SYSTEM.IO Directory to find the shortcut added by MSRDC and of course process.Start() to start it. I added Process.StartInfo.UseShellExecute = true as this allowed the .lnk to launch. This has worked for around 6 months.
PROBLEM: On July 18th I made a background change (literally the app image backdrop) because of a change our company made. When I published and deployed the application, the method to launch our ERP system would run the catch. So, the MSRDCW client comes up and the user then has to click a second button to sign into our ERP system. One of the confuses bits (to me) is that when I test in debugging, the method works as intended. However, after publishing, this problem occurs. I am nowhere near an expert so that may not confuse you all!
Code below:
try
{
string upath = @"C:\Users\";
string[] dirs = Directory.GetDirectories(upath, "kiosk*", SearchOption.TopDirectoryOnly);
string[] timsdirs = Directory.GetDirectories($@"{dirs[0]}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\", "*timsv8*", SearchOption.TopDirectoryOnly);
string[] timsfiles = Directory.GetFiles($@"{timsdirs[0]}", "*timsv8*", SearchOption.TopDirectoryOnly);
Console.WriteLine("The number of directories within Users is {0}.", dirs.Length);
Console.WriteLine(timsfiles[0]);
Process process = new Process();
process.StartInfo.UseShellExecute = true;
process.StartInfo.FileName = timsfiles[0];
process.Start();
}
//Launches MSRDCW in the event that TIMS .lnk file cannot launch
catch (Exception)
{
Process.Start(@"C:\Program Files\Remote Desktop\msrdcw.exe");
}
If I can provide any other information, or clear anything I will certainly try my best. And I appreciate any information!
Thank you!
Upvotes: 0
Views: 111