Fix Client stuffs

This commit is contained in:
Nicola Carminati
2019-04-16 16:32:25 +02:00
parent cab9a446d8
commit 330cfb68a1
7 changed files with 83 additions and 56 deletions
+27 -10
View File
@@ -124,7 +124,17 @@ namespace Active_Client.Browser_Tools
return;
//Invoke method if is needed or call the method in STD mode
mainForm.Close();
//Invoke method if is needed or call the method in STD mode
if (mainForm.InvokeRequired)
mainForm.Invoke((MethodInvoker)delegate ()
{
mainForm.sendClose();
});
else
{
mainForm.sendClose();
}
}
// Reload Broken Page
@@ -320,7 +330,7 @@ namespace Active_Client.Browser_Tools
if (drive.IsReady)
drivelist.Add(new Drive()
{
Name = ElaborateName(drive.VolumeLabel, drive.DriveType),
Name = ElaborateName(drive.VolumeLabel,drive.Name, drive.DriveType),
Path = drive.RootDirectory.ToString(),
Type = ElaborateType(drive.DriveType)
});
@@ -328,7 +338,7 @@ namespace Active_Client.Browser_Tools
drivelist.Add(new Drive()
{
Name = ElaborateName("Desktop", DriveType.Unknown),
Name = ElaborateName("Desktop", "", DriveType.Unknown),
Path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\",
Type = "SPFO"
});
@@ -337,7 +347,7 @@ namespace Active_Client.Browser_Tools
{
drivelist.Add(new Drive()
{
Name = ElaborateName("PartPrg", DriveType.Unknown),
Name = ElaborateName("PartPrg", "", DriveType.Unknown),
Path = PART_PRG_FOLDER + "\\",
Type = "SPFO"
});
@@ -618,20 +628,27 @@ namespace Active_Client.Browser_Tools
}
// Private functions
private String ElaborateName(String name, DriveType type)
private String ElaborateName(String name, String letter, DriveType type)
{
var retName = "";
if (!String.IsNullOrWhiteSpace(name))
return name;
retName = name;
else
{
switch (type)
{
case DriveType.Fixed: return "Hard_Disk";
case DriveType.Removable: return "Usb_Disk";
case DriveType.Network: return "Netword_Disk";
case DriveType.Fixed: retName = "Hard_Disk";break;
case DriveType.Removable: retName = "Usb_Disk"; break;
case DriveType.Network: retName = "Netword_Disk"; break;
default: retName = "Undefined"; break;
}
return "Undefined Drive";
}
if (!String.IsNullOrWhiteSpace(letter))
retName = retName + " (" + letter + ")";
return retName;
}
private String ElaborateType(DriveType type)
+1 -1
View File
@@ -188,7 +188,7 @@ namespace Active_Client
e.Settings.CachePath = Constants.BROWSER_CACHE_FOLDER;
e.Settings.LocalesDirPath = Constants.CEF_LOCALES_PATH;
e.Settings.ResourcesDirPath = CfxRuntime.LibCefDirPath;
e.Settings.Locale = CultureInfo.InstalledUICulture.TwoLetterISOLanguageName ;
e.Settings.Locale = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName ;
}
+39 -43
View File
@@ -150,53 +150,49 @@ namespace Active_Client.View
}
public void sendClose()
{
//Show Taskbar
NcWindow.ShowTaskBar();
//Close Virtual Keyboard Runtime
if (Config.ClientConfig.ShowVirtualKeyboard && Environment.OSVersion.Version.Major < 10)
NcWindow.closeVirtualKeyboard();
//Close the NC HMI && Stop Following Nc
if (Config.VendorHmiConfig.Enabled)
NcWindow.CloseNcWindow(false);
//Close Server
if (Config.ClientConfig.Autorun)
{
Process[] proc = Process.GetProcessesByName("Active");
foreach (Process p in proc)
{
p.Kill();
p.WaitForExit();
}
}
if (Config.ProdSoftwareConfig.Enabled)
NcWindow.CloseProdWindow(false);
//Close Chromium Runtime
try
{
CfxRuntime.Shutdown();
Close();
}
catch (Exception)
{
}
}
//Before closing the Window -> Remove the Browser (Increase the speed of closing window)
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
//Invoke method if is needed or call the method in STD mode
if (!IsDisposed)
{
//Show Taskbar
NcWindow.ShowTaskBar();
//Hide Window
Hide();
//Close Virtual Keyboard Runtime
if (Config.ClientConfig.ShowVirtualKeyboard && Environment.OSVersion.Version.Major < 10)
NcWindow.closeVirtualKeyboard();
//Close the NC HMI && Stop Following Nc
if (Config.VendorHmiConfig.Enabled)
NcWindow.CloseNcWindow(false);
//Close Server
if (Config.ClientConfig.Autorun)
{
Process[] proc = Process.GetProcessesByName("Active");
foreach(Process p in proc)
{
p.Kill();
p.WaitForExit();
}
}
if (Config.ProdSoftwareConfig.Enabled)
NcWindow.CloseProdWindow(false);
//Close Chromium Runtime
try
{
CfxRuntime.Shutdown();
}
catch (Exception)
{
}
}
}
#endregion
+14 -2
View File
@@ -256,6 +256,10 @@ namespace Active_Client.View
RemoveFrameBorder(ncprocess.MainWindowHandle);
//Maximize Window if is Osai
if (Config.VendorHmiConfig.Type == 3)
ShowWindow(ncprocess.MainWindowHandle, SW_SHOWMAXIMIZED);
return 0;
}
@@ -1404,8 +1408,16 @@ namespace Active_Client.View
//Show Task Bar
ShowTaskBar();
//Exit from Application
Environment.Exit(0);
//Exit from Application
if (mainFrm.InvokeRequired)
mainFrm.Invoke((MethodInvoker)delegate ()
{
mainFrm.sendClose();
});
else
{
mainFrm.sendClose();
}
}
Thread.Sleep(1000);
Binary file not shown.
+1
View File
@@ -572,6 +572,7 @@
<modal_load_program_creation_date>Data di creazione:</modal_load_program_creation_date>
<modal_load_program_last_change_date>Data di ult. mod:</modal_load_program_last_change_date>
<modal_load_program_lbl_img_not_found>Preview non disponibile</modal_load_program_lbl_img_not_found>
<modal_load_program_lbl_upload_all_files>Carica tutti i file nella cartella selezionata</modal_load_program_lbl_upload_all_files>
<!-- Alarm-History Manager -->
<alarm_history_filter_nc>NC</alarm_history_filter_nc>
+1
View File
@@ -570,6 +570,7 @@
<modal_load_program_creation_date>Creation Date:</modal_load_program_creation_date>
<modal_load_program_last_change_date>Last change Date:</modal_load_program_last_change_date>
<modal_load_program_lbl_img_not_found>Preview not available</modal_load_program_lbl_img_not_found>
<modal_load_program_lbl_upload_all_files>Upload all files in selected folder</modal_load_program_lbl_upload_all_files>
<!-- Alarm-History Manager -->
<alarm_history_filter_nc>NC</alarm_history_filter_nc>