79 lines
2.8 KiB
C#
79 lines
2.8 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Windows;
|
|
using System.Windows.Media.Imaging;
|
|
|
|
namespace ENI2.EditControls
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for CompareExcelDialog.xaml
|
|
/// </summary>
|
|
public partial class CompareExcelDialog : Controls.StatusWindowBase
|
|
{
|
|
private string _sourcePath = null;
|
|
private string _targetPath = null;
|
|
|
|
public CompareExcelDialog()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void imageSource_Drop(object sender, DragEventArgs e)
|
|
{
|
|
string[] files = (string[]) e.Data.GetData(DataFormats.FileDrop);
|
|
foreach (string file in files)
|
|
Console.WriteLine(file);
|
|
if(files.Length > 0)
|
|
{
|
|
if(File.Exists(files[0]))
|
|
{
|
|
if(files[0].EndsWith("xls") || files[0].EndsWith("xlsx"))
|
|
{
|
|
_sourcePath = files[0];
|
|
imageSource.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_green.png"));
|
|
}
|
|
else
|
|
{
|
|
imageSource.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_yellow.png"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
imageSource.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_red.png"));
|
|
}
|
|
}
|
|
}
|
|
|
|
private void imageTarget_Drop(object sender, DragEventArgs e)
|
|
{
|
|
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
|
foreach (string file in files)
|
|
Console.WriteLine(file);
|
|
if (files.Length > 0)
|
|
{
|
|
if (File.Exists(files[0]))
|
|
{
|
|
if (files[0].EndsWith("xls") || files[0].EndsWith("xlsx"))
|
|
{
|
|
_targetPath = files[0];
|
|
imageTarget.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_green.png"));
|
|
}
|
|
else
|
|
{
|
|
imageTarget.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_yellow.png"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
imageTarget.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_red.png"));
|
|
}
|
|
}
|
|
}
|
|
|
|
private void imageSource_DragEnter(object sender, DragEventArgs e)
|
|
{
|
|
if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effects = DragDropEffects.Copy;
|
|
}
|
|
}
|
|
}
|