PageRenderTime 20ms CodeModel.GetById 11ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 1ms

/Main/src/DevSamples/TiledRenderingSample/Window1.xaml.cs

#
C# | 59 lines | 39 code | 5 blank | 15 comment | 1 complexity | c71b707888243c60d15f1c55d7096950 MD5 | raw file
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using System.Text;
 5using System.Windows;
 6using System.Windows.Controls;
 7using System.Windows.Data;
 8using System.Windows.Documents;
 9using System.Windows.Input;
10using System.Windows.Media;
11using System.Windows.Media.Imaging;
12using System.Windows.Navigation;
13using System.Windows.Shapes;
14using Microsoft.Research.DynamicDataDisplay.Common.Palettes;
15
16namespace TiledRenderingSample
17{
18	/// <summary>
19	/// Interaction logic for Window1.xaml
20	/// </summary>
21	public partial class Window1 : Window
22	{
23		public Window1()
24		{
25			InitializeComponent();
26		}
27
28		private const int count = 50000;
29		private readonly Point[] data = new Point[count];
30		private readonly Random rnd = new Random();
31		private void OnLoaded(object sender, RoutedEventArgs e)
32		{
33			GenerateData();
34
35			HsbPalette palette = new HsbPalette();
36			//chart1.AddPropertyBinding<Point>(Shape.FillProperty, p =>
37			//{
38			//    double length = Math.Sqrt(p.X * p.X + p.Y * p.Y) / Math.Sqrt(2);
39			//    return new SolidColorBrush(palette.GetColor(length));
40			//});
41			//chart2.AddPropertyBinding<Point>(Shape.FillProperty, p =>
42			//{
43			//    double length = Math.Sqrt(p.X * p.X + p.Y * p.Y) / Math.Sqrt(2);
44			//    return new SolidColorBrush(palette.GetColor(length));
45			//});
46
47			////chart1.ItemsSource = data;
48			//chart2.ItemsSource = data;
49		}
50
51		private void GenerateData()
52		{
53			for (int i = 0; i < count; i++)
54			{
55				data[i] = new Point(rnd.NextDouble(), rnd.NextDouble());
56			}
57		}
58	}
59}