Beispiel #1
0
        private void SetSummaryText(Rack rack)
        {
            string text = "";
            if (rack.Online)
            {
                text = rack.Bikes + " ";

                if (rack.Bikes == 1)
                    text += "sykkel - ";
                else
                    text += "sykler - ";

                text += rack.EmptyLocks + " ";

                if (rack.EmptyLocks == 1)
                    text += "plass";
                else
                    text += "plasser";
            }
            else
            {
                text = "Ukjent";
            }

            SummaryAmount.Text = text;

            if (!string.IsNullOrEmpty(rack.Description.Trim()))
                SummaryTitle.Text = rack.Description.Substring(3).Trim();
            else
                SummaryTitle.Text = string.Empty;

            //Summary.Visibility = System.Windows.Visibility.Visible;

            Storyboard popupStoryboard = (Storyboard)PopupGrid.Resources["PopupStoryBoard"];
            popupStoryboard.Begin();
        }
Beispiel #2
0
        private FrameworkElement GetRackControl(Rack rack)
        {
            //var control = new Border
            //{
            //    Width = size,
            //    Height = size,
            //    Background = new SolidColorBrush(GetColorGradiant(rack.Bikes)),
            //    DataContext = rack,
            //    //CornerRadius = new CornerRadius(3),
            //    BorderBrush = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0)),
            //    BorderThickness = new Thickness(1),
            //    CacheMode = new BitmapCache()
            //};

            //control.Child = new Border
            //{
            //    Width = size,
            //    Height = size / 2,
            //    Background = new SolidColorBrush(GetColorGradiant(rack.EmptyLocks)),
            //    Margin = new Thickness(0, size / 2 - 1, 0, 0),
            //    //CornerRadius = new CornerRadius(0,0,3,3),
            //    BorderBrush = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0)),
            //    BorderThickness = new Thickness(0,1,0,0)
            //};

            var control = new Ellipse
            {
                Fill = new SolidColorBrush(GetColorGradiant(rack.EmptyLocks)),
                Stroke = new SolidColorBrush(GetColorGradiant(rack.Bikes)),
                StrokeThickness = 7,
                Width = pinSize,
                Height = pinSize,
                DataContext = rack,
                VerticalAlignment = System.Windows.VerticalAlignment.Center,
                HorizontalAlignment = System.Windows.HorizontalAlignment.Center,
            };

            if (!rack.Online)
            {
                var brush = new SolidColorBrush(Color.FromArgb(255, 100, 100, 100));
                control.Fill = brush;
                control.Stroke = brush;
            }

            var button = new Button
            {
                Content = control,
                Margin = new Thickness(0),
                CacheMode = new BitmapCache(),
                Style = (Style)App.Current.Resources["TransparentButtonStyle"]
            };
            button.Click += button_Click;

            return button;
        }
Beispiel #3
0
 private void RemoveRackFromMap(Rack rack)
 {
     this.Dispatcher.BeginInvoke(() =>
     {
         var item = myLayer.Children.FirstOrDefault(r => ((FrameworkElement) r).DataContext == rack);
         if (item != null)
             myLayer.Children.Remove(item);
     });
 }
Beispiel #4
0
        private void AddRackToMap(Rack rack)
        {
            this.Dispatcher.BeginInvoke(() =>
            {
                //var pin = new Pushpin();
                //pin.Location = new GeoCoordinate(rack.Latitude, rack.Longitude);
                //pin.Content = rack.Id.ToString();
                //pin.CacheMode = new BitmapCache();
                //map.Children.Add(pin);

                myLayer.AddChild(GetRackControl(rack), new GeoCoordinate(rack.Latitude, rack.Longitude), new Point(pinSize / -2, pinSize / -2));
            });
        }