private void TapGestureRecognizer_Tapped_LabelBoxView(object sender, EventArgs e) { count++; MyBox.TranslateTo(100, 250, 1000, Easing.BounceOut); MyBox.ScaleTo(2, 1000); MyBox.FadeTo(0.5, 1000); MyBox.RotateTo(45, 1000); }
private static void RoundedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { bool value = (bool)e.NewValue; MyBox thisMyBox = (MyBox)sender; // Hide/show the edges thisMyBox.edgeRounded.Visibility = (value ? Visibility.Visible : Visibility.Hidden); thisMyBox.edgePolygon.Visibility = (value ? Visibility.Hidden : Visibility.Visible); }
//Метод обработки нажатия на кнопк, удаления товара public RedirectToActionResult RemoveFromCart(int Id, string returnUrl) { MyBox myBox = repository.MyBoxes.FirstOrDefault(p => p.Id == Id); if (myBox != null) { cart.RemoveLine(myBox); } return(RedirectToAction("MyBoxList", new { returnUrl })); }
public IActionResult Delete(int Id) { MyBox deletedProduct = repository.DeleteProduct(Id); if (deletedProduct != null) { TempData["message"] = $"{deletedProduct.Name} был удален"; } return(RedirectToAction("Index")); }
private void MyBlock_MouseDown(object sender, MouseButtonEventArgs e) { if (e.ClickCount == 2) { MyBlock.Visibility = Visibility.Collapsed; MyBox.Visibility = Visibility.Visible; MyBox.Focus(); e.Handled = true; } }
public RedirectToActionResult AddToCart(int Id, string returnUrl) { MyBox myBox = repository.MyBoxes .FirstOrDefault(p => p.Id == Id); if (myBox != null) { cart.AddItem(myBox, 1); } return(RedirectToAction("MyBoxList", new { returnUrl })); }
//Удаление продукта public MyBox DeleteProduct(int Id) { MyBox dbEntry = context.MyBoxes.FirstOrDefault(p => p.Id == Id); if (dbEntry != null) { context.MyBoxes.Remove(dbEntry); context.SaveChanges(); } return(dbEntry); }
public IActionResult Edit(MyBox myBox) { if (ModelState.IsValid) { repository.SaveProduct(myBox); TempData["message"] = $"{myBox.Name} был сохранен"; return(RedirectToAction("Index")); } else { return(View(myBox)); } }
public static string GetString(string title) { var box = new MyBox { Text = title }; if (box.ShowDialog() == DialogResult.OK) { return(box.ResultText); } return(string.Empty); }
// Add a text box to the form public void addTextBox(string str, int left, int top, int width, int height, Brush fillRectBrush, Brush textBrush) { MyBox box = new MyBox(); box.Top = top; box.Left = left; box.Width = width; box.Height = height; box.Text = str; box.fillRectBrush = fillRectBrush; box.textBrush = textBrush; this.Controls.Add(box); box.BringToFront(); }
//Добавление товара в корзину public virtual void AddItem(MyBox myBox, int quantity) { MBCartLine line = lineCollection .Where(p => p.MyBox.Id == myBox.Id).FirstOrDefault(); if (line == null) { lineCollection.Add(new MBCartLine { MyBox = myBox, Quantity = quantity }); } else { line.Quantity += quantity; } }
static void Main(string[] args) { Efl.All.Init(); Efl.Loop loop = new Efl.Loop(); EcoreEvas ecore_evas = new EcoreEvas(); Efl.Canvas.Object canvas = ecore_evas.canvas; canvas.SetVisible(true); Efl.Object parent = canvas.GetParent(); System.Diagnostics.Debug.Assert(parent.NativeHandle != IntPtr.Zero); Evas.Box box = new MyBox(canvas); Eina.Size2D size = new Eina.Size2D(); size.W = 320; size.H = 240; box.SetSize(size); box.SetVisible(true); Efl.Canvas.Rectangle rect = new Efl.Canvas.Rectangle(canvas); rect.SetColor(0, 0, 255, 255); size.W = 320; size.H = 120; rect.SetSize(size); rect.SetVisible(true); box.Append(rect); Efl.Canvas.Rectangle rect2 = new Efl.Canvas.Rectangle(canvas); rect2.SetColor(0, 255, 0, 255); rect2.SetSize(size); rect2.SetVisible(true); box.Append(rect2); loop.Begin(); Efl.All.Shutdown(); }
//Сохранение продукта public void SaveProduct(MyBox myBox) { if (myBox.Id == 0) { context.MyBoxes.Add(myBox); } else { MyBox dbEntry = context.MyBoxes.FirstOrDefault(p => p.Id == myBox.Id); if (dbEntry != null) { dbEntry.Img = myBox.Img; dbEntry.Name = myBox.Name; dbEntry.Description = myBox.Description; dbEntry.Category = myBox.Category; dbEntry.Price = myBox.Price; } } context.SaveChanges(); }
public override void RemoveLine(MyBox myBox) { base.RemoveLine(myBox); Session.SetJson("CartMyBox", this); }
public override void AddItem(MyBox myBox, int quantity) { base.AddItem(myBox, quantity); Session.SetJson("CartMyBox", this); }
//Удаление товара из корзины public virtual void RemoveLine(MyBox myBox) => lineCollection.RemoveAll(l => l.MyBox.Id == myBox.Id);
public EditPluginWindow(params object[] options) : base() { var box = new MyBox(780, 395); Put(box, 10, 30); var backButton = new TouchButton(); backButton.text = "back"; backButton.SetSizeRequest(100, 40); backButton.ButtonReleaseEvent += (o, args) => GuiGlobal.ChangeScreens("Plugins"); Put(backButton, 15, 380); var label = new TouchLabel(); label.textSize = 13; label.WidthRequest = 780; label.textAlignment = MyAlignment.Center; tv = new TextView(); tv.ModifyFont(Pango.FontDescription.FromString("Sans 11")); tv.ModifyText(StateType.Normal, MyColor.NewGtkColor("black")); tv.ModifyBase(StateType.Normal, MyColor.NewGtkColor("grey4")); tv.CanFocus = false; ScrolledWindow sw = new ScrolledWindow(); sw.SetSizeRequest(770, 315); sw.Add(tv); Put(sw, 15, 60); BaseScript script = null; foreach (var opt in options) { script = opt as BaseScript; if (script != null) { label.text = script.name; label.textColor = "pri"; DisplayErrors(script); var b = new TouchButton(); b.SetSizeRequest(100, 40); b.text = "Recompile and Load"; b.ButtonReleaseEvent += (o, args) => { if (script.errors.Count != 0) { script.CompileAndLoad(); if (script.flags.HasFlag(ScriptFlags.Initializer)) { script.RunInitialize(); } DisplayErrors(script); tv.QueueDraw(); } else { MessageBox.Show("Script is already running.\nCannot recomile and load"); } }; Put(b, 685, 380); break; } } if (script == null) { label.text = "No Plugin Selected"; label.textColor = "secb"; backButton.text = "Select Plugin"; } Put(label, 10, 35); ShowAll(); }