diff --git a/Client.Utils/Constants.cs b/Client.Utils/Constants.cs index 2706c541..fd3d4d0b 100644 --- a/Client.Utils/Constants.cs +++ b/Client.Utils/Constants.cs @@ -79,6 +79,8 @@ namespace Client.Utils public const string ConfigPage = "api/configuration/client"; public const string errorPageUrl = @"error://error/"; + public const string RECENT_FILE_PATH = ".active.list"; + public static string[] JOB_EXTENSIONS = { ".job", ".zip" }; } } diff --git a/Client/Browser_Tools/BrowserJSObject.cs b/Client/Browser_Tools/BrowserJSObject.cs index 97a9ad90..97558fd7 100644 --- a/Client/Browser_Tools/BrowserJSObject.cs +++ b/Client/Browser_Tools/BrowserJSObject.cs @@ -387,7 +387,7 @@ namespace Active_Client.Browser_Tools Name = ElaborateName(queryObj["VolumeName"].ToString(), queryObj["Name"].ToString(), DriveType.Network), Path = queryObj["Name"].ToString(), Type = ElaborateType(DriveType.Network) - }); + }); } } @@ -819,7 +819,7 @@ namespace Active_Client.Browser_Tools stringBuilder.Append(stringVal); } - File.WriteAllLines(".active.list", stringBuilder.ToString() + File.WriteAllLines(RECENT_FILE_PATH, stringBuilder.ToString() .Split( new[] { Environment.NewLine }, StringSplitOptions.None @@ -880,10 +880,10 @@ namespace Active_Client.Browser_Tools private List GetLastUploadedFiles() { - if (!File.Exists(".active.list")) + if (!File.Exists(RECENT_FILE_PATH)) return new List(); - string[] fileEntries = File.ReadAllLines(".active.list"); + string[] fileEntries = File.ReadAllLines(RECENT_FILE_PATH); List files = new List(); foreach (string row in fileEntries) diff --git a/Client/View/NcWindow.cs b/Client/View/NcWindow.cs index 753edd93..75daa2e3 100644 --- a/Client/View/NcWindow.cs +++ b/Client/View/NcWindow.cs @@ -681,11 +681,7 @@ namespace Active_Client.View //Stop following Nc Window (bring-to-font the main window) -> ONLY FOR OSAI System! public static void StopNcFollowing() - { - //Un-parent the window - if ((Config.VendorHmiConfig.Type == 2) && ncprocess.MainWindowHandle != IntPtr.Zero) - SetParent(ncprocess.MainWindowHandle, IntPtr.Zero); - + { //Detach the hook if (hhook != IntPtr.Zero) UnhookWinEvent(hhook); @@ -693,11 +689,15 @@ namespace Active_Client.View if (hhookWindow != IntPtr.Zero) UnhookWinEvent(hhookWindow); - FollowingFocus = false; - if (keybhook != IntPtr.Zero) UnhookWindowsHookEx(keybhook); + //Un-parent the window + if ((Config.VendorHmiConfig.Type == 2) && ncprocess.MainWindowHandle != IntPtr.Zero) + SetParent(ncprocess.MainWindowHandle, IntPtr.Zero); + + FollowingFocus = false; + //Stop the Image-Capture Thread if (CaptureThread != null) CaptureThread.Abort(); diff --git a/Step.Config/Config/cmsConnectConfig.xml b/Step.Config/Config/cmsConnectConfig.xml index 0fe16b37..e3209d05 100644 --- a/Step.Config/Config/cmsConnectConfig.xml +++ b/Step.Config/Config/cmsConnectConfig.xml @@ -1,7 +1,7 @@  - true + false
192.168.214.200
gsHOP9H9aJHqgVzxruZg/T3XiZ9AfS1NdS/y/JFl05y8nCY9rmrCssxSONSyN/xkkLRvEcEYd/kf0HrluGX6MGrv8qLlCIIZXS6uKQNz7mtG4HokLFqIrHKdu3u3P6jI diff --git a/Step.Model/ConfigModels/ServerConfigModel.cs b/Step.Model/ConfigModels/ServerConfigModel.cs index e7da4c0e..f988dbc3 100644 --- a/Step.Model/ConfigModels/ServerConfigModel.cs +++ b/Step.Model/ConfigModels/ServerConfigModel.cs @@ -21,6 +21,6 @@ namespace Step.Model.ConfigModels public string MTCApplicationName { get; set; } public int MaxAlarmsRows { get; set; } - public int AlarmToDelete { get; set; } + public int AlarmToDelete { get; set; } } } \ No newline at end of file diff --git a/Step.Model/Constants.cs b/Step.Model/Constants.cs index fb16ec81..537142d5 100644 --- a/Step.Model/Constants.cs +++ b/Step.Model/Constants.cs @@ -199,6 +199,7 @@ namespace Step.Model public const string SCADA_PAGES_SCHEMA_PATH = RESOURCE_DIRECTORY + "scadaValidator.xsd"; public static string CANDY_DUMMYFILE_PATH = BASE_PATH + "\\dll.dll"; + public static string PARTPRG_LIST_FILE = "activePP.list"; // MVVM Messages to server UI public const string SEND_STOP_SERVER = "STOP_SERVER"; diff --git a/Step/Controllers/WebApi/NcFileController.cs b/Step/Controllers/WebApi/NcFileController.cs index 562f4fb4..9ba58138 100644 --- a/Step/Controllers/WebApi/NcFileController.cs +++ b/Step/Controllers/WebApi/NcFileController.cs @@ -127,13 +127,14 @@ namespace Step.Controllers.WebApi if (item.ParameterName == "main") { File.WriteAllBytes(TEMP_PP_FOLDER + item.FileName, item.Data); - mainPPName = item.FileName; programs.Add(item.FileName); // Upload main program CmsError cmsError = ncFileHandler.UploadPartProgramAndActivate(TEMP_PP_FOLDER, item.FileName, out programData); if (cmsError.IsError()) return BadRequest(cmsError.localizationKey); + + mainPPName = Path.GetFileNameWithoutExtension(programData.Path); } else if (item.ParameterName == "file") { @@ -147,8 +148,21 @@ namespace Step.Controllers.WebApi } else if (item.ParameterName == "image") { + // Delete duplicated images + string[] imgFiles = Directory.GetFiles(PART_PRG_IMAGES); + foreach (string f in imgFiles) + { + if (Path.GetFileNameWithoutExtension(f) == mainPPName) + File.Delete(f); + } + // Upload image - File.WriteAllBytes(PART_PRG_IMAGES + Path.GetFileNameWithoutExtension(programData.Path) + Path.GetExtension(item.FileName), item.Data); + File.WriteAllBytes( + PART_PRG_IMAGES + // Path + mainPPName + // Part program name + Path.GetExtension(item.FileName), // Extension of the image + item.Data); + imageUploaded = true; } } @@ -156,7 +170,7 @@ namespace Step.Controllers.WebApi if (!imageUploaded) { - mainPPName = Path.GetFileNameWithoutExtension(mainPPName); + // Delete old images with the same name of the main program string[] imgFiles = Directory.GetFiles(PART_PRG_IMAGES); foreach (string f in imgFiles) { @@ -169,7 +183,7 @@ namespace Step.Controllers.WebApi if (NcConfig.NcVendor != NC_VENDOR.OSAI) { List lines = new List(); - string outputFileName = NcConfig.SharedPath + "activePP.list"; + string outputFileName = NcConfig.SharedPath + PARTPRG_LIST_FILE; foreach (string prog in programs) { @@ -196,7 +210,7 @@ namespace Step.Controllers.WebApi return Ok(true); else { - string fileName = NcConfig.SharedPath + "activePP.list"; + string fileName = NcConfig.SharedPath + PARTPRG_LIST_FILE; int count = Directory.GetFiles(NcConfig.SharedPath).Length; if (!File.Exists(fileName) && count == 0) @@ -250,12 +264,12 @@ namespace Step.Controllers.WebApi public IHttpActionResult BackupSharedFolder() { if (NcConfig.NcVendor == NC_VENDOR.OSAI) - return Ok(true); + return Ok(true); else { string newFolder = "C:\\Backup_" + new DirectoryInfo(NcConfig.SharedPath).Name + "\\" + DateTime.Now.ToString("dd-MM-yyyy_HH-mm-ss") + "\\"; - File.Delete(NcConfig.SharedPath + "activePP.list"); + File.Delete(NcConfig.SharedPath + PARTPRG_LIST_FILE); Directory.CreateDirectory(newFolder); foreach (string filename in Directory.GetFiles(NcConfig.SharedPath)) { diff --git a/Step/wwwroot/assets/styles/base/card.less b/Step/wwwroot/assets/styles/base/card.less index ca281a3a..a8dbf3ea 100644 --- a/Step/wwwroot/assets/styles/base/card.less +++ b/Step/wwwroot/assets/styles/base/card.less @@ -295,7 +295,7 @@ margin-right: 20px; .fa-arrow-up, - .fa-arrow-down { + .fa-arrow-down { font-size: 24px; } diff --git a/Step/wwwroot/src/services/hub.ts b/Step/wwwroot/src/services/hub.ts index 13bdcfa3..e64deaee 100644 --- a/Step/wwwroot/src/services/hub.ts +++ b/Step/wwwroot/src/services/hub.ts @@ -143,7 +143,7 @@ export class Hub { processModelActions.setCurrentProgramName(store, r.name); }); } - else if (data.path == "") { + else if (!data.path) { processModelActions.setCurrentProgramImage(store, null); processModelActions.setCurrentProgramName(store, null); }