Fix SCM/CSM UI

This commit is contained in:
Nicola Carminati
2019-04-05 12:04:27 +02:00
parent f30403560c
commit eab983d469
43 changed files with 9076 additions and 917 deletions
+15 -7
View File
@@ -30,7 +30,11 @@ namespace Step.UI
LockForm LckFrm;
[DllImport("user32.dll")]
static extern bool SetForegroundWindow(IntPtr hWnd);
static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
public ServerControlWindow()
{
@@ -50,7 +54,7 @@ namespace Step.UI
Version v = Assembly.GetEntryAssembly().GetName().Version;
DateTime buildDate = new DateTime(2000, 1, 1).AddDays(v.Build).AddSeconds(v.Revision * 2);
this.Text = "CMS-Active Control Window";
this.Text = "Active Control Window";
TXTVersion.Text = "V" + v + " ("+ buildDate.ToString("d") + ")";
PswForm = new PasswordForm();
@@ -246,7 +250,7 @@ namespace Step.UI
nc = new NcHandler();
nc.Connect();
nc.GetNcGenericData(out model);
StepNotifyIcon.Icon = Properties.Resources.CMS_Icon;
StepNotifyIcon.Icon = Properties.Resources.ACTIVE_ICONA;
TXTMachId.Text = model.CmsMachineIdNumber;
CHNcConnected.Checked = true;
PswForm.setNcData(model.CmsMachineIdNumber,nc);
@@ -260,7 +264,7 @@ namespace Step.UI
if (!IsDisposed)
Invoke((MethodInvoker)delegate ()
{
StepNotifyIcon.Icon = Properties.Resources.CMS_Disconnected;
StepNotifyIcon.Icon = Properties.Resources.ACTIVE_ICONA_BW;
TXTMachId.Text = "---";
CHNcConnected.Checked = false;
passwordToolStripMenuItem.Enabled = false;
@@ -298,10 +302,14 @@ namespace Step.UI
private static bool ClientIsRunning()
{
Process[] p = Process.GetProcessesByName(CLIENT_EXE_NAME_NOEXT);
if (p.Length > 0)
foreach(Process pr in p)
{
SetForegroundWindow(p[0].MainWindowHandle);
return true;
if (pr.MainWindowHandle != IntPtr.Zero)
{
ShowWindow(pr.MainWindowHandle, 9);
SetForegroundWindow(pr.MainWindowHandle);
return true;
}
}
return false;
}