There is an image in which the picture was previously loaded, you have to click on the button to copy this image into the images folder, which lies in the folder with the file (without opening the dialog box).
I have already tried many options, I can not achieve the result ...
If you know the option better, you can write it.
FirstImagemy imagenametextfield in which the name is entered
You need at least an example of copying a previously downloaded image.
Loading pictures:
private void Donwnlimg_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.FileName = ""; // Default file name // dlg.DefaultExt = ".png"; // Default file extension dlg.Filter = "All supported graphics|*.jpg;*.jpeg;*.png|" + "JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|" + "Portable Network Graphic (*.png)|*.png"; // Filter files by extension // Show open file dialog box Nullable<bool> result = dlg.ShowDialog(); // Process open file dialog box results if (result == true) { // Open document Firstimage.Source = new BitmapImage(new Uri(dlg.FileName)); } } My attempts:
private void vnecti(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); FileStream fs = new FileStream("images//" + nametext.Text + ".jpg", FileMode.CreateNew); string stroka = fs.Name; FileInfo f = new FileInfo(nametext.Text); f.CopyTo(stroka); } 