private void Window_Loaded(object sender, RoutedEventArgs e) { try { PhotoURL.Text = ""; DriverViewModel driver = DriverLogic.GetCurrentDriver(); Currentdriver.Photo = driver.Photo; if (driver.Photo != null) { borderImage.BorderBrush = Brushes.White; ImageDriver.Source = ImageLogic.ImageFromByte(driver.Photo); } Name.Text = driver.Name; Phone.Text = driver.Telephone; Mail.Text = driver.Email; Passport.Text = driver.Passport; DateBirth.SelectedDate = driver.DateBirth; Address.Text = driver.FullAddress; AddressLife.Text = driver.AddressLife; PostCode.Text = driver.PostCode.ToString(); Company.Text = driver.Company; JobName.Text = driver.JobName; Expirience.Text = driver.DrivingExperience.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Photo_Click(object sender, RoutedEventArgs e) { try { OpenFileDialog file = new OpenFileDialog { Filter = "Изображение |*.jpg;*.png;*.jpeg;*.bmp" }; if (file.ShowDialog() == true) { PhotoURL.Text = file.FileName; ImageDriver.Source = ImageLogic.ImageFromByte(File.ReadAllBytes(file.FileName)); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }