Esempio n. 1
0
        void UpdateSelection()
        {
            string selected = "";

            if ((Maps.Layers[0] as ShapeFileLayer).SelectedItems.Count == 0)
            {
                SelectedLabel.Text         = selected;
                SelectedLabelCount.Text    = " ";
                this.ClearButton.IsEnabled = false;
                this.ClearButton.Opacity   = 0.5;
            }
            else
            {
                int count = 0;

                for (int i = 0; i < (this.Maps.Layers[0] as ShapeFileLayer).SelectedItems.Count; i++)
                {
                    TicketData data = (this.Maps.Layers[0] as ShapeFileLayer).SelectedItems[i] as TicketData;

                    if (data.SeatNumber == "1" || data.SeatNumber == "2" || data.SeatNumber == "8" || data.SeatNumber == "9")
                    {
                    }

                    else
                    {
                        count++;
                        if ((this.Maps.Layers[0] as ShapeFileLayer).SelectedItems.Count <= 1 && (this.Maps.Layers[0] as ShapeFileLayer).SelectedItems.Count != 0)
                        {
                            selected += ("S" + data.SeatNumber);
                        }

                        else if (i == (this.Maps.Layers[0] as ShapeFileLayer).SelectedItems.Count - 1)
                        {
                            selected += ("S" + data.SeatNumber);
                        }
                        else
                        {
                            selected += ("S" + data.SeatNumber + ", ");
                        }

                        this.ClearButton.Opacity   = 1;
                        this.ClearButton.IsEnabled = true;
                        SelectedLabel.Text         = selected;
                    }
                }

                SelectedLabelCount.Text = "" + count;
            }
        }
Esempio n. 2
0
        private void MapsTicketBooking_ShapeSelectionChanged(object sender, ShapeSelectedEventArgs e)
        {
            TicketData data = e.Data as TicketData;

            if (data != null)
            {
                if (data.SeatNumber == "1" || data.SeatNumber == "2" || data.SeatNumber == "8" || data.SeatNumber == "9")
                {
                    if ((this.Maps.Layers[0] as ShapeFileLayer).SelectedItems.Contains(e.Data))
                    {
                        (this.Maps.Layers[0] as ShapeFileLayer).SelectedItems.Remove(e.Data);
                    }
                }
            }
        }
Esempio n. 3
0
        public MapsTicketBooking()
        {
            InitializeComponent();

            (this.Maps.Layers[0] as ShapeFileLayer).ItemsSource    = GetDataSource();
            (this.Maps.Layers[0] as ShapeFileLayer).ShapeSelected += (object obj) =>
            {
                TicketData data = obj as TicketData;
                if (data != null)
                {
                    if (data.SeatNumber == "1" || data.SeatNumber == "2" || data.SeatNumber == "8" || data.SeatNumber == "9")
                    {
                        if ((this.Maps.Layers[0] as ShapeFileLayer).SelectedItems.Contains(obj))
                        {
                            (this.Maps.Layers[0] as ShapeFileLayer).SelectedItems.Remove(obj);
                        }
                    }
                }
            };
            (this.Maps.Layers[0] as ShapeFileLayer).SelectedItems.CollectionChanged += (sender, e) =>
            {
                UpdateSelection();
            };

            this.ClearButton.Clicked += (sender, e) =>
            {
                if ((this.Maps.Layers[0] as ShapeFileLayer).SelectedItems.Count != 0)
                {
                    (this.Maps.Layers[0] as ShapeFileLayer).SelectedItems.Clear();
                    SelectedLabel.Text         = "";
                    SelectedLabelCount.Text    = "" + (this.Maps.Layers[0] as ShapeFileLayer).SelectedItems.Count;
                    this.ClearButton.IsEnabled = false;
                    this.ClearButton.Opacity   = 0.5;
                }
            };
        }