Example #1
0
 public void ExecuteFunctions()
 {
     paddingleft = StringFormat.FormatDoubleToIntString(RangeY.To.DoubleValue).Length * 10;
     this.ClearPaintArea();
     RefreshCoordinateAxis();
     ClearThreads();
     //LineParameters lp = new LineParameters(2, 3, 1, 2, Brushes.Red, new FunctionLiN());
     //DrawLine(lp);
     foreach (FunctionExecute fe in this.m_FunctionExecutes)
     {
         fe.Function.Reset();
         //FunctionThread t = new FunctionThread(fe, dl, GetXStart(double.Parse(fe.Range.From.ToString())), this.Dispatcher);
         FunctionThread t = new FunctionThread(fe, dl, fe.Range.From.DoubleValue, this.Dispatcher);
         if (this.OnFunctionStart != null)
         {
             t.OnFunctionStart += this.OnFunctionStart;
         }
         if (this.OnFunctionStop != null)
         {
             t.OnFunctionStop += this.OnFunctionStop;
         }
         t.Start();
         m_Threads.Add(fe.Function, t);
     }
 }
Example #2
0
        public void DrawAxisLabels()
        {
            double startX = GetX();

            // X-Koordinaten-Beschriftung
            for (int i = 1; i < 100; i++)
            {
                double x = (((startX * i) - RangeX.From.DoubleValue) * m_UnitSizeX) + paddingleft;
                if (x >= Abscissa.X1)
                {
                    // draw a horizontal Line
                    if (x >= Abscissa.X2)
                    {
                        break;
                    }
                    Line l = CreateLine(x, x, Ordinate.Y1 - 3, Ordinate.Y1 + 3);
                    AddLine(l);

                    // Draw the Text
                    TextBlock tb = CreateLabel(x, Ordinate.Y1 + 5, StringFormat.FormatDoubleToIntString(startX * i));
                    AddLabel(tb);
                    tb.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
                    Rect measureRect = new Rect(tb.DesiredSize);
                    tb.Arrange(measureRect);
                    Canvas.SetLeft(tb, Canvas.GetLeft(tb) - tb.ActualWidth / 2);
                }
            }

            double startY = GetY();

            // Y-Koordindate-Beschriftung
            for (int i = 1; i < 100; i++)
            {
                double diff = (((startY * i) - RangeY.From.DoubleValue) * m_UnitSizeY);
                if (diff >= 0)
                {
                    // Draw a vertical Line
                    double y = Ordinate.Y1 - diff;
                    if (y <= Ordinate.Y2)
                    {
                        break;
                    }
                    Line l = CreateLine(Abscissa.X1 - 3, Abscissa.X1 + 3, y, y);
                    AddLine(l);

                    // Draw the Text
                    TextBlock tb = CreateLabel(0, y, StringFormat.FormatDoubleToIntString(startY * i));
                    AddLabel(tb);
                    tb.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
                    Rect measureRect = new Rect(tb.DesiredSize);
                    tb.Arrange(measureRect);
                    Canvas.SetTop(tb, Canvas.GetTop(tb) - tb.ActualHeight / 2);
                }
            }
        }
Example #3
0
 public void DoCountPrimes(object o)
 {
     if (o != null && o.GetType() == typeof(PrimesBigInteger))
     {
         FunctionPiX func = new FunctionPiX();
         func.ShowIntermediateResult = true;
         m_refreshcount = 0;
         func.Executed += new ObjectParameterDelegate(func_Executed);
         double erg = func.Execute((o as PrimesBigInteger).DoubleValue);
         ControlHandler.SetPropertyValue(lblInfoCountPrimes, "Text", StringFormat.FormatDoubleToIntString(erg));
     }
 }
Example #4
0
        protected override void DoExecute()
        {
            FireOnStart();

            FunctionPiX      pix         = new FunctionPiX();
            PrimesBigInteger from        = m_From;
            PrimesBigInteger _counterTmp = PrimesBigInteger.Two;

            while (_counterTmp.CompareTo(from) <= 0)
            {
                double result = pix.Execute(_counterTmp.DoubleValue);
                FireOnMessage(this, from, StringFormat.FormatDoubleToIntString(result));
                _counterTmp = _counterTmp.Add(PrimesBigInteger.One);
            }

            while (from.CompareTo(m_To) <= 0)
            {
                double result = pix.Execute(from.DoubleValue);
                FireOnMessage(this, from, StringFormat.FormatDoubleToIntString(result));
                from = from.Add(PrimesBigInteger.One);
            }

            FireOnStop();
        }