<commit_before>﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
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;
using DotNetSiemensPLCToolBoxLibrary.Communication;

namespace ExampleWPFVisualization
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private DotNetSiemensPLCToolBoxLibrary.Communication.PLCConnection myConn = null;
        public MainWindow()
        {
            InitializeComponent();
        }

        private void cmdConfig_Click(object sender, RoutedEventArgs e)
        {
            DotNetSiemensPLCToolBoxLibrary.Communication.Configuration.ShowConfiguration("ExampleWPFVisualization", true);
        }

        private void cmdConnect_Click(object sender, RoutedEventArgs e)
        {
            List<PLCTag> Tags=new List<PLCTag>();
            foreach (DictionaryEntry dictionaryEntry in this.Resources)
            {
                if (dictionaryEntry.Value is PLCTag)
                    Tags.Add((PLCTag) dictionaryEntry.Value);
            }
            
            myConn = new PLCConnection("ExampleWPFVisualization");
            myConn.Connect();

            BackgroundWorker worker = new BackgroundWorker();

            worker.DoWork += delegate(object s, DoWorkEventArgs args)
                                 {
                                     while (true)
                                     {
                                         myConn.ReadValues(Tags);
                                     }
                                 };

            worker.RunWorkerAsync();
        }

        private void PLCTag_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (myConn != null)
                if (e.PropertyName == "Controlvalue")
                    myConn.WriteValue((PLCTag) sender);
        }

      
    }
}<commit_msg>Comments<commit_after>﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
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;
using DotNetSiemensPLCToolBoxLibrary.Communication;

namespace ExampleWPFVisualization
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private DotNetSiemensPLCToolBoxLibrary.Communication.PLCConnection myConn = null;
        public MainWindow()
        {
            InitializeComponent();
        }

        private void cmdConfig_Click(object sender, RoutedEventArgs e)
        {
            //Verbindung konfigurieren
            DotNetSiemensPLCToolBoxLibrary.Communication.Configuration.ShowConfiguration("ExampleWPFVisualization", true);
        }

        private void cmdConnect_Click(object sender, RoutedEventArgs e)
        {
            //Alle Tags in eine Liste packen
            List<PLCTag> Tags=new List<PLCTag>();
            foreach (DictionaryEntry dictionaryEntry in this.Resources)
            {
                if (dictionaryEntry.Value is PLCTag)
                    Tags.Add((PLCTag) dictionaryEntry.Value);
            }
            
            //Verbindungskonfig laden und Verbinden
            myConn = new PLCConnection("ExampleWPFVisualization");
            myConn.Connect();

            //Tags im Hintergrund laden
            BackgroundWorker worker = new BackgroundWorker();
            worker.DoWork += delegate(object s, DoWorkEventArgs args)
                                 {
                                     while (true)
                                     {
                                         myConn.ReadValues(Tags);
                                     }
                                 };

            worker.RunWorkerAsync();
        }

        private void PLCTag_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            //Bei Änderung des Controlvalue eines Tags, den Tag in die SPS schreiben
            if (myConn != null)
                if (e.PropertyName == "Controlvalue")
                    myConn.WriteValue((PLCTag) sender);
        }

      
    }
}
{'fraction_non_alphanumeric': 0.07702154896522295, 'fraction_numerical': 0.0, 'mean_word_length': 1.8309178743961352, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6803813', 'n_tokens_mistral': 1166, 'n_tokens_neox': 1117, 'n_words': 250}