PageRenderTime 47ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

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

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