the Save SVG button now prompts a form to select the folder
This commit is contained in:
@@ -471,7 +471,22 @@ namespace Paint_2
|
|||||||
|
|
||||||
private void btnSvgExport_Click(object sender, EventArgs e)
|
private void btnSvgExport_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Project.ConvertToSVG();
|
FolderBrowserDialog fbd = new FolderBrowserDialog();
|
||||||
|
fbd.Description = "Custom Description";
|
||||||
|
|
||||||
|
if (fbd.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
string SelectedPath = fbd.SelectedPath;
|
||||||
|
|
||||||
|
if (Project.SaveSvg(SelectedPath,tbxProjectName.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Svg saved at "+ SelectedPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Ooops, could not save the SVG in " + SelectedPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -417,7 +417,7 @@ namespace Paint_2
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ConvertToSVG()
|
public string ConvertToSVG()
|
||||||
{
|
{
|
||||||
string fileContent = "";
|
string fileContent = "";
|
||||||
string newLine = Environment.NewLine;
|
string newLine = Environment.NewLine;
|
||||||
@@ -434,6 +434,20 @@ namespace Paint_2
|
|||||||
|
|
||||||
fileContent += newLine;
|
fileContent += newLine;
|
||||||
fileContent += "</svg>";
|
fileContent += "</svg>";
|
||||||
|
return fileContent;
|
||||||
|
}
|
||||||
|
public bool SaveSvg(string path,string fileName)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
if (Directory.Exists(path))
|
||||||
|
{
|
||||||
|
using (StreamWriter sw = File.CreateText(path + "\\" + fileName + ".svg"))
|
||||||
|
{
|
||||||
|
sw.WriteLine(ConvertToSVG());
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user