예제 #1
0
 private void btnDeleteIMG_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         ManualConnectionVM MC = this.DataContext as ManualConnectionVM;
         MC.ImageFileName = "";
         this.img.Source  = new BitmapImage();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
예제 #2
0
 private void btnImportIMG_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         System.Windows.Forms.OpenFileDialog OFD = new System.Windows.Forms.OpenFileDialog();
         OFD.Filter = "PNG files (*.png)|*.png|JPG files (*.jpg)|*.jpg|BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif|All files (*.*)|*.*";
         if (OFD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             ManualConnectionVM MC = this.DataContext as ManualConnectionVM;
             MC.ImageFileName = OFD.FileName;
             //this.img.Source = new BitmapImage(new Uri("\\bin\\Debug\\Sources\\" + OFD.FileName, UriKind.Relative));
             this.img.Source = new BitmapImage(new Uri(OFD.FileName, UriKind.Absolute));
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }