Hi,
I'm trying to create a path where I would save the newly created layers, but I have a problem with how to enter the path to the folder that contains the file I'm copying but I want to rename it. It occurred to me to cut it off, but it's always a different name.
For example, the path to the file is: C:\Users\Documents\ArcGIS\Projects\test\Klady.gdb
And I would need: C:\Users\Documents\ArcGIS\Projects\test\
But if it were:C:\Users\Documents\ArcGIS\Projects\bodyTest\testovaci.gdb
so the same Substring or Remove will no work
What I have tried:
Here I choose which folder I am copying:
private void hledatCestu_Click(object sender, RoutedEventArgs e)
{
using (var fbd = new FolderBrowserDialog())
{
DialogResult result = fbd.ShowDialog();
if (result == System.Windows.Forms.DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
{
string[] files = Directory.GetFiles(fbd.SelectedPath);
Application.Current.Dispatcher.Invoke(() => { cestaText.Text = fbd.SelectedPath.ToString(); });
}
}
}
Here is a separate copy:
<pre lang="C#">protected async void OK_Click(object sender, RoutedEventArgs e)
{
MapView mapView = MapView.Active;
await QueuedTask.Run(async () =>
{
Application.Current.Dispatcher.Invoke(() =>
{
_cesta = cestaText.Text;
_vysledny = vyslednySystem.Text;
});
if (!Directory.Exists(_cesta))
{
MessageBox.Show("Zadaná cesta neexistuje.");
Application.Current.Dispatcher.Invoke(() =>
{
cestaText.Text=String.Empty;
});
}
else
{
var novaCesta = _cesta.Remove(_cesta.Length - 9);
object[] parameterList = {novaCesta, @"ETRS"};
await StartATask("management.CreateFileGDB", parameterList);
...
I will be happy for any advice and help
Thank you
David