I want to open a folder of a remote PC into the Windows files explorer :
Moreover, in other method, I'm able to read files in component.Path
folders...
So why, am I not able to open the folder into the Windows file explorer and what can I do to make it working ?
Thank you for your help.
Rémi
CodePudding user response:
I found a solution :
private void openComponentFolder_Click(object sender, RoutedEventArgs e)
{
Component component = (sender as MenuItem).DataContext as Component;
ProcessStartInfo startInfo = new ProcessStartInfo()
{
WindowStyle = ProcessWindowStyle.Hidden,
FileName = "net",
Arguments = "use " Path.Combine(ConfigMorphee.Instance.PcPath, "c$") " /user:" BenchInfos.Current.UserName " " BenchInfos.Current.PcPassword
};
Process process = new Process() { StartInfo = startInfo };
process.Start();
process.WaitForExit();
if (component != null)
{
if (Directory.Exists(component.Path))
{
try
{
Process.Start(component.Path);
}
catch (Exception ex)
{
Logger.Error("Catch MainWindow - openComponentFolder_Click ", ex);
}
}
}
}