Esempio n. 1
0
        private void OnCanvasCreatedHandler(object sender, NewCanvasEventArgs e)
        {
            TblOverview newCanvas = new TblOverview
            {
                Name        = e.CanvasName,
                DateCreated = e.CreationDate,
                DateUpdated = e.CreationDate
            };

            ctx.TblOverviews.InsertOnSubmit(newCanvas);
            ctx.SubmitChanges();
            cm.LoadCanvasses();
        }
Esempio n. 2
0
 private void bt_DeleteDrawing_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         TblOverview selected = dg_DrawingOverview.SelectedItem as TblOverview;
         cm.DeleteCanvas(selected.Name);
         cm.LoadCanvasses();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error - " + ex);
     }
 }
Esempio n. 3
0
        private void CanvasWindow1_Closed(object sender, EventArgs e)
        {
            TblOverview tblOverview = new TblOverview()
            {
                DateUpdated = DateTime.Now,
                Name        = this.Title
            };

            var t = ctx.TblOverviews.Where(n => n.Name == tblOverview.Name).FirstOrDefault();

            if (t != null)
            {
                t.DateUpdated = tblOverview.DateUpdated;
                ctx.SubmitChanges();
                CanvasManager.LoadCanvasses();
            }
        }
Esempio n. 4
0
        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);
                }
            }
        }
Esempio n. 5
0
 partial void DeleteTblOverview(TblOverview instance);
Esempio n. 6
0
 partial void UpdateTblOverview(TblOverview instance);
Esempio n. 7
0
 partial void InsertTblOverview(TblOverview instance);