public ActionResult DeleteConfirmed(int id) { Canva canva = db.Canvas.Find(id); db.Canvas.Remove(canva); db.SaveChanges(); return(RedirectToAction("Index")); }
// ja izvēlēts kontrolpunkts, veic tā pārbīdi ar peli private void Canva_MouseMove(object sender, MouseEventArgs e) { if (movingPoint != -1) { P[movingPoint, 0] = e.X; P[movingPoint, 1] = e.Y; Canva.Invalidate(); } }
private void OnMouseDrag() { Point mousePos = Mouse.GetPosition(this); Vector offset = mousePos - _lastMousePos; Canva.Translate(offset.X, offset.Y); _lastMousePos = mousePos; }
public ActionResult Edit([Bind(Include = "CanvasId,Key_Partners,Value_Propositions,Customer_Relationships,Customer_Segments,Key_Resources,Channels,Cost_Structure,Revenue_Streams,UserId")] Canva canva) { if (ModelState.IsValid) { db.Entry(canva).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.UserId = new SelectList(db.AspNetUsers, "Id", "Email", canva.UserId); return(View(canva)); }
private void MainWindow_MouseDoubleClick(object sender, MouseButtonEventArgs e) { //Span primitive = Canva.OnMouseClick(e, true) as Span; //if (primitive == null) // return; //MessageBox.Show(primitive.Id.ToString()); Canva.OnMouseClick(e, true); }
private void AddSpan(Point point1, Point point2, int id) { Span spanVisual = new Span(point1, point2, SpanPen, SpanHitArea, SpanHitPen); spanVisual.Id = id; spanVisual.ReDraw(); Canva.AddVisual(spanVisual); //test spanVisual.MouseDoubleClick += SpanVisual_MouseDoubleClick; }
// GET: Canvas/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Canva canva = db.Canvas.Find(id); if (canva == null) { return(HttpNotFound()); } return(View(canva)); }
private void OnMouseWheel(float delta) { //одно деление скрола //int oneDiv = 120; float offset = 1.5f; if (delta < 0) { offset = 1 / 1.5f; } Canva.Scale(offset); }
// ļāuj mainīt paralēles attālumu, izmantojot klavietūras uz augšu/leju bultiņas private void OffsetForm_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Up) { distance++; Canva.Invalidate(); } else if (e.KeyCode == Keys.Down) { distance--; Canva.Invalidate(); } }
// GET: Canvas/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Canva canva = db.Canvas.Find(id); if (canva == null) { return(HttpNotFound()); } ViewBag.UserId = new SelectList(db.AspNetUsers, "Id", "Email", canva.UserId); return(View(canva)); }
public ActionResult LoadCanvas(int?id) { JavaScriptSerializer jsonSerializer = new JavaScriptSerializer(); if (id == null) { if (User.Identity.GetUserId() != null) { //load action goes here ApplicationUser user = db.Users.Find(User.Identity.GetUserId()); IList <object> canvas = db.Canvas.Where(c => c.User.Id == user.Id).Select(c => new { id = c.Id, Name = c.Name, UpdatedDate = c.UpdatedDate }).ToList <dynamic>() //Convert date to string .Select(o => new { id = o.id, name = o.Name, UpdatedDate = o.UpdatedDate.ToString("dd-MM-yyyy") }).ToList <object>(); //IList<object> jsObj = new List<object>(); //foreach(Canva c in canvas) //{ // jsObj.Add(new { id=c.Id, name = c.name, UpdatedDate = c.UpdatedDate.Value.ToString("dd-MM-yyyy")}); //} Response.StatusCode = 202; return(Content(jsonSerializer.Serialize(canvas))); } else { Response.StatusCode = 403; return(Content(string.Empty)); } } else { Canva canva = db.Canvas.Find(id); if (canva == null) { Response.StatusCode = 404; return(Content("File not found!")); } else { var jsdata = new { id = canva.Id, json_data = canva.JsonData, name = canva.Name }; Response.StatusCode = 200; return(Content(jsonSerializer.Serialize(jsdata))); } } }
private void Canva_MouseMove(object sender, MouseEventArgs e) { if (moving.X == 0) { if (moving.Y == 0) { start = e.Location; } else if (moving.Y == 1) { end = e.Location; } Canva.Invalidate(); } else if (moving.X == 1) { P[moving.Y] = e.Location; Canva.Invalidate(); } }
public ActionResult SaveCanvas(int?id, string data, string name) { if (User.Identity.GetUserId() != null) { if (id == null) { //save action goes here string jsonData = data; ApplicationUser user = db.Users.Find(User.Identity.GetUserId()); Canva canvas = db.Canvas.Create(); canvas.User = user; canvas.Name = name; canvas.UpdatedDate = DateTime.Now; canvas.JsonData = jsonData; db.Canvas.Add(canvas); db.SaveChanges(); Response.StatusCode = 202; return(Content(canvas.Id.ToString())); } else { Canva canvas = db.Canvas.Find(id); canvas.Name = name; canvas.JsonData = data; canvas.UpdatedDate = DateTime.Now; db.SaveChanges(); Response.StatusCode = 202; return(Content(canvas.Id.ToString())); } } else { Response.StatusCode = 403; return(Content(string.Empty)); } }
private void OnMouseMove() { Canva.OnMouseMove(); }
private void InitCanvas() { Canva.Width = this.Width; Canva.Height = this.Height; Canva.AddBackgroundPrimitive(); }
void Awake() { Time.timeScale = 0f; Instance = this; }