void drawSummer(PartialReults pr)
        {
            #region Ustawienia pomocnicze dla rysowania
            Brush b = Brushes.Black;
            int Thickness = 3;
            int marginTop = 20;
            int marginLeftRight = 20;
            int marginBottom = 50;
            int padding = 10;
            int number = pr.weights.Count;
            int space = (int)(summer.ActualWidth - 2*marginLeftRight) / (number+1);
            #endregion

            // Wyczysc poprzedni stan plotna
            summer.Children.Clear();
            if (Network.neuronEnum != null)
            {
                #region  Rysowanie trojkata sumatora
                // Linia pozioma
                Line line0 = new Line
                {
                    X1 = marginLeftRight,
                    Y1 = marginTop,
                    X2 = summer.ActualWidth - marginLeftRight,
                    Y2 = marginTop,
                    StrokeThickness = Thickness,
                    Stroke = b
                };

                // Linia z lewej na dol do srodka
                Line line1 = new Line
                {
                    X1 = marginLeftRight,
                    Y1 = marginTop,
                    X2 = summer.ActualWidth / 2,
                    Y2 = summer.ActualHeight - marginBottom - 10,
                    StrokeThickness = Thickness,
                    Stroke = b
                };

                // Prawej z lewej na dol do srodka
                Line line2 = new Line
                {
                    X1 = summer.ActualWidth - marginLeftRight,
                    Y1 = marginTop,
                    X2 = summer.ActualWidth / 2,
                    Y2 = summer.ActualHeight - marginBottom - 10,
                    StrokeThickness = Thickness,
                    Stroke = b
                };

                // Linia z wierzcholka na dol
                Line line3 = new Line
                {
                    X1 = summer.ActualWidth / 2,
                    Y1 = summer.ActualHeight - marginBottom - 10,
                    X2 = summer.ActualWidth / 2,
                    Y2 = summer.ActualHeight - marginBottom,
                    StrokeThickness = Thickness,
                    Stroke = b
                };

                // Rysuj trojkat sumatora
                summer.Children.Add(line0);
                summer.Children.Add(line1);
                summer.Children.Add(line2);
                summer.Children.Add(line3);

                // Rysuj Σ w srodku trojkata
                TextBlock sigma = new TextBlock()
                {
                    Text = "Σ",
                    HorizontalAlignment =
                    HorizontalAlignment.Center,
                    VerticalAlignment =
                    VerticalAlignment.Center,
                    FontWeight = FontWeights.Bold,
                    FontSize = 100
                };
                summer.Children.Add(sigma);
                Canvas.SetTop(sigma, marginTop - 20);
                Canvas.SetLeft(sigma, summer.ActualWidth / 2  - 30);
                #endregion

                #region rysowanie wartosci posrednich
                for (int i = 0; i < number; i++)
                {
                    TextBlock tb = new TextBlock()
                    {
                        Text = String.Format("{0:n0}*{1:n2}", pr.inputs[i],pr.weights[i]),
                        HorizontalAlignment = HorizontalAlignment.Center,
                        VerticalAlignment = VerticalAlignment.Center,
                        Background= new SolidColorBrush(getColorFromWeight((double)pr.weights[i]))

                        //FontWeight = (Network.enumerator.Current.getId() == i ? FontWeights.ExtraBold : FontWeights.Normal)
                    };
                    summer.Children.Add(tb);
                    Canvas.SetTop(tb, 0);
                    Canvas.SetLeft(tb, marginLeftRight + (i+1) * space );
                }

                TextBlock output = new TextBlock()
                {
                    Text = String.Format("sgn({0:f2}) = {1}", pr.output, (pr.output >= 0 ? 1 : -1)),
                    HorizontalAlignment =
                    HorizontalAlignment.Center,
                    VerticalAlignment =
                    VerticalAlignment.Center,
                    FontWeight = FontWeights.ExtraBold,
                    FontSize = 30,
                    Foreground = new SolidColorBrush(getColorFromWeight(pr.output))

                };
                summer.Children.Add(output);
                Canvas.SetTop(output, summer.ActualHeight - marginBottom);
                Canvas.SetLeft(output, summer.ActualWidth / 2 - 120);

                #endregion
            }
        }
 public void calculateEffectiveInput(List<Neuron> neurons, float[,] weightMatrix)
 {
     this.effectiveInput = 0;
     pr = new PartialReults(this.id);
     foreach (Neuron n in neurons)
     {
         if (this.id == n.getId()) continue;
         this.effectiveInput += weightMatrix[this.id, n.getId()] * n.getActivationState();
         this.pr.addPartialResults(n.getId(), n.getActivationState(), weightMatrix[this.id, n.getId()], this.effectiveInput);
         Debug.WriteLine(this.id + " " + n.getId() + " " + n.getActivationState() + " " + weightMatrix[this.id, n.getId()] + " " + this.effectiveInput);
     }
 }