additional enhancements to widget editor.

This commit is contained in:
DESKTOP-T0O5CDB\DESK-555BD
2024-11-04 08:37:38 -07:00
parent d6b6600ce9
commit 48f0e16fde
6 changed files with 143 additions and 1 deletions

View File

@@ -18,6 +18,8 @@ namespace CarCareTracker.Helper
int ClearUnlinkedDocuments(List<string> linkedDocuments);
string GetWidgets();
bool WidgetsExist();
bool SaveWidgets(string widgetsData);
bool DeleteWidgets();
}
public class FileHelper : IFileHelper
{
@@ -392,5 +394,35 @@ namespace CarCareTracker.Helper
{
return File.Exists(StaticHelper.AdditionalWidgetsPath);
}
public bool SaveWidgets(string widgetsData)
{
try
{
//Delete Widgets if exists
DeleteWidgets();
File.WriteAllText(StaticHelper.AdditionalWidgetsPath, widgetsData);
return true;
} catch (Exception ex)
{
_logger.LogError(ex.Message);
return false;
}
}
public bool DeleteWidgets()
{
try
{
if (File.Exists(StaticHelper.AdditionalWidgetsPath))
{
File.Delete(StaticHelper.AdditionalWidgetsPath);
}
return true;
}
catch (Exception ex)
{
_logger.LogError(ex.Message);
return false;
}
}
}
}