Reputation: 1
On my application I have a button used to save save an xlm file on specific uri indicated on my code. but I would like to give the user the possibility to save this file where he wants.
page.xaml
page.cs
private void Bt_Export_Click(object sender, RoutedEventArgs e)
{
CIRCUIT _selectedCircuit = (CIRCUIT)Lb_Circuits.SelectedItem;
busyIndicator.IsBusy = true;
this.DBContext.SaveXmlFile(_selectedCircuit.CIR_CIRCUIT, _action =>
{
if (!_action.HasError)
{
}
busyIndicator.IsBusy = false;
}, null);
}
//
public void SaveXmlFile(string XMlString)
{
XmlDocument XmlCircuit = new XmlDocument();
XmlCircuit.LoadXml(XMlString);
XmlCircuit.Save("C:/Users/izdoudou/Ciruit" + DateTime.Now.Date.ToString("yyMMddHHmm") + ".xml");
string ts= XmlCircuit.BaseURI;
}
Could you tell me if it is possible integrate this functionnality with silverlight, and how can I do it?
Kind regards,
Upvotes: 0
Views: 1242
Reputation: 860
You can use a FolderBrowserDialog
for the purpose.
string foldername=@"C:\Users\izdoudou\Ciruit";
DialogResult result = folderBrowserDialog1.ShowDialog();
if( result == DialogResult.OK )
{
folderName = folderBrowserDialog1.SelectedPath;
}
In your code change
XmlCircuit.Save("C:/Users/izdoudou/Ciruit" + DateTime.Now.Date.ToString("yyMMddHHmm") + ".xml");
to
XmlCircuit.Save(foldername +"\\"+ DateTime.Now.Date.ToString("yyMMddHHmm") + ".xml");
Hope it helps.
Upvotes: 1