ssg: wizard paths2: validation
This commit is contained in:
parent
bd331f238f
commit
80f6d25354
|
@ -88,9 +88,11 @@ namespace OpenLiveWriter.PostEditor.Configuration.Wizard
|
||||||
get { return ConfigPanelId.StaticSiteConfig; }
|
get { return ConfigPanelId.StaticSiteConfig; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool _imagesEnabled = false;
|
||||||
public bool ImagesEnabled
|
public bool ImagesEnabled
|
||||||
{
|
{
|
||||||
set => labelImagesPath.Enabled = textBoxImagesPath.Enabled = value;
|
get => _imagesEnabled;
|
||||||
|
set => _imagesEnabled = labelImagesPath.Enabled = textBoxImagesPath.Enabled = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ImagesPath
|
public string ImagesPath
|
||||||
|
@ -99,8 +101,10 @@ namespace OpenLiveWriter.PostEditor.Configuration.Wizard
|
||||||
set => textBoxImagesPath.Text = value;
|
set => textBoxImagesPath.Text = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool _buildingEnabled = false;
|
||||||
public bool BuildingEnabled
|
public bool BuildingEnabled
|
||||||
{
|
{
|
||||||
|
get => _buildingEnabled;
|
||||||
set => labelOutputPath.Enabled = textBoxOutputPath.Enabled = value;
|
set => labelOutputPath.Enabled = textBoxOutputPath.Enabled = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +122,23 @@ namespace OpenLiveWriter.PostEditor.Configuration.Wizard
|
||||||
|
|
||||||
public override bool ValidatePanel()
|
public override bool ValidatePanel()
|
||||||
{
|
{
|
||||||
|
var imagesPathFull = $"{_localSitePath}\\{ImagesPath}";
|
||||||
|
var outputPathFull = $"{_localSitePath}\\{OutputPath}";
|
||||||
|
|
||||||
|
// If images are enabled, and the images path is empty or doesn't exist, display an error
|
||||||
|
if (ImagesEnabled && (ImagesPath.Trim().Length == 0 || !Directory.Exists(imagesPathFull)))
|
||||||
|
{
|
||||||
|
ShowValidationError(textBoxImagesPath, MessageId.FolderNotFound, imagesPathFull);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If local building is enabled, and the site output path is empty or doesn't exist, display an error
|
||||||
|
if (BuildingEnabled && (OutputPath.Trim().Length == 0 || !Directory.Exists(outputPathFull)))
|
||||||
|
{
|
||||||
|
ShowValidationError(textBoxOutputPath, MessageId.FolderNotFound, outputPathFull);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue