private void btnClearImg_Click(object sender, RoutedEventArgs e) { myPlot = null; canvasPreview.Children.Clear(); //removes previous images/elements from the canvas canvasPreview.Background = System.Windows.Media.Brushes.White; currentTransition = GUITransitions.H2imgClear; handleGUIstates(); }
private void btnSelectImg_Click(object sender, RoutedEventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Image file (*.bmp) | *.bmp"; //bool result = (bool)openFileDialog.ShowDialog(); if ((bool)openFileDialog.ShowDialog()) { myPlot = new Plottr(openFileDialog.FileName); //creates a plottr object with the selected image canvasPreview.Children.Clear(); //removes previous images/elements from the canvas myPlot.ImgMoveX = Convert.ToInt32((Plottr.RobotWidth - myPlot.GetImgWidth) / 2); myPlot.ImgMoveY = Convert.ToInt32((Plottr.RobotHeight - myPlot.GetImgHeight) / 2); placeImageAt(myPlot.ImgMoveX, myPlot.ImgMoveY); //places the image in the center of preview canvas currentTransition = GUITransitions.H0imgOpen; handleGUIstates(); } }