/// <summary>
        /// Loads the detected objects from the viewmodel and sorts them
        /// </summary>
        public void LoadDetectedObjects()
        {
            foreach (var item in _detectedObjects)
            {
                switch (item.Shape)
                {
                case DrawingShape.Rectangle:
                    // We initially only want to load the rectangles.
                    // Background of button.
                    var imageBrush = new ImageBrush();
                    imageBrush.ImageSource = item.Image;

                    var button = new Button()
                    {
                        Width           = item.Width / GetCurrentWidthRatio(), // 1.33 und 2
                        Height          = item.Height / GetCurrentHeightRatio(),
                        Tag             = item.Id,
                        Background      = imageBrush,
                        Opacity         = 0,
                        BorderThickness = new Thickness(0),
                        BorderBrush     = Brushes.Black
                    };
                    button.Click          += DetectedRectangleObject_Click; // Sub to event.
                    button.PreviewMouseUp += Button_MouseUp;

                    Canvas.SetLeft(button, item.X / GetCurrentWidthRatio());
                    Canvas.SetTop(button, item.Y / GetCurrentHeightRatio());

                    ViewModelImage_Canvas.Children.Add(button);

                    _detectedRectangles.Add(item);
                    break;

                case DrawingShape.Line:
                    _detectedLines.Add(item);
                    break;

                case DrawingShape.ReferenceLine:
                    _detectedReferenceLine = item;
                    break;

                default:
                    break;
                }
            }
        }
        /// <summary>
        /// Init the shapes and buttons when the Image Canvas is loaded.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ViewModelImage_Canvas_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                // Wait a bit. We do not want the user to spam click the canvas and thus breaking it.
                Thread.Sleep(500);
                _lastCanvasSize = new Size(ViewModelImage_Canvas.Width, ViewModelImage_Canvas.Height);
                ViewModelImage_Canvas.MouseMove += ViewModelImage_Canvas_MouseMove;
                ViewModelImage_Canvas.MouseUp   += ViewModelImage_Canvas_MouseUp;

                ViewModelImage_Canvas.Children.Clear();

                foreach (var item in _detectedObjects)
                {
                    switch (item.Shape)
                    {
                    case Model.Arguments.DrawingShape.Rectangle:
                        // We initially only want to load the rectangles.
                        // Background of button.
                        var imageBrush = new ImageBrush();
                        imageBrush.ImageSource = item.Image;

                        var button = new Button()
                        {
                            Width           = item.Width / GetCurrentWidthRatio(), // 1.33 und 2
                            Height          = item.Height / GetCurrentHeightRatio(),
                            Tag             = item.Id,
                            Background      = imageBrush,
                            Opacity         = 0,
                            BorderThickness = new Thickness(0),
                            BorderBrush     = Brushes.Black
                        };
                        button.Click          += DetectedRectangleObject_Click; // Sub to event.
                        button.PreviewMouseUp += Button_MouseUp;

                        Canvas.SetLeft(button, item.X / GetCurrentWidthRatio());
                        Canvas.SetTop(button, item.Y / GetCurrentHeightRatio());

                        ViewModelImage_Canvas.Children.Add(button);
                        _detectedRectangles.Add(item);
                        break;

                    case Model.Arguments.DrawingShape.Line:
                        _detectedLines.Add(item);
                        break;

                    case Model.Arguments.DrawingShape.ReferenceLine:
                        _detectedReferenceLine = item;
                        break;

                    default:
                        break;
                    }
                }

                if (_detectedReferenceLine == null)
                {
                    ServiceContainer.GetService <DialogService>().InformUser("Error", $"No reference line was found - report might be incomplete.");
                }
                else
                {
                    DrawReferenceLineOfImage();
                }

                HandleWindowResize();

                _canvasInitiliazed = true;
            }
            catch (Exception ex)
            {
                ServiceContainer.GetService <DialogService>().InformUser("Error", $"An error occured while loading the report: {ex}");
            }
        }