ProjetThe/ProjetTheAlone/View/FicEncodePlat.xaml.cs

62 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.IO;
using Microsoft.Win32;
using ProjetTheAlone.Classes;
namespace ProjetTheAlone
{
/// <summary>
/// Logique d'interaction pour FicEncodePlat.xaml
/// </summary>
public partial class FicEncodePlat : Window
{
public FicEncodePlat()
{
InitializeComponent();
DataContext = new ViewModel.VM_Plat();
}
private void BtnQuitter_Click(object sender, RoutedEventArgs e)
{
Close();
}
private void btnOpenFile_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "Image files (*.png;*.jpeg)|*.png;*.jpeg|All files (*.*)|*.*";
if (openFileDialog.ShowDialog() == true)
{
string FileName = openFileDialog.FileName;
txtEditor.Text = FileName;
//FileStream fs = new System.IO.FileStream(@""+FileName+"", FileMode.Open, FileAccess.Read);
//BinaryReader br = new BinaryReader(fs);
//byte[] result = br.ReadBytes((int)fs.Length);
ImageFile.Source = new BitmapImage(new Uri(@"" + FileName + ""));
}
}
private void TypePlat_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (DataContext != null)
((ViewModel.VM_Plat)DataContext).UnPlat.TypePlat = (C_T_plat.TypePlat_E)Enum.Parse(typeof(C_T_plat.TypePlat_E), this.TypePlat.Text);
}
}
}