Exemplo n.º 1
0
        private void CSVMenuItem_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.CheckFileExists = true;
            ofd.Filter          = "CSV-Dateien|*.csv";
            var res = ofd.ShowDialog();

            if (res == System.Windows.Forms.DialogResult.OK)
            {
                string[] lines = System.IO.File.ReadAllLines(ofd.FileName);
                foreach (string line in lines)
                {
                    try
                    {
                        TLookup.Add(line.Split(',')[0], int.Parse(line.Split(',')[1]));
                    }
                    catch (Exception ex)
                    {
                        Logging.Log.Instance.Warn("Adding csv based transponder failed:");
                        Logging.Log.Instance.Error(ex.ToString());
                    }
                }
            }
            MenuItem_Click(sender, e);
        }
Exemplo n.º 2
0
        private void ClearMenuItem_Click(object sender, RoutedEventArgs e)
        {
            var mbr = System.Windows.MessageBox.Show("Wirklich alle Transpondercodes löschen?", "Warnung", MessageBoxButton.YesNo, MessageBoxImage.Warning);

            if (mbr == MessageBoxResult.Yes)
            {
                TLookup.Clear();
            }
            MenuItem_Click(sender, e);
        }
Exemplo n.º 3
0
        private void AddMenuItem_Click(object sender, RoutedEventArgs e)
        {
            var  ted = new TransponderEntryDialog();
            bool?res = ted.ShowDialog();

            if (res.HasValue && res.Value)
            {
                TLookup.Add(ted.Code, ted.Startnummer);
            }
            MenuItem_Click(sender, e);
        }
Exemplo n.º 4
0
        private void RemoveMeuItem_Click(object sender, RoutedEventArgs e)
        {
            var  ted = new TransponderEntryDialog();
            bool?res = ted.ShowDialog();

            if (res.HasValue && res.Value)
            {
                if (!string.IsNullOrWhiteSpace(ted.Code))
                {
                    TLookup.Remove(ted.Code);
                }
                else if (ted.Startnummer != 0)
                {
                    TLookup.Remove(ted.Startnummer);
                }
            }
            MenuItem_Click(sender, e);
        }
Exemplo n.º 5
0
 private void MenuItem_Click(object sender, RoutedEventArgs e)
 {
     DataOutput.ItemsSource   = TLookup.List();
     LastUpdateStatus.Content = DateTime.Now.ToLongTimeString() + " " + DateTime.Now.ToShortDateString();
 }