private void bt_AddNewDrawing_Click(object sender, RoutedEventArgs e) { if (tb_Drawing_Name.Text != string.Empty) { canvasManager.CreateNewCanvas(tb_Drawing_Name.Text); CanvasWindow canvasWindow = new CanvasWindow(tb_Drawing_Name.Text, Window); canvasWindow.Title = canvasWindow.CanvasName; OnCanvasCreation(new NewCanvasEventArgs(canvasWindow.CanvasName, DateTime.Now)); canvasWindow.Show(); this.Close(); } else { MessageBox.Show("Please provide a proper name for the canvas."); } }
private void dg_DrawingOverview_MouseDoubleClick(object sender, MouseButtonEventArgs e) { TblOverview selection = dg_DrawingOverview.SelectedItem as TblOverview; if (selection != null) { try { CanvasWindow canvas = cm.CreateNewCanvas(selection.Name); canvas.Show(); var savedShapes = from o in ctx.TblOverviews where o.Name == canvas.Title from p in ctx.TblPositions where p.Drawing_ID == o.Drawing_ID from s in ctx.TblShapes where s.Shape_ID == p.Shape_ID select new SavedShape { R = (byte)s.TblColor.Red, G = (byte)s.TblColor.Green, B = (byte)s.TblColor.Blue, W = (int)s.Width, H = (int)s.Height, X = (int)p.X, Y = (int)p.Y, Shape = s.Shape }; foreach (var item in savedShapes) { Shape loadedShape = sm.RecreateShape(item); cm.RedrawAllShapes(loadedShape, (double)item.X, (double)item.Y); } } catch (Exception ex) { MessageBox.Show("Error - " + ex); } } }