public Flicker()
        {
            InitializeComponent();
            vl = maps.Layers[0] as C1VectorLayer;
            vl.UriSourceLoaded += (s, e) =>
            {
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    txt.Visibility    = Visibility.Collapsed;
                    maps.Opacity      = 1;
                    btnLoad.IsEnabled = tb.IsEnabled = true;
                    _timer.Start();
                }));
            };
            vl.UriSourceFailed += (s, e) =>
            {
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    txt.Text          = "Can't load data.";
                    btnLoad.IsEnabled = tb.IsEnabled = true;
                }));
            };

            // shuffle images in z-order
            _timer = new DispatcherTimer()
            {
                Interval = TimeSpan.FromSeconds(0.5)
            };
            _timer.Tick += (s, e) =>
            {
                int cnt = vl.Children.Count;
                if (cnt >= 2)
                {
                    vl.BeginUpdate();

                    C1VectorItemBase item = vl.Children[0];
                    vl.Children.RemoveAt(0);
                    vl.Children.Add(item);

                    vl.EndUpdate();
                }
            };

            btnLoad.IsEnabledChanged += (s, e) =>
            {
                btnLoad.Content = btnLoad.IsEnabled ? "Load" : "Loading...";
            };
            maps.Zoom = 4;
        }
        bool ProcessWorldMap(C1VectorItemBase v)
        {
            string name = ToolTipService.GetToolTip(v) as string;

            Country country = countries[name];

            if (country != null)
            {
                v.Fill = country.Fill;
            }
            else
            {
                v.Fill = null;
            }

            return(true);
        }
Exemple #3
0
        void InitialVectorItemBase(C1VectorItemBase vector, C1ShapeAttributes attribute, Location location)
        {
            string toolTip = string.Empty;

            vector.Stroke = new SolidColorBrush(Colors.LightGray);
            switch (location)
            {
            case Location.USA:
                vector.Fill = new SolidColorBrush(Colors.Purple);
                toolTip     = (string)attribute["STATE_NAME"];
                break;

            case Location.Japan:
                vector.Fill = new SolidColorBrush(Colors.Brown);
                toolTip     = (string)attribute["NAME_UTF"];
                break;
            }
            ToolTipService.SetToolTip(vector, toolTip);
        }
        void Flicker_Loaded(object sender, RoutedEventArgs e)
        {
            this.maps.Zoom = 0;
            // shuffle images in z-order
            vl     = maps.Layers[0] as C1VectorLayer;
            _timer = new DispatcherTimer()
            {
                Interval = TimeSpan.FromSeconds(0.5)
            };
            _timer.Tick += (ts, te) =>
            {
                int cnt = vl.Children.Count;
                if (cnt >= 2)
                {
                    vl.BeginUpdate();

                    C1VectorItemBase item = vl.Children[0];
                    vl.Children.RemoveAt(0);
                    vl.Children.Add(item);

                    vl.EndUpdate();
                }
            };
        }
        bool ProcessWorldMap(C1VectorItemBase v)
        {
            string name = ToolTipService.GetToolTip(v) as string;

              Country country = countries[name];
              if (country != null)
            v.Fill = country.Fill;
              else
            v.Fill = null;

              return true;
        }
Exemple #6
0
 void ProcessUSMap(C1VectorItemBase vector, C1ShapeAttributes attribute)
 {
     ToolTipService.SetToolTip(vector, attribute["STATE_NAME"]);
     vector.Fill = new SolidColorBrush(Color.FromArgb(255, 56, 64, 217));
     vector.Stroke = new SolidColorBrush(Colors.LightGray);
 }
Exemple #7
0
 void ProcessMap(C1VectorItemBase vector, C1ShapeAttributes attribute, Location location)
 {
     InitialVectorItemBase(vector, attribute, location);
 }