private void Button_OnClick(object sender, RoutedEventArgs e) { if (isOneToolButtonHolding) { isOneToolButtonHolding = false; } else { PocketPaintApplication pocketPaintApplication = PocketPaintApplication.GetInstance(); if (pocketPaintApplication != null) { pocketPaintApplication.AppbarTop.BtnSelectedColorVisible(false); pocketPaintApplication.isBrushEraser = false; pocketPaintApplication.isBrushTool = false; pocketPaintApplication.isToolPickerUsed = true; bool enableEdgeTypes = false; PocketPaintApplication.GetInstance().PaintingAreaView.changeBackgroundColorAndOpacityOfPaintingAreaCanvas(Colors.Transparent, 1.0); pocketPaintApplication.PaintingAreaView.resetControls(); switch (((Button)sender).Name) { case "BtnBrush": pocketPaintApplication.SwitchTool(ToolType.Brush); pocketPaintApplication.AppbarTop.BtnSelectedColorVisible(true); pocketPaintApplication.isBrushTool = true; break; case "BtnCrop": pocketPaintApplication.SwitchTool(ToolType.Crop); break; case "BtnCursor": pocketPaintApplication.SwitchTool(ToolType.Cursor); pocketPaintApplication.AppbarTop.BtnSelectedColorVisible(true); break; case "BtnEllipse": pocketPaintApplication.SwitchTool(ToolType.Ellipse); enableEdgeTypes = false; pocketPaintApplication.BarRecEllShape.setIsEnabledOfEdgeType(enableEdgeTypes, enableEdgeTypes, enableEdgeTypes); pocketPaintApplication.BarRecEllShape.setForgroundOfLabelEdgeType(Colors.White); pocketPaintApplication.ToolCurrent.ResetDrawingSpace(); pocketPaintApplication.EllipseSelectionControl.Visibility = Visibility.Visible; pocketPaintApplication.AppbarTop.BtnSelectedColorVisible(true); PocketPaintApplication.GetInstance().PaintingAreaView.changeBackgroundColorAndOpacityOfPaintingAreaCanvas(Colors.Black, 0.5); break; case "BtnEraser": pocketPaintApplication.SwitchTool(ToolType.Eraser); break; case "BtnFill": pocketPaintApplication.SwitchTool(ToolType.Fill); pocketPaintApplication.AppbarTop.BtnSelectedColorVisible(true); break; case "BtnFlip": pocketPaintApplication.SwitchTool(ToolType.Flip); break; case "BtnImportPicture": pocketPaintApplication.SwitchTool(ToolType.ImportPng); pocketPaintApplication.GridImportImageSelectionControl.Children.Clear(); pocketPaintApplication.GridImportImageSelectionControl.Children.Add(new ImportImageSelectionControl()); pocketPaintApplication.BarRecEllShape.setBtnHeightValue = 160.0; pocketPaintApplication.BarRecEllShape.setBtnWidthValue = 160.0; pocketPaintApplication.GridImportImageSelectionControl.Visibility = Visibility.Visible; pocketPaintApplication.InfoBoxActionControl.Visibility = Visibility.Visible; pocketPaintApplication.AppbarTop.Visibility = Visibility.Collapsed; pocketPaintApplication.PaintingAreaView.BottomAppBar.Visibility = Visibility.Collapsed; // TODO: Write a function with the following three sentences and put it in the paintingareaview.cs. // TODO: Implement this functionality //PocketPaintApplication.GetInstance().PaintingAreaView.BottomAppBar.Visibility = Visibility.Collapsed; //PocketPaintApplication.GetInstance().PaintingAreaView.changeBackgroundColorAndOpacityOfPaintingAreaCanvas(Colors.Black, 0.5); enableEdgeTypes = true; pocketPaintApplication.BarRecEllShape.setIsEnabledOfEdgeType(enableEdgeTypes, enableEdgeTypes, enableEdgeTypes); pocketPaintApplication.BarRecEllShape.setForgroundOfLabelEdgeType(Colors.White); pocketPaintApplication.PaintingAreaView.changeBackgroundColorAndOpacityOfPaintingAreaCanvas(Colors.Black, 0.5); break; case "BtnLine": pocketPaintApplication.SwitchTool((ToolType.Line)); pocketPaintApplication.AppbarTop.BtnSelectedColorVisible(true); break; case "BtnMove": pocketPaintApplication.SwitchTool(ToolType.Move); break; case "BtnPipette": pocketPaintApplication.SwitchTool(ToolType.Pipette); break; case "BtnRectangle": pocketPaintApplication.SwitchTool(ToolType.Rect); enableEdgeTypes = true; pocketPaintApplication.BarRecEllShape.setIsEnabledOfEdgeType(enableEdgeTypes, enableEdgeTypes, enableEdgeTypes); pocketPaintApplication.BarRecEllShape.setForgroundOfLabelEdgeType(Colors.White); pocketPaintApplication.ToolCurrent.ResetDrawingSpace(); pocketPaintApplication.RectangleSelectionControl.Visibility = Visibility.Visible; pocketPaintApplication.AppbarTop.BtnSelectedColorVisible(true); PocketPaintApplication.GetInstance().PaintingAreaView.changeBackgroundColorAndOpacityOfPaintingAreaCanvas(Colors.Black, 0.5); break; case "BtnRotate": pocketPaintApplication.SwitchTool(ToolType.Rotate); break; case "BtnStamp": pocketPaintApplication.SwitchTool(ToolType.Stamp); PocketPaintApplication.GetInstance().StampControl.SetStampSelection(); break; case "BtnZoom": pocketPaintApplication.SwitchTool(ToolType.Zoom); break; } navigateToPaintingAreaView(); } } }