private void Flicker_Loaded(object sender, RoutedEventArgs e)
        {
            if (maps.Layers.Count > 0)
            {
                vl = maps.Layers[0] as VectorLayer;
            }
            else
            {
                vl = new VectorLayer()
                {
                    ItemStyle = this.FindResource("style") as Style
                };
                maps.Layers.Add(vl);
            }
            vl.UriSourceLoaded += vl_UriSourceLoaded;
            vl.UriSource        = new Uri("http://api.flickr.com/services/feeds/geo/Uruguay/Montevideo");

            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();

                    VectorItemBase 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;
        }
Exemplo n.º 2
0
        bool ProcessWorldMap(VectorItemBase 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);
        }
Exemplo n.º 3
0
        void InitialVectorItemBase(VectorItemBase 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);
        }
Exemplo n.º 4
0
 void ProcessMap(VectorItemBase vector, C1ShapeAttributes attribute, Location location)
 {
     InitialVectorItemBase(vector, attribute, location);
 }