Exemplo n.º 1
0
 private void RemoveParkingArea(ParkingArea toRemove)
 {
     ParkingAreasCollection.Remove(toRemove);
     ResetBitmapToOriginal();
     foreach (var area in ParkingAreasCollection)
     {
         DrawAreaOnBitmap(area);
     }
 }
Exemplo n.º 2
0
        private void DrawTemporaryArea(ParkingArea parkingArea)
        {
            Bitmap tempBitmap = new Bitmap(BitmapDisplayed.Width, BitmapDisplayed.Height);

            using (Graphics g = Graphics.FromImage(tempBitmap))
            {
                g.DrawImage(BitmapDisplayed, 0, 0);
                g.DrawRectangle(Pens.Red, GetRectangle(parkingArea.StartingPoint, parkingArea.EndingPoint));
                this.DisplayImage.Source = tempBitmap.ToBitmapImage();
            }
        }
Exemplo n.º 3
0
        private void CheckBox_Checked(object sender, RoutedEventArgs e)
        {
            ParkingArea areaToHighlight = (ParkingArea)((CheckBox)sender).DataContext;

            if (areaToHighlight.Unavailable)
            {
                DrawAreaOnBitmap(areaToHighlight, Pens.Yellow);
            }
            else
            {
                DrawAreaOnBitmap(areaToHighlight);
            }
        }
Exemplo n.º 4
0
        private void DrawAreaOnBitmap(ParkingArea parkingArea, System.Drawing.Pen color = null)
        {
            if (color == null)
            {
                color = Pens.Red;
            }
            Bitmap tempBitmap = new Bitmap(BitmapDisplayed.Width, BitmapDisplayed.Height);

            using (Graphics g = Graphics.FromImage(tempBitmap))
            {
                g.DrawImage(BitmapDisplayed, 0, 0);
                g.DrawRectangle(color, GetRectangle(parkingArea.StartingPoint, parkingArea.EndingPoint));
                BitmapDisplayed = tempBitmap;
            }
        }
Exemplo n.º 5
0
        //select area button.. press once to toggle on and again to toggle off..
        //when on, points pressed will be added to the list of points.
        //
        //when toggled on create two points on first click.. have at same point..and draw line between them..
        //then when new point added, add to list inbetween and draw lines to those..

        private void HighlightParkingArea(ParkingArea toHighlight, System.Drawing.Pen penColor = null)
        {
            if (penColor == null)
            {
                penColor = Pens.GreenYellow;
            }
            ResetBitmapToOriginal();
            foreach (var area in ParkingAreasCollection)
            {
                if (area == toHighlight)
                {
                    DrawAreaOnBitmap(area, penColor);
                }
                else
                {
                    DrawAreaOnBitmap(area);
                }
            }
        }
Exemplo n.º 6
0
        private void Button_Click_5(object sender, RoutedEventArgs e)
        {
            ParkingArea areaToHighlight = (ParkingArea)((Button)sender).DataContext;

            HighlightParkingArea(areaToHighlight);
        }
Exemplo n.º 7
0
        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            ParkingArea toRemove = (ParkingArea)((Button)sender).DataContext;

            RemoveParkingArea(toRemove);
        }