[Mono-bugs] [Bug 343298] GTKMoonlight doesn't code behind dll associated with XAML file

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Nov 21 12:10:08 EST 2007


https://bugzilla.novell.com/show_bug.cgi?id=343298#c2





--- Comment #2 from Brock Reeve <brock.reeve at ni.com>  2007-11-21 10:10:08 MST ---
I compiled SimpleGraph.dll with the microsoft compiler using a silverlight
project. When I view the page in Firefox on linux with moon installed it works
fine. I looked at the code some and did some trouble shooting and it doesn't
even get to the point where it loads the assembly. It looks like the XML parser
is choking in the file xaml.cpp function xaml_create_from_str. Here is the
source for SimpleGraph.dll:

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Browser;

namespace SimpleGraph
{
    public partial class Page : Canvas
    {
        private const int SampleCount = 500;
        private const int Frequency = 2;
        private Random _rand;
        private HtmlTimer _timer;

        private Point[] GenerateSineWave()
        {
            Point[] data = new Point[SampleCount];
            for (int x = 0; x < SampleCount; x++)
            {
                double y = Math.Sin((((x*Frequency) / (double)SampleCount) *
Math.PI * 2)) * 7;
                double noise = (_rand.NextDouble() * 4) - 2;
                data[x].X = MapX(x);
                data[x].Y = MapY(y + noise);
            }

            return data;
        }

        private int Map(double value, double rangeMin, double rangeMax, double
deviceMin, double deviceMax)
        {
            return (int)((((value - rangeMin) / (rangeMax - rangeMin)) *
(deviceMax - deviceMin)) + deviceMin);
        }

        private int MapX(double value)
        {
            return Map(value, 0, SampleCount, 0, plotArea.Width);
        }

        private int MapY(double value)
        {
            return Map(value, -10, 10, 0, plotArea.Height);
        }

        public void Page_Loaded(object o, EventArgs e)
        {
            // Required to initialize variables
            InitializeComponent();

            _timer = new HtmlTimer();
            _timer.Interval = 10;
            _timer.Tick += new EventHandler(TimerTick);
            _timer.Start();

            _rand = new Random();
            PolyLineSegment segment = figure.Segments[0] as PolyLineSegment;
            Point[] points = GenerateSineWave();
            figure.StartPoint = points[0];
            segment.Points = points;
        }

        private void TimerTick(object sender, EventArgs e)
        {
            PolyLineSegment segment = figure.Segments[0] as PolyLineSegment;
            Point[] points = GenerateSineWave();
            figure.StartPoint = points[0];
            segment.Points = points;
        }


        private void OnStart(object sender, MouseEventArgs e)
        {
            _timer.Start();
        }

        private void OnStop(object sender, MouseEventArgs e)
        {
            _timer.Stop();
        }
    }
}


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list