async Task RemovePizza(Pizza configuredPizza) { if (await JS.Confirm($"Remove {configuredPizza.Special.Name} pizza from the order?")) { OrderState.RemoveConfiguredPizza(configuredPizza); } }
private async Task DeleteCategory(Category category) { await JS.MyFunction("custom message"); var confirmed = await JS.Confirm($"Are you sure you want to delete {category.CategoryName}?"); if (confirmed) { Categories.Remove(category); } }
protected void Foot2_Submit(object sender, EventArgs e) { string title = this.TxtTitle.Text; if (string.IsNullOrEmpty(title)) { JS.AlertDoFun("请输入分页名称!", "history.back()"); } else { //创建一个新节点 XmlElement newElement = xmldoc.CreateElement("item"); XmlNode root = xmldoc.SelectSingleNode("pagetemplate"); XmlNodeList xnl = root.ChildNodes; int maxid = 0; foreach (XmlNode xnf in xnl) { XmlElement xe = (XmlElement)xnf; int id = Utils.StrToInt(xe.GetAttribute("name")); if (id > maxid) { maxid = id; } } newElement.SetAttribute("name", (maxid + 1).ToString()); newElement.SetAttribute("issys", "0"); newElement.SetAttribute("title", title); //创建newElement下的节点 XmlElement etp = xmldoc.CreateElement("tp"); etp.InnerText = this.TxtTp.Text; //将newElement下的节点加到newElement上 newElement.AppendChild(etp); //将newElement加入到xml文件中(加在最后一条记录上) xmldoc.DocumentElement.AppendChild(newElement); xmldoc.Save(Server.MapPath(_MainTemplatePath + "config/pagestyle.config")); } JS.Confirm("恭喜,分页样式添加成功,继续添加吗?", "location.href='" + KSCMS.GetInstallDir() + MyCache.GetCacheConfig(4) + "/label/KS.Label.PageStyle.aspx?action=Add&templateId=" + templateId + "';", "location.href='" + KSCMS.GetInstallDir() + MyCache.GetCacheConfig(4) + "/label/KS.Label.PageStyle.Aspx?templateId=" + templateId + "';"); }
public void ConfirmReturnsCallStatement() { var s = JS.Confirm("Do you want to continue?"); Assert.AreEqual("confirm(\"Do you want to continue?\");", s.ToString()); }