Sicherung

This commit is contained in:
Maier Stephan SI
2023-01-29 19:58:40 +01:00
parent b684704bf8
commit 56c25672f9
10 changed files with 123 additions and 27 deletions

View File

@@ -101,14 +101,24 @@ namespace FSI.BT.Tools.Commands
CloseAtLostFocus = true,
InputData = Global.AppSettings.Rdps,
Exe = GetExeByCmdName("Rdp").ExePath,
FrmTitle = "Remotedesktopverbindungen",
};
frmRdpMain.Show();
break;
case "WebRadio":
//Lib.Guis.WebRadio.FrmMain frmWebRadio = new()
//{
// CloseAtLostFocus = false,
// InputData = Global.AppSettings.WebRadioUrls,
//};
//frmWebRadio.Show();
break;
default:
foreach (ICmd cmd in cmds)
{
if (String.Equals(parameter.ToString(), cmd.Cmd))
if (String.Equals(parameter.ToString(), cmd.Cmd))
selectedCmd = cmd;
}
break;
@@ -123,6 +133,9 @@ namespace FSI.BT.Tools.Commands
public override bool CanExecute(object parameter)
{
if (parameter == null)
return false;
var cmds = Global.AppSettings.Cmds.ToList();
ICmd selectedCmd = null;
@@ -152,6 +165,9 @@ namespace FSI.BT.Tools.Commands
case "Rdp.Mgt":
return Global.AppSettings.Rdps != null;
case "WebRadio":
return false;// Global.AppSettings.WebRadioUrls != null;
default:
foreach (ICmd cmd in cmds)
{
@@ -199,10 +215,17 @@ namespace FSI.BT.Tools.Commands
}
else
{
var selectedFileExePath = string.Empty;
if (File.Exists(Environment.ExpandEnvironmentVariables(selectedFile.ExePath.Trim())))
selectedFileExePath = Environment.ExpandEnvironmentVariables(selectedFile.ExePath.Trim());
if (File.Exists(Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), selectedFile.ExePath.Trim())))
selectedFileExePath = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), selectedFile.ExePath.Trim());
var abc = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), selectedFileExePath.Trim());
Process process = new();
process.StartInfo.FileName = Environment.ExpandEnvironmentVariables(selectedFile.ExePath);
process.StartInfo.WorkingDirectory = selectedFile.Path ?? Path.GetDirectoryName(Environment.ExpandEnvironmentVariables(selectedFile.ExePath));
process.StartInfo.Arguments = selectedFile.Arguments;
process.StartInfo.FileName = selectedFileExePath;
process.StartInfo.WorkingDirectory = selectedFile.Path ?? Path.GetDirectoryName(selectedFileExePath);
process.StartInfo.Arguments = selectedFile.Arguments ?? string.Empty;
try
{
@@ -247,9 +270,7 @@ namespace FSI.BT.Tools.Commands
foreach (var cmd in Global.AppSettings.Cmds)
{
if (string.Equals(cmd.Cmd, cmdName, StringComparison.InvariantCultureIgnoreCase))
{
return GetApp(cmd.Exe);
}
}
return null;
@@ -313,9 +334,8 @@ namespace FSI.BT.Tools.Commands
{
IntPtr handle = p.MainWindowHandle;
if (IsIconic(handle))
{
ShowWindow(handle, 9);
}
SetForegroundWindow(handle);
break;
}