FIx Marcolin Problems

This commit is contained in:
Nicola Carminati
2019-05-04 20:07:54 +02:00
parent 68c088206a
commit 690eb0e4e8
5 changed files with 51 additions and 12 deletions
+6 -3
View File
@@ -121,9 +121,11 @@ namespace Active_Client.View
if (WindowState == FormWindowState.Minimized)
{
NcWindow.ShowTaskBar();
NcWindow.MinimizeNcWindow();
NcWindow.HideNcWindow();
NcWindow.MinimizeProdWindow();
NcWindow.HideProdWindow();
}
else
{
@@ -168,14 +170,15 @@ namespace Active_Client.View
NcWindow.CloseProdWindow(false);
//Close Chromium Runtime
Close();
try
{
CfxRuntime.Shutdown();
Close();
}
catch (Exception)
{
Environment.Exit(0);
}
}
+22 -8
View File
@@ -26,15 +26,29 @@ namespace Step.NC
public CmsError GetFileInfo(string path, out InfoFile fileInfo)
{
fileInfo = new InfoFile();
// CmsError cmsError = NO_ERROR;
fileInfo = new InfoFile();
// CmsError cmsError = NO_ERROR;
// if (FileExistWithNc(path))
// cmsError = LocalPartProgramFileInfo(path, out fileInfo);
// else
// cmsError = numericalControl.FILES_RGetFileInfo(path, ref fileInfo);
CmsError cmsError = numericalControl.FILES_RGetFileInfo(path, ref fileInfo);
if (cmsError.IsError())
return cmsError;
string [] names = fileInfo.Name.Split('/');
if(names.Length > 0)
{
string name = names.Last();
if (!String.IsNullOrWhiteSpace(name))
fileInfo.PreviewBase64 = SupportFunctions.GetImageBase64String(PART_PRG_IMAGES, name);
}
// if (FileExistWithNc(path))
// cmsError = LocalPartProgramFileInfo(path, out fileInfo);
// else
// cmsError = numericalControl.FILES_RGetFileInfo(path, ref fileInfo);
return numericalControl.FILES_RGetFileInfo(path, ref fileInfo);
return NO_ERROR;
}
public bool FileExistWithNc(string path)
@@ -95,6 +95,10 @@ namespace Step.Controllers.WebApi
[Route("upload"), HttpPost]
public async Task<IHttpActionResult> UpdloadProgramWithImage()
{
bool imageUploaded = false;
string mainPPName = "";
if (!Request.Content.IsMimeMultipartContent())
{
throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
@@ -120,6 +124,8 @@ namespace Step.Controllers.WebApi
if (item.ParameterName == "main")
{
File.WriteAllBytes(TEMP_PP_FOLDER + item.FileName, item.Data);
mainPPName = item.FileName;
// Upload main program
CmsError cmsError = ncFileHandler.UploadPartProgramAndActivate(TEMP_PP_FOLDER, item.FileName, out ActiveProgramDataModel programData);
if (cmsError.IsError())
@@ -137,9 +143,23 @@ namespace Step.Controllers.WebApi
{
// Upload image
File.WriteAllBytes(PART_PRG_IMAGES + item.FileName, item.Data);
imageUploaded = true;
}
}
}
if (!imageUploaded)
{
mainPPName = Path.GetFileNameWithoutExtension(mainPPName);
string [] imgFiles = Directory.GetFiles(PART_PRG_IMAGES);
foreach(string f in imgFiles)
{
if(Path.GetFileNameWithoutExtension(f) == mainPPName)
File.Delete(f);
}
}
}
return Ok();
+3
View File
@@ -3,6 +3,7 @@ using Step.Listeners.SignalR;
using Step.Model.DTOModels;
using Step.Model.DTOModels.AlarmModels;
using System.Collections.Generic;
using System.Threading;
using TeamDev.SDK.MVVM;
using static Step.Model.Constants;
@@ -108,6 +109,8 @@ namespace Step.Listeners
// Broadcast
infos.Add(MessageServices.Current.Subscribe(BROADCAST_DATA, (a, b) =>
{
//Added sleep for the sync-error that happen sometimes during opening
Thread.Sleep(500);
SignalRListener.BroadcastData();
}));
}
@@ -123,7 +123,6 @@ export default class Production extends Vue {
}
getHeadstoolName(id) {
var r = this.getHeadsProperty(id);
console.log(r);
if(r.toolData)
return r.toolData.toolName
}