alexkolesov2002 пре 2 година
родитељ
комит
cff976b150
1 измењених фајлова са 23 додато и 1 уклоњено
  1. 23 1
      WpfApp10/MainWindow.xaml.cs

+ 23 - 1
WpfApp10/MainWindow.xaml.cs

@@ -1,5 +1,7 @@
-using System;
+using Microsoft.Win32;
+using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using System.Text;
 using System.Threading;
@@ -159,5 +161,25 @@ namespace WpfApp10
             line.Stroke = Brushes.Black;
             return line;
         }
+
+        private void ChangeDate_Click(object sender, RoutedEventArgs e)
+        {
+            OpenFileDialog ofd = new OpenFileDialog();
+            ofd.DefaultExt = ".jpg";
+            ofd.Filter = "Изображения|*.jpg;*.png;*.jpeg";
+            var result = ofd.ShowDialog();
+            string path = @".\products\";
+
+            string s = System.IO.Path.GetFullPath(path) + System.IO.Path.GetFileName(ofd.FileName); // После + идет имя файла надо добавить \products что бы добавить в базу
+            s = s.Replace(@"\bin\Debug", "");
+            System.Windows.MessageBox.Show(s);
+            File.Copy(ofd.FileName, s);
+            ofd.FileName = s;
+            if (result == true)
+            {
+                IMG.Source = BitmapFrame.Create(new Uri(ofd.FileName));
+            }
+            File.Delete(ofd.FileName); // Добавлять в крайнем случае
+        }
     }
 }