FIx gestione starred "sovrascritta" in canceledit

This commit is contained in:
Samuele Locatelli
2020-09-22 11:16:47 +02:00
parent a7db8bd047
commit 188ce800e8
4 changed files with 17 additions and 14 deletions
@@ -10,5 +10,6 @@ namespace Thermo.Active.Model.DTOModels.ThRecipe
{
public string recipeName { get; set; } = "";
public bool hasChanged { get; set; } = false;
public bool forceSend { get; set; } = false;
}
}
+1 -3
View File
@@ -762,8 +762,6 @@ namespace Thermo.Active.NC
bool answ = false;
try
{
// indico che ora è OK x salvataggio...
RecipeLiveData.hasChanged = false;
// serialize
string rawData = JsonConvert.SerializeObject(RecipeLiveData, Newtonsoft.Json.Formatting.Indented);
// save live!
@@ -839,7 +837,7 @@ namespace Thermo.Active.NC
return SaveRecipe(RECIPE_TEMPLATE_PATH, data2save);
}
/// <summary>
/// Try to save live recipe to selected filePath
/// Try to save LIVE recipe to selected filePath
/// </summary>
public static bool SaveRecipe(string filePath, LiveData currRecipe)
{
@@ -204,7 +204,8 @@ namespace Thermo.Active.Controllers.WebApi
currParams.Add(item.Key, item.Value.SetpointHMI);
}
SaveCurrentRecipeParams(currParams);
// salvo ricetta LIVE
SaveLiveRecipeParams(currParams);
// ritorno solo fatto!
return Ok();
@@ -258,7 +259,7 @@ namespace Thermo.Active.Controllers.WebApi
}
// ora salvo ANCHE i dati live...
SaveCurrentRecipeParams(currParams);
SaveLiveRecipeParams(currParams);
// ritorno solo fatto!
return Ok();
@@ -367,7 +368,7 @@ namespace Thermo.Active.Controllers.WebApi
NcFileAdapter.SaveRecipe($"{NcAdapter.RecipeLiveData.RecipeDir}{NcAdapter.RecipeLiveData.RecipeName}", NcAdapter.RecipeLiveData);
// ora salvo ANCHE i dati live...
SaveCurrentRecipeParams(currParams);
SaveLiveRecipeParams(currParams);
// ritorno solo fatto!
return Ok();
@@ -412,19 +413,22 @@ namespace Thermo.Active.Controllers.WebApi
// e salvo su disco
NcFileAdapter.SaveRecipe(newName, NcAdapter.RecipeLiveData);
// invio copme modificata
// invio PRIMA invertendo campo modificata (x forzare invio)
DTORecipeStatus message = new DTORecipeStatus()
{
recipeName = NcAdapter.RecipeLiveData.RecipeName,
hasChanged = true
hasChanged = NcAdapter.RecipeLiveData.hasChanged,
forceSend = true
};
MessageServices.Current.Publish(SEND_THERMO_RECIPE_CHANGED, null, message);
System.Threading.Thread.Sleep(200);
// ora mando vero valore
#if false
// attesa 100ms
System.Threading.Thread.Sleep(100);
// ora mando vero valore modificata!
message.hasChanged = NcAdapter.RecipeLiveData.hasChanged;
MessageServices.Current.Publish(SEND_THERMO_RECIPE_CHANGED, null, message);
MessageServices.Current.Publish(SEND_THERMO_RECIPE_CHANGED, null, message);
#endif
// ritorno solo fatto!
return Ok();
@@ -600,7 +604,7 @@ namespace Thermo.Active.Controllers.WebApi
/// Do actual recipe parameters FileSave
/// </summary>
/// <param name="currParams"></param>
private static void SaveCurrentRecipeParams(Dictionary<string, double> currParams)
private static void SaveLiveRecipeParams(Dictionary<string, double> currParams)
{
try
{
@@ -310,7 +310,7 @@ namespace Thermo.Active.Listeners.SignalR
{
DTORecipeStatus currMessage = message as DTORecipeStatus;
if (currMessage.hasChanged != recipeHasChanged)
if (currMessage.hasChanged != recipeHasChanged || currMessage.forceSend)
{
// salvo update
recipeHasChanged = currMessage.hasChanged;