using MahApps.Metro.Controls; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; 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.Navigation; using System.Windows.Shapes; namespace Tango.FSE.UI.Dialogs { /// /// Interaction logic for ApplicationUpdateView.xaml /// public partial class JobUploadView : UserControl { private List nums; public JobUploadView() { InitializeComponent(); nums = new List(); } private void Num_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.KeyboardDevice.Modifiers == ModifierKeys.Control) { if (e.Key == Key.V) { try { DataObject o = (DataObject)Clipboard.GetDataObject(); if (o.GetDataPresent(DataFormats.Text)) { string[] cells = Regex.Split(o.GetData(DataFormats.Text).ToString().TrimEnd("\r\n".ToCharArray()), "\t"); if (cells.Length > 1) { e.Handled = true; int indexOfSender = nums.IndexOf(sender as NumericUpDown); for (int i = indexOfSender; i < nums.Count; i++) { if (i - indexOfSender < cells.Length) { if (int.TryParse(cells[i - indexOfSender], out int value)) { nums[i].Value = value; } } } } } } catch { } } } } private void NumericUpDown_Loaded(object sender, RoutedEventArgs e) { NumericUpDown num = sender as NumericUpDown; nums.Add(num); } } }