gestione try/catch lettura file SVG da directory
This commit is contained in:
@@ -34,35 +34,40 @@ namespace NKC_WF.WebUserControls
|
||||
private void fixDataBind()
|
||||
{
|
||||
string currPath = DrawingPath;
|
||||
// in primis: fix directory
|
||||
// visibile SOLO SE valore != null...
|
||||
if (string.IsNullOrEmpty(currPath))
|
||||
try
|
||||
{
|
||||
divDrawings.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
divDrawings.Visible = true;
|
||||
List<imgData> elencoDisegni = new List<imgData>();
|
||||
// verifico path assoluto...
|
||||
if (!Path.IsPathRooted(currPath))
|
||||
// in primis: fix directory
|
||||
// visibile SOLO SE valore != null...
|
||||
if (string.IsNullOrEmpty(currPath))
|
||||
{
|
||||
currPath = Server.MapPath(currPath);
|
||||
divDrawings.Visible = false;
|
||||
}
|
||||
|
||||
// leggo da filesystem...
|
||||
string[] elencoFiles = Directory.GetFiles(currPath, "*.svg");
|
||||
if (elencoFiles != null)
|
||||
else
|
||||
{
|
||||
foreach (var item in elencoFiles)
|
||||
divDrawings.Visible = true;
|
||||
List<imgData> elencoDisegni = new List<imgData>();
|
||||
// verifico path assoluto...
|
||||
if (!Path.IsPathRooted(currPath))
|
||||
{
|
||||
elencoDisegni.Add(new imgData { imgName = Path.GetFileName(item), DrawPath = item.Replace(@"/",@"\") });
|
||||
currPath = Server.MapPath(currPath);
|
||||
}
|
||||
|
||||
// leggo da filesystem...
|
||||
string[] elencoFiles = Directory.GetFiles(currPath, "*.svg");
|
||||
if (elencoFiles != null)
|
||||
{
|
||||
foreach (var item in elencoFiles)
|
||||
{
|
||||
elencoDisegni.Add(new imgData { imgName = Path.GetFileName(item), DrawPath = item.Replace(@"/", @"\") });
|
||||
}
|
||||
}
|
||||
// sistemo repeater
|
||||
repDraw.DataSource = elencoDisegni;
|
||||
repDraw.DataBind();
|
||||
}
|
||||
// sistemo repeater
|
||||
repDraw.DataSource = elencoDisegni;
|
||||
repDraw.DataBind();
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
public class imgData
|
||||
|
||||
Reference in New Issue
Block a user