private void btnLoad_Click(object sender, RoutedEventArgs e) { try { ImageBrush image = settingImage_BLO.LoadImage_Button(); ImageButton.Background = image; arrImage = settingImage_BLO.ConvertImage_ToBytes(image.ImageSource); settingImage_BLO.SaveImage_ToDB(arrImage); } catch { MessageBox.Show("Ảnh không hợp lệ", "Lỗi"); } }
private void ImageButton_Click(object sender, RoutedEventArgs e) { SettingImage_BLO settingImage_BLO = new SettingImage_BLO(); try { ImageBrush image = settingImage_BLO.LoadImage_Button(); if (image == null) { return; // Case: Open Dialog but not choose image } ImageButton.Background = image; arrImage = settingImage_BLO.ConvertImage_ToBytes(image.ImageSource); changevalue = true; } catch { MessageBox.Show("Ảnh không hợp lệ", "Lỗi"); } }